diff --git a/README.md b/README.md index 61d62e0..73626df 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ host = "0.0.0.0" port = 5000 # Github文件大小限制(字节),默认2GB fileSize = 2147483648 -# HTTP/2 多路复用 +# HTTP/2 多路复用,提升下载速度 enableH2C = false [rateLimit] -# 每个IP每小时允许的请求数(注意Docker镜像会有多个层,会消耗多个次数) +# 每个IP每周期允许的请求数(注意Docker镜像会有多个层,会消耗多个次数) requestLimit = 500 # 限流周期(小时) periodHours = 3.0 diff --git a/src/config.toml b/src/config.toml index f7d4c08..18e8c2d 100644 --- a/src/config.toml +++ b/src/config.toml @@ -8,7 +8,7 @@ fileSize = 2147483648 enableH2C = false [rateLimit] -# 每个IP每小时允许的请求数(注意Docker镜像会有多个层,会消耗多个次数) +# 每个IP每周期允许的请求数 requestLimit = 500 # 限流周期(小时) periodHours = 3.0 diff --git a/src/handlers/github.go b/src/handlers/github.go index e29f174..2fb6cbb 100644 --- a/src/handlers/github.go +++ b/src/handlers/github.go @@ -20,7 +20,7 @@ var ( regexp.MustCompile(`^(?:https?://)?github\.com/([^/]+)/([^/]+)/(?:blob|raw)/.*`), regexp.MustCompile(`^(?:https?://)?github\.com/([^/]+)/([^/]+)/(?:info|git-).*`), regexp.MustCompile(`^(?:https?://)?raw\.github(?:usercontent|)\.com/([^/]+)/([^/]+)/.+?/.+`), - regexp.MustCompile(`^(?:https?://)?gist\.github(?:usercontent|)\.com/([^/]+)/.+?/.+`), + regexp.MustCompile(`^(?:https?://)?gist\.(?:githubusercontent|github)\.com/(.+?)/(.+?)/.+\.[a-zA-Z0-9]+$`), regexp.MustCompile(`^(?:https?://)?api\.github\.com/repos/([^/]+)/([^/]+)/.*`), regexp.MustCompile(`^(?:https?://)?huggingface\.co(?:/spaces)?/([^/]+)/(.+)`), regexp.MustCompile(`^(?:https?://)?cdn-lfs\.hf\.co(?:/spaces)?/([^/]+)/([^/]+)(?:/(.*))?`),