mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
24w19b
This commit is contained in:
parent
a8af0fb687
commit
3489e6d744
4 changed files with 16 additions and 3 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
24w19b
|
||||||
|
---
|
||||||
|
- PRE-RELEASE: 此版本是v1.6.1的预发布版本,请勿在生产环境中使用
|
||||||
|
- FIX: 修复`sizeLimit`单位更改导致API返回值错误的问题
|
||||||
|
- FIX: 尝试修正Gist匹配
|
||||||
|
|
||||||
24w19a
|
24w19a
|
||||||
---
|
---
|
||||||
- PRE-RELEASE: 此版本是v1.6.1的预发布版本,请勿在生产环境中使用
|
- PRE-RELEASE: 此版本是v1.6.1的预发布版本,请勿在生产环境中使用
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
24w19a
|
24w19b
|
||||||
|
|
@ -45,7 +45,7 @@ func InitHandleRouter(cfg *config.Config, router *gin.Engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SizeLimitHandler(cfg *config.Config, c *gin.Context) {
|
func SizeLimitHandler(cfg *config.Config, c *gin.Context) {
|
||||||
sizeLimit := cfg.Server.SizeLimit / 1024 / 1024
|
sizeLimit := cfg.Server.SizeLimit
|
||||||
c.Writer.Header().Set("Content-Type", "application/json")
|
c.Writer.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(c.Writer).Encode(map[string]interface{}{
|
json.NewEncoder(c.Writer).Encode(map[string]interface{}{
|
||||||
"MaxResponseBodySize": sizeLimit,
|
"MaxResponseBodySize": sizeLimit,
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,15 @@ func NoRouteHandler(cfg *config.Config) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MatchUserRepo(rawPath string, cfg *config.Config, c *gin.Context, matches []string) (string, string) {
|
|
||||||
// 提取用户名和仓库名,格式为 handle/<username>/<repo>/*
|
// 提取用户名和仓库名,格式为 handle/<username>/<repo>/*
|
||||||
|
func MatchUserRepo(rawPath string, cfg *config.Config, c *gin.Context, matches []string) (string, string) {
|
||||||
|
var gistregex = regexp.MustCompile(`^(?:https?://)?gist\.github\.com/([^/]+)/([^/]+)/.*`)
|
||||||
|
var gistmatches []string
|
||||||
|
if gistregex.MatchString(rawPath) {
|
||||||
|
gistmatches = gistregex.FindStringSubmatch(rawPath)
|
||||||
|
logInfo("Gist Matched > Username: %s, URL: %s", gistmatches[2], rawPath)
|
||||||
|
return gistmatches[2], ""
|
||||||
|
}
|
||||||
pathmatches := regexp.MustCompile(`^([^/]+)/([^/]+)/([^/]+)/.*`)
|
pathmatches := regexp.MustCompile(`^([^/]+)/([^/]+)/([^/]+)/.*`)
|
||||||
pathParts := pathmatches.FindStringSubmatch(matches[2])
|
pathParts := pathmatches.FindStringSubmatch(matches[2])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue