🗑️ Remove the frontend redirector
This commit is contained in:
		@@ -4,8 +4,8 @@ import (
 | 
			
		||||
	"github.com/gofiber/fiber/v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func MapAPIs(app *fiber.App) {
 | 
			
		||||
	api := app.Group("/api").Name("API")
 | 
			
		||||
func MapAPIs(app *fiber.App, baseURL string) {
 | 
			
		||||
	api := app.Group(baseURL).Name("API")
 | 
			
		||||
	{
 | 
			
		||||
		api.Get("/users/me", getUserinfo)
 | 
			
		||||
		api.Get("/users/:accountId", getOthersInfo)
 | 
			
		||||
 
 | 
			
		||||
@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user