渠道: 新增主页字段 + 表格展示 favicon

- Channel 新增 homepage 字段(渠道主页)
- 后端 /admin/channels/:id/favicon 代理抓取 {homepage}/favicon.ico, 内存缓存 1h;
  服务端抓取可解析 localhost/内网主页, 避免浏览器跨域
- 前端渠道表单加"渠道主页"输入; 表格新增主页列(favicon + 域名), 加载失败回退灰色地球图标
- mock 上游提供 /favicon.ico 演示

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sakurasan
2026-08-15 17:01:45 +08:00
co-authored by Claude
parent d9dcbc4fb3
commit 4f92d7e0a4
7 changed files with 122 additions and 15 deletions
+13 -1
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"strings"
"sync"
"time"
"github.com/gin-gonic/gin"
@@ -17,9 +18,20 @@ import (
// Handler 聚合所有管理 API。
type Handler struct {
a *app.App
favMu sync.Mutex
favCache map[uint64]favEntry // 渠道 favicon 内存缓存
}
func NewHandler(a *app.App) *Handler { return &Handler{a: a} }
type favEntry struct {
data []byte
ct string
at time.Time
}
func NewHandler(a *app.App) *Handler {
return &Handler{a: a, favCache: map[uint64]favEntry{}}
}
// ---------------------------------------------------------------------------
// 认证