From a0df3b1a54fa79f1eda84d30599b906f29be4542 Mon Sep 17 00:00:00 2001 From: user123456 Date: Mon, 28 Jul 2025 04:46:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgist=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- src/config.toml | 2 +- src/handlers/github.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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)?/([^/]+)/([^/]+)(?:/(.*))?`),