Initial commit

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fish03
2026-09-23 14:43:16 +07:00
co-authored by Claude Opus 5.5
commit bef9f8b4ed
663 changed files with 81305 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
package web
import (
"net/http"
"strings"
"videoweb/app/service/configser"
"videoweb/app/service/seoser"
"github.com/gin-gonic/gin"
)
// RobotsTXT 动态 robots.txt(含 Sitemap 声明)。
func RobotsTXT(c *gin.Context) {
cfg := configser.FetchAppConfigVMOrEmpty(c)
foreverURL := seoser.ResolveSiteURL(c, cfg)
c.Header("Content-Type", "text/plain; charset=utf-8")
c.Header("Cache-Control", "public, max-age=3600")
c.String(http.StatusOK, seoser.BuildRobotsTXT(foreverURL))
}
// SEOVerifyFile 提供百度 HTML 验证文件和 IndexNow key.txt。
func SEOVerifyFile(c *gin.Context) {
codes := seoser.VerifyFromConfig()
name := strings.TrimPrefix(c.Request.URL.Path, "/")
switch {
case codes.BaiduHTML != "" && name == codes.BaiduHTML:
c.Header("Cache-Control", "public, max-age=86400")
c.String(http.StatusOK, codes.Baidu)
return
case codes.IndexNowKey != "" && name == codes.IndexNowKey+".txt":
c.Header("Cache-Control", "public, max-age=86400")
c.Data(http.StatusOK, "text/plain; charset=utf-8", []byte(codes.IndexNowKey))
return
}
c.Status(http.StatusNotFound)
}