simplify Noform Option
This commit is contained in:
@@ -48,11 +48,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("DISABLE_FORM") != "true" {
|
|
||||||
app.Get("/", handlers.Form)
|
app.Get("/", handlers.Form)
|
||||||
} else {
|
|
||||||
app.Get("/", handlers.NoForm)
|
|
||||||
}
|
|
||||||
|
|
||||||
app.Get("raw/*", handlers.Raw)
|
app.Get("raw/*", handlers.Raw)
|
||||||
app.Get("api/*", handlers.Api)
|
app.Get("api/*", handlers.Api)
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import "github.com/gofiber/fiber/v2"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
func NoForm(c *fiber.Ctx) error {
|
"github.com/gofiber/fiber/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Form(c *fiber.Ctx) error {
|
||||||
|
if os.Getenv("DISABLE_FORM") == "true" {
|
||||||
c.Set("Content-Type", "text/html")
|
c.Set("Content-Type", "text/html")
|
||||||
c.SendStatus(fiber.StatusNotFound)
|
c.SendStatus(fiber.StatusNotFound)
|
||||||
return c.SendString("Form Disabled")
|
return c.SendString("Form Disabled")
|
||||||
}
|
} else {
|
||||||
|
|
||||||
func Form(c *fiber.Ctx) error {
|
|
||||||
c.Set("Content-Type", "text/html")
|
c.Set("Content-Type", "text/html")
|
||||||
return c.SendString(html)
|
return c.SendString(html)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const html = `
|
const html = `
|
||||||
|
|||||||
Reference in New Issue
Block a user