From 740eef6b4c45998cfed61c94ac75409e1c78ea1c Mon Sep 17 00:00:00 2001 From: milovann Date: Mon, 15 Apr 2024 20:19:44 +0200 Subject: [PATCH] [SLOYD] Add pyscript --- Makefile | 4 ++++ routers/web/playground.go | 7 +++++++ routers/web/web.go | 1 + templates/playground/footer.tmpl | 1 + templates/playground/header.tmpl | 3 +++ templates/playground/pyscript.tmpl | 11 +++++++++++ 6 files changed, 27 insertions(+) create mode 100644 templates/playground/footer.tmpl create mode 100644 templates/playground/pyscript.tmpl diff --git a/Makefile b/Makefile index 4e4bb78207..2530971c01 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,10 @@ FORGEJO_VERSION_API ?= ${FORGEJO_VERSION} show-version-api: @echo ${FORGEJO_VERSION_API} +RELEASE_VERSION = 1.22 +MAKE_VERSION = 1.22 +FORGEJO_VERSION = 1.22 + LDFLAGS := $(LDFLAGS) -X "main.ReleaseVersion=$(RELEASE_VERSION)" -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(FORGEJO_VERSION)" -X "main.Tags=$(TAGS)" -X "main.ForgejoVersion=$(FORGEJO_VERSION_API)" LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64 diff --git a/routers/web/playground.go b/routers/web/playground.go index 83aa32e828..15d697e6e7 100644 --- a/routers/web/playground.go +++ b/routers/web/playground.go @@ -13,6 +13,7 @@ import ( const ( tplPlayground base.TplName = "playground/playground" tplPlaygroundReplIframe base.TplName = "playground/repl-iframe" + tplPlaygroundPyScript base.TplName = "playground/pyscript" ) func PlaygroundReplIframe(ctx *context.Context) { @@ -20,6 +21,12 @@ func PlaygroundReplIframe(ctx *context.Context) { ctx.HTML(http.StatusOK, tplPlaygroundReplIframe) } +func PlaygroundPyScript(ctx *context.Context) { + + ctx.Data["PageIsPlayground"] = true + ctx.HTML(http.StatusOK, tplPlaygroundPyScript) +} + func Playground(ctx *context.Context) { if ctx.IsSigned { ctx.Data["UserName"] = ctx.Doer.DisplayName() diff --git a/routers/web/web.go b/routers/web/web.go index 0773232b7f..354173cdd0 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -433,6 +433,7 @@ func registerRoutes(m *web.Route) { m.Get("/", Home) m.Get("/playground", Playground) m.Get("/playground/repl-iframe", PlaygroundReplIframe) + m.Get("/playground/pyscript", PlaygroundPyScript) m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap) m.Group("/.well-known", func() { m.Get("/openid-configuration", auth.OIDCWellKnown) diff --git a/templates/playground/footer.tmpl b/templates/playground/footer.tmpl new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/templates/playground/footer.tmpl @@ -0,0 +1 @@ + diff --git a/templates/playground/header.tmpl b/templates/playground/header.tmpl index 8a593c9266..6e93464cc5 100644 --- a/templates/playground/header.tmpl +++ b/templates/playground/header.tmpl @@ -7,6 +7,9 @@ {{svg "octicon-terminal"}} Repl + + {{svg "octicon-paper-airplane"}} PyScript + diff --git a/templates/playground/pyscript.tmpl b/templates/playground/pyscript.tmpl new file mode 100644 index 0000000000..5225d97dbe --- /dev/null +++ b/templates/playground/pyscript.tmpl @@ -0,0 +1,11 @@ + +{{template "base/head" .}} + +{{template "playground/header" .}} + + + +
+ + +{{template "base/footer" .}}