[SLOYD] Add Repl iframe

This commit is contained in:
Milovann Yanatchkov 2024-04-09 14:37:25 +02:00
parent 48c9630647
commit 38d4eca60a
4 changed files with 19 additions and 2 deletions

View file

@ -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()

View file

@ -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)

View 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" .}}