🗑️ Remove the frontend redirector

This commit is contained in:
2024-07-16 16:53:40 +08:00
parent 7f79c1a5ad
commit 248f97742b
7 changed files with 5 additions and 120 deletions

View File

@ -1,28 +1,23 @@
package server
import (
pkg "git.solsynth.dev/hydrogen/interactive/pkg/internal"
"strings"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/server/api"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/server/exts"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/favicon"
"github.com/gofiber/fiber/v2/middleware/idempotency"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/template/html/v2"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"net/http"
"strings"
)
var A *fiber.App
func NewServer() {
templates := html.NewFileSystem(http.FS(pkg.FS), ".gohtml")
A = fiber.New(fiber.Config{
DisableStartupMessage: true,
EnableIPValidation: true,
@ -33,8 +28,6 @@ func NewServer() {
JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal,
BodyLimit: 50 * 1024 * 1024,
EnablePrintRoutes: viper.GetBool("debug.print_routes"),
Views: templates,
ViewsLayout: "views/index",
})
A.Use(idempotency.New())
@ -62,19 +55,7 @@ func NewServer() {
A.Use(gap.H.AuthMiddleware)
A.Use(exts.LinkAccountMiddleware)
A.Use(favicon.New(favicon.Config{
FileSystem: http.FS(pkg.FS),
File: "views/favicon.png",
URL: "/favicon.png",
}))
api.MapAPIs(A)
A.Get("/", func(c *fiber.Ctx) error {
return c.Render("views/open", fiber.Map{
"frontend": viper.GetString("frontend"),
})
})
api.MapAPIs(A, "/")
}
func Listen() {