From 319fd4c019cd0ff46180fd30ff6899727573845a Mon Sep 17 00:00:00 2001 From: nor Date: Mon, 18 Mar 2024 16:29:15 +0800 Subject: [PATCH] update index page --- internal/cmd/server.go | 6 ------ internal/view/index.html | 25 ++++++++++++++++++++++++- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/internal/cmd/server.go b/internal/cmd/server.go index b14b3daf2d..f8ccc47cfe 100644 --- a/internal/cmd/server.go +++ b/internal/cmd/server.go @@ -23,8 +23,6 @@ func newServerCommand() *cobra.Command { cmd.Flags().Bool("access-log", false, "Print out a non-standard access log") cmd.Flags().Bool("serve-web-ui", true, "Serve static files from the webroot path") cmd.Flags().String("secret-key", "", "Secret key used for encrypting session data") - cmd.Flags().StringSlice("trusted-proxies", []string{}, "list of trusted proxy IPs, empty means no proxy allowed") - cmd.Flags().String("reverse-proxy-auth-user", "", "http header name of proxy auth") return cmd } @@ -40,8 +38,6 @@ func newServerCommandHandler() func(cmd *cobra.Command, args []string) { accessLog, _ := cmd.Flags().GetBool("access-log") serveWebUI, _ := cmd.Flags().GetBool("serve-web-ui") secretKey, _ := cmd.Flags().GetBytesHex("secret-key") - trustedProxies, _ := cmd.Flags().GetStringSlice("trusted-proxies") - reverseProxyAuthUser, _ := cmd.Flags().GetString("reverse-proxy-auth-user") cfg, dependencies := initShiori(ctx, cmd) @@ -65,8 +61,6 @@ func newServerCommandHandler() func(cmd *cobra.Command, args []string) { cfg.Http.AccessLog = accessLog cfg.Http.ServeWebUI = serveWebUI cfg.Http.SecretKey = secretKey - cfg.Http.TrustedProxies = trustedProxies - cfg.Http.ReverseProxyAuthUser = reverseProxyAuthUser dependencies.Log.Infof("Starting Shiori v%s", model.BuildVersion) diff --git a/internal/view/index.html b/internal/view/index.html index 0f120d794c..3d0a5d8276 100644 --- a/internal/view/index.html +++ b/internal/view/index.html @@ -141,9 +141,32 @@ username: username, owner: owner, }; - } + }, + loadToken() { + function parseJWT(token) { + try { + return JSON.parse(atob(token.split('.')[1])); + } catch (e) { + return null; + } + } + function getCookie(cname){ + var name = cname + "="; + var ca = document.cookie.split(';'); + for(var i=0; i