This commit is contained in:
ryan
2026-05-13 10:53:14 +08:00
parent 856e3f46d2
commit e85df49962
31 changed files with 2504 additions and 645 deletions
+16
View File
@@ -41,6 +41,9 @@ func setWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) {
func serveExportedPage(c *gin.Context, buildFS fs.FS) bool {
requestPath := strings.Trim(c.Request.URL.Path, "/")
if isOAuthCallbackPath(requestPath) {
requestPath = "oauth/callback"
}
candidates := []string{"index.html"}
if requestPath != "" {
@@ -61,6 +64,19 @@ func serveExportedPage(c *gin.Context, buildFS fs.FS) bool {
return false
}
func isOAuthCallbackPath(requestPath string) bool {
if !strings.HasPrefix(requestPath, "oauth/") || strings.Count(requestPath, "/") != 1 {
return false
}
source := strings.TrimPrefix(requestPath, "oauth/")
switch source {
case "", "callback", "link":
return false
default:
return true
}
}
func normalizeStaticExportDataNavigation() gin.HandlerFunc {
return func(c *gin.Context) {
requestPath := c.Request.URL.Path