Migrate code and utilize api/modifiers endpoint

This commit is contained in:
joncrangle
2023-12-08 00:42:10 -05:00
parent dc82db803a
commit 518f4d65d2
8 changed files with 928 additions and 87 deletions

View File

@@ -9,15 +9,25 @@ import (
//go:embed script.js
var scriptData embed.FS
//go:embed playground-script.js
var playgroundScriptData embed.FS
func Script(c *fiber.Ctx) error {
scriptData, err := scriptData.ReadFile("script.js")
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
if c.Path() == "/script.js" {
scriptData, err := scriptData.ReadFile("script.js")
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
c.Set("Content-Type", "text/javascript")
return c.Send(scriptData)
}
c.Set("Content-Type", "text/javascript")
return c.Send(scriptData)
if c.Path() == "/playground-script.js" {
playgroundScriptData, err := playgroundScriptData.ReadFile("playground-script.js")
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
c.Set("Content-Type", "text/javascript")
return c.Send(playgroundScriptData)
}
return nil
}