From bd2d7bce62eb39009e1dfa819e32a5be725c1a4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 25 May 2024 09:44:16 +0200 Subject: [PATCH 1/2] Bump github.com/valyala/fasthttp from 1.53.0 to 1.54.0 (#2297) Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.53.0 to 1.54.0. - [Release notes](https://github.com/valyala/fasthttp/releases) - [Commits](https://github.com/valyala/fasthttp/compare/v1.53.0...1.54.0) --- updated-dependencies: - dependency-name: github.com/valyala/fasthttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b90e93c7..e8bd98cc 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 github.com/robfig/cron/v3 v3.0.1 github.com/shirou/gopsutil/v3 v3.24.4 - github.com/valyala/fasthttp v1.53.0 + github.com/valyala/fasthttp v1.54.0 github.com/xtls/xray-core v1.8.13 go.uber.org/atomic v1.11.0 golang.org/x/text v0.15.0 diff --git a/go.sum b/go.sum index 693cd232..3b1225ee 100644 --- a/go.sum +++ b/go.sum @@ -268,8 +268,8 @@ github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.53.0 h1:lW/+SUkOxCx2vlIu0iaImv4JLrVRnbbkpCoaawvA4zc= -github.com/valyala/fasthttp v1.53.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= +github.com/valyala/fasthttp v1.54.0 h1:cCL+ZZR3z3HPLMVfEYVUMtJqVaui0+gu7Lx63unHwS0= +github.com/valyala/fasthttp v1.54.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= From c422214ae8e1da9d9ed210f85f63356f8943a2cf Mon Sep 17 00:00:00 2001 From: Maisam Date: Sat, 25 May 2024 11:45:06 +0330 Subject: [PATCH 2/2] Add webBasePath update feature to CLI (#2300) --- main.go | 13 +++++++++++-- web/service/setting.go | 10 ++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 2a8f8c7e..f4ce0846 100644 --- a/main.go +++ b/main.go @@ -216,7 +216,7 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri } } -func updateSetting(port int, username string, password string) { +func updateSetting(port int, username string, password string, webBasePath string) { err := database.InitDB(config.GetDBPath()) if err != nil { fmt.Println(err) @@ -243,6 +243,15 @@ func updateSetting(port int, username string, password string) { fmt.Println("set username and password success") } } + + if webBasePath != "" { + err := settingService.SetBasePath(webBasePath) + if err != nil { + fmt.Println("set base URI path failed:", err) + } else { + fmt.Println("set base URI path success") + } + } } func migrateDb() { @@ -357,7 +366,7 @@ func main() { if reset { resetSetting() } else { - updateSetting(port, username, password) + updateSetting(port, username, password, webBasePath) } if show { showSetting(show) diff --git a/web/service/setting.go b/web/service/setting.go index 9e740059..69b1fece 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -352,6 +352,16 @@ func (s *SettingService) GetSecret() ([]byte, error) { return []byte(secret), err } +func (s *SettingService) SetBasePath(basePath string) error { + if !strings.HasPrefix(basePath, "/") { + basePath = "/" + basePath + } + if !strings.HasSuffix(basePath, "/") { + basePath += "/" + } + return s.setString("webBasePath", basePath) +} + func (s *SettingService) GetBasePath() (string, error) { basePath, err := s.getString("webBasePath") if err != nil {