package web import ( "fmt" "html" "io" "net/http" ) // pausePage 渲染一个「停一下」的极简提示页:给一句人话、一个回首页的按钮, // 需要时再自动跳回首页。用于「内容对访客不开放」这类情况—— // 直接甩 404 会让人以为站点坏了,说清楚再引导走开才不突兀。 // // autoSeconds > 0 时页面会自己跳回首页(同时把按钮留给人手动点)。 func (s *Server) pausePage(w http.ResponseWriter, status int, icon, title, msg string, autoSeconds int) { var auto string if autoSeconds > 0 { auto = fmt.Sprintf(``, autoSeconds) } if icon == "" { icon = "🔒" } w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Cache-Control", "no-store") w.WriteHeader(status) fmt.Fprintf(w, `
`+ ``+ `%s
`+ `返回首页`, html.EscapeString(title), auto, assetVersion, icon, html.EscapeString(title), html.EscapeString(msg)) if autoSeconds > 0 { fmt.Fprintf(w, `