[port] config add rewriteAPI

This commit is contained in:
wjqserver 2025-03-27 11:19:42 +08:00
parent 1498156f56
commit b684227191
3 changed files with 10 additions and 5 deletions

View file

@ -151,10 +151,12 @@ func EditorMatcher(rawPath string, cfg *config.Config) (bool, string, error) {
if strings.HasPrefix(rawPath, "https://gist.github.com") {
return true, matcher, nil
}
// 匹配 "https://api.github.com/"开头的链接
if strings.HasPrefix(rawPath, "https://api.github.com") {
matcher = "api"
return true, matcher, nil
if cfg.Shell.RewriteAPI {
// 匹配 "https://api.github.com/"开头的链接
if strings.HasPrefix(rawPath, "https://api.github.com") {
matcher = "api"
return true, matcher, nil
}
}
return false, "", ErrInvalidURL
}