[SLOYD] Add Repl iframe
This commit is contained in:
parent
48c9630647
commit
38d4eca60a
4 changed files with 19 additions and 2 deletions
|
|
@ -11,10 +11,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// tplPlayground home page template
|
tplPlayground base.TplName = "playground/playground"
|
||||||
tplPlayground base.TplName = "playground"
|
tplPlaygroundReplIframe base.TplName = "playground/repl-iframe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func PlaygroundReplIframe(ctx *context.Context) {
|
||||||
|
ctx.Data["PageIsPlayground"] = true
|
||||||
|
ctx.HTML(http.StatusOK, tplPlaygroundReplIframe)
|
||||||
|
}
|
||||||
|
|
||||||
func Playground(ctx *context.Context) {
|
func Playground(ctx *context.Context) {
|
||||||
if ctx.IsSigned {
|
if ctx.IsSigned {
|
||||||
ctx.Data["UserName"] = ctx.Doer.DisplayName()
|
ctx.Data["UserName"] = ctx.Doer.DisplayName()
|
||||||
|
|
|
||||||
|
|
@ -471,6 +471,7 @@ func registerRoutes(m *web.Route) {
|
||||||
|
|
||||||
m.Get("/", Home)
|
m.Get("/", Home)
|
||||||
m.Get("/playground", Playground)
|
m.Get("/playground", Playground)
|
||||||
|
m.Get("/playground/repl-iframe", PlaygroundReplIframe)
|
||||||
m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap)
|
m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap)
|
||||||
m.Group("/.well-known", func() {
|
m.Group("/.well-known", func() {
|
||||||
m.Get("/openid-configuration", auth.OIDCWellKnown)
|
m.Get("/openid-configuration", auth.OIDCWellKnown)
|
||||||
|
|
|
||||||
11
templates/playground/repl-iframe.tmpl
Normal file
11
templates/playground/repl-iframe.tmpl
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
{{template "base/head" .}}
|
||||||
|
|
||||||
|
<iframe
|
||||||
|
src="https://jupyterlite.github.io/demo/repl/index.html?kernel=python"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
></iframe>
|
||||||
|
|
||||||
|
|
||||||
|
{{template "base/footer" .}}
|
||||||
Loading…
Add table
Reference in a new issue