From 791f668758f296542ce1dac829795becdaa62080 Mon Sep 17 00:00:00 2001 From: wjqserver <114663932+WJQSERVER@users.noreply.github.com> Date: Mon, 12 May 2025 17:06:06 +0800 Subject: [PATCH 1/3] remove unused matcher return(fix #101) --- proxy/match.go | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/proxy/match.go b/proxy/match.go index 9b55339..8c64623 100644 --- a/proxy/match.go +++ b/proxy/match.go @@ -104,42 +104,34 @@ func Matcher(rawPath string, cfg *config.Config) (string, string, string, *GHPro return "", "", "", NewErrorWithStatusLookup(404, errMsg) } -func EditorMatcher(rawPath string, cfg *config.Config) (bool, string, error) { - var ( - matcher string - ) +func EditorMatcher(rawPath string, cfg *config.Config) (bool, error) { // 匹配 "https://github.com"开头的链接 if strings.HasPrefix(rawPath, "https://github.com") { - remainingPath := strings.TrimPrefix(rawPath, "https://github.com") - if strings.HasPrefix(remainingPath, "/") { - remainingPath = strings.TrimPrefix(remainingPath, "/") - } - return true, "", nil + return true, nil } // 匹配 "https://raw.githubusercontent.com"开头的链接 if strings.HasPrefix(rawPath, "https://raw.githubusercontent.com") { - return true, matcher, nil + return true, nil } // 匹配 "https://raw.github.com"开头的链接 if strings.HasPrefix(rawPath, "https://raw.github.com") { - return true, matcher, nil + return true, nil } // 匹配 "https://gist.githubusercontent.com"开头的链接 if strings.HasPrefix(rawPath, "https://gist.githubusercontent.com") { - return true, matcher, nil + return true, nil } // 匹配 "https://gist.github.com"开头的链接 if strings.HasPrefix(rawPath, "https://gist.github.com") { - return true, matcher, nil + return true, nil } if cfg.Shell.RewriteAPI { // 匹配 "https://api.github.com/"开头的链接 if strings.HasPrefix(rawPath, "https://api.github.com") { - matcher = "api" - return true, matcher, nil + return true, nil } } - return false, "", nil + return false, nil } // 匹配文件扩展名是sh的rawPath @@ -153,7 +145,7 @@ type LinkProcessor func(string) string // 自定义 URL 修改函数 func modifyURL(url string, host string, cfg *config.Config) string { // 去除url内的https://或http:// - matched, _, err := EditorMatcher(url, cfg) + matched, err := EditorMatcher(url, cfg) if err != nil { logDump("Invalid URL: %s", url) return url From c2e2b661a448b0d4a588b088f2c5e9db35401cf8 Mon Sep 17 00:00:00 2001 From: wjqserver <114663932+WJQSERVER@users.noreply.github.com> Date: Mon, 12 May 2025 17:12:58 +0800 Subject: [PATCH 2/3] 25w35a --- CHANGELOG.md | 5 +++++ DEV-VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70daffb..fe5f172 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 更新日志 +25w35a - 2025-05-12 +--- +- PRE-RELEASE: 此版本是v3.2.4预发布版本,请勿在生产环境中使用; +- CHANGE: 移除未使用的变量与相关计算 + 3.2.3 - 2025-05-07 --- - CHANGE: 迁移logger库到新的仓库, 开启异步日志记录 diff --git a/DEV-VERSION b/DEV-VERSION index 4c76d8f..ef0053d 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w34b \ No newline at end of file +25w35a \ No newline at end of file From ef6e0a78cdc450edc7db883678ff0b06bd706392 Mon Sep 17 00:00:00 2001 From: wjqserver <114663932+WJQSERVER@users.noreply.github.com> Date: Tue, 13 May 2025 14:22:19 +0800 Subject: [PATCH 3/3] 3.2.4 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe5f172..2b9103c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 更新日志 +3.2.4 - 2025-05-13 +--- +- CHANGE: 移除未使用的变量与相关计算 + 25w35a - 2025-05-12 --- - PRE-RELEASE: 此版本是v3.2.4预发布版本,请勿在生产环境中使用; diff --git a/VERSION b/VERSION index 06eda28..9b7a431 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.3 \ No newline at end of file +3.2.4 \ No newline at end of file