diff --git a/CHANGELOG.md b/CHANGELOG.md index 70daffb..2b9103c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # 更新日志 +3.2.4 - 2025-05-13 +--- +- CHANGE: 移除未使用的变量与相关计算 + +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 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 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