🐛 fix(review): 弹窗内切换排序加载失败,评论页固定顶栏

- 评论页注入绝对 API_BASE:弹窗 WebView(loadDataWithBaseURL) 中相对路径
  fetch 解析不可靠,切换排序/懒加载/回复全部改走绝对地址
- externalBaseURL 识别 X-Forwarded-Proto:正文气泡 ident 与评论页地址
  不再硬编码 http://,避免反代 301
- 布局改造:顶栏固定(含拖拽把手视觉)+评论区独立滚动容器,滚动/回顶
  逻辑迁移至容器;switchSort 显式传参替代隐式 event
This commit is contained in:
chenxin committed 2026-10-10 12:49:00 +08:00
1 parent 99826c6d25
commit af9004adaf
3 files changed
+70 -37

No files matched your search

+5 -11
View File
@@ -124,23 +124,17 @@ func addReviewToContent(jsonResult, itemID string, r *http.Request) string {
}
}
// 获取基础 URL
// 获取基础 URL(反代场景识别 X-Forwarded-Proto,避免生成 http:// 被 301)
cfg := config.GetConfig()
baseURL := ""
if cfg != nil {
if r.Host != "" {
baseURL = externalBaseURL(r)
} else if cfg != nil {
host := cfg.Server.Host
if host == "0.0.0.0" {
host = "localhost"
}
port := cfg.Server.Port
scheme := "http"
// 检查是否来自外部请求
if r.Host != "" {
baseURL = scheme + "://" + r.Host
} else {
baseURL = scheme + "://" + host + ":" + port
}
baseURL = "http://" + host + ":" + cfg.Server.Port
}
// 生成带段评标记的内容