This commit is contained in:
wjqserver 2025-03-11 08:40:19 +08:00
parent a18660121a
commit 8def955151
5 changed files with 74 additions and 41 deletions

View file

@ -1,5 +1,11 @@
# 更新日志
25w16b
---
- PRE-RELEASE: 此版本是v2.4.0的预发布版本,请勿在生产环境中使用;
- CHANGE: 修改路由
- CHANGE: 改进前端
25w16a
---
- PRE-RELEASE: 此版本是v2.4.0的预发布版本,请勿在生产环境中使用;

View file

@ -1 +1 @@
25w16a
25w16b

View file

@ -144,6 +144,7 @@ func setupPages(cfg *config.Config, router *gin.Engine) {
router.GET("/favicon.ico", gin.WrapH(http.FileServer(http.FS(pages))))
router.GET("/script.js", gin.WrapH(http.FileServer(http.FS(pages))))
router.GET("/style.css", gin.WrapH(http.FileServer(http.FS(pages))))
//router.GET("/bootstrap.min.css", gin.WrapH(http.FileServer(http.FS(pages))))
case "external":
// 设置外部资源路径
@ -151,6 +152,7 @@ func setupPages(cfg *config.Config, router *gin.Engine) {
faviconPath := fmt.Sprintf("%s/favicon.ico", cfg.Pages.StaticDir)
javascriptsPath := fmt.Sprintf("%s/script.js", cfg.Pages.StaticDir)
stylesheetsPath := fmt.Sprintf("%s/style.css", cfg.Pages.StaticDir)
//bootstrapPath := fmt.Sprintf("%s/bootstrap.min.css", cfg.Pages.StaticDir)
// 设置外部资源路由
router.GET("/", func(c *gin.Context) {
@ -160,6 +162,7 @@ func setupPages(cfg *config.Config, router *gin.Engine) {
router.StaticFile("/favicon.ico", faviconPath)
router.StaticFile("/script.js", javascriptsPath)
router.StaticFile("/style.css", stylesheetsPath)
//router.StaticFile("/bootstrap.min.css", bootstrapPath)
default:
// 处理无效的Pages Mode
@ -230,17 +233,15 @@ func init() {
//router.POST("/https://github.com/:username/:repo/git-upload-pack", gitclone.HttpGitUploadPack(cfg))
} else {
// 3. GitHub Info/Git- - Use distinct path segments for type (or combine under a common prefix)
/*
router.GET("/github.com/:username/:repo/info/*filepath", func(c *gin.Context) { // Distinct path for info
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
})
router.GET("/github.com/:username/:repo/git-*filepath", func(c *gin.Context) { // Distinct path for git-* (or a more specific prefix)
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
})
*/
}
/*
// 1. GitHub Releases/Archive - Use distinct path segments for type
router.GET("/github.com/:username/:repo/releases/*filepath", func(c *gin.Context) { // Distinct path for releases
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
@ -273,7 +274,6 @@ func init() {
router.GET("/api.github.com/repos/:username/:repo/*filepath", func(c *gin.Context) {
proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c)
})
*/
router.NoRoute(func(c *gin.Context) {
logInfo(c.Request.URL.Path)

View file

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Github文件加速</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" onerror="this.onerror=null; this.href='https://static.wjqserver.com/bootstrap.min.css';">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="style.css" rel="stylesheet">
@ -96,7 +96,20 @@
<div id="versionBadge" class="version-badge"></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
var script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js";
script.async = true;
script.defer = true;
script.onerror = function() {
var backupScript = document.createElement('script');
backupScript.src = "https://static.wjqserver.com/bootstrap.bundle.min.js";
backupScript.async = true;
backupScript.defer = true;
document.head.appendChild(backupScript);
};
document.head.appendChild(script);
</script>
<script src="script.js"></script>
</body>

View file

@ -5,7 +5,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub加速服务</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
onerror="this.onerror=null; this.href='https://static.wjqserver.com/bootstrap.min.css';">
<link href="style.css" rel="stylesheet">
</head>
@ -161,7 +162,20 @@
<div class="toast-body"></div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
var script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js";
script.async = true;
script.defer = true;
script.onerror = function() {
var backupScript = document.createElement('script');
backupScript.src = "https://static.wjqserver.com/bootstrap.bundle.min.js";
backupScript.async = true;
backupScript.defer = true;
document.head.appendChild(backupScript);
};
document.head.appendChild(script);
</script>
<script src="script.js"></script>
</body>