🗑️ Remove the frontend redirector
This commit is contained in:
		@@ -1,6 +0,0 @@
 | 
			
		||||
package pkg
 | 
			
		||||
 | 
			
		||||
import "embed"
 | 
			
		||||
 | 
			
		||||
//go:embed views/*
 | 
			
		||||
var FS embed.FS
 | 
			
		||||
@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 71 KiB  | 
@@ -1,28 +0,0 @@
 | 
			
		||||
<!doctype html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="UTF-8">
 | 
			
		||||
    <meta name="viewport"
 | 
			
		||||
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
 | 
			
		||||
 | 
			
		||||
    <link rel="icon" type="image/png" href="favicon.png">
 | 
			
		||||
 | 
			
		||||
    <link rel="preconnect" href="https://fonts.googleapis.com">
 | 
			
		||||
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 | 
			
		||||
    <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">
 | 
			
		||||
 | 
			
		||||
    <title>Hydrogen.Interactive</title>
 | 
			
		||||
 | 
			
		||||
    <style>
 | 
			
		||||
        html, body {
 | 
			
		||||
            padding: 0;
 | 
			
		||||
            margin: 0;
 | 
			
		||||
            font-family: Roboto Mono, monospace;
 | 
			
		||||
        }
 | 
			
		||||
    </style>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
{{embed}}
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div>
 | 
			
		||||
        <img src="/favicon.png" width="128" height="128" alt="Icon"/>
 | 
			
		||||
 | 
			
		||||
        <p class="caption text-blinking">Launching Solian... 🚀</p>
 | 
			
		||||
        <p class="description">
 | 
			
		||||
            Hold on a second... <br/>
 | 
			
		||||
            We are redirecting you to our application...
 | 
			
		||||
        </p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    function redirect() {
 | 
			
		||||
        window.location.href = {{ .frontend }}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    setTimeout(() => redirect(), 1850)
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style>
 | 
			
		||||
    .container {
 | 
			
		||||
        width: 100vw;
 | 
			
		||||
        height: 100vh;
 | 
			
		||||
        display: flex;
 | 
			
		||||
        justify-content: center;
 | 
			
		||||
        align-items: center;
 | 
			
		||||
        text-align: center;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .caption {
 | 
			
		||||
        margin-top: 4px;
 | 
			
		||||
        font-weight: 600;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .text-blinking {
 | 
			
		||||
        animation: text-blinking ease-in-out infinite 1.5s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .description {
 | 
			
		||||
        margin-top: 4px;
 | 
			
		||||
        font-size: 0.85rem;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    p {
 | 
			
		||||
        margin: 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @keyframes text-blinking {
 | 
			
		||||
        0% {
 | 
			
		||||
            opacity: 100%;
 | 
			
		||||
        }
 | 
			
		||||
        50% {
 | 
			
		||||
            opacity: 10%;
 | 
			
		||||
        }
 | 
			
		||||
        100% {
 | 
			
		||||
            opacity: 100%;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
</style>
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
id = "interactive01"
 | 
			
		||||
 | 
			
		||||
frontend = "https://lian.solsynth.dev"
 | 
			
		||||
 | 
			
		||||
bind = "0.0.0.0:8445"
 | 
			
		||||
grpc_bind = "0.0.0.0:7445"
 | 
			
		||||
domain = "im.solsynth.dev"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user