feat(v-fixed37): tvbox notice+warning 双公告字段(影视仓/TVBox系兼容); 角标版本环境变量注入

This commit is contained in:
jinghui committed 2026-10-30 11:03:14 +08:00
1 parent 343f368bf4
commit 79e05c951b
4 files changed
+19 -10

No files matched your search

+5
View File
@@ -2,6 +2,11 @@
格式参考本机发版惯例:按日期分条,`🐛修复` / `✨新功能`。
## 2026-10-30 → v-fixed37
- 🐛 **TVBOX 公告兼容性**:`/api/tvbox` 在 `notice` 外新增 `warning` 字段(同文本),覆盖 TVBox 原版系壳的启动弹窗字段;影视仓系读 `notice`。配置缓存的客户端需重新保存接口地址或清缓存才会弹新公告
- ✨ 角标版本号改由 `PATCH_VERSION`/`SITE_VERSION` 环境变量注入(不再写死),本次为 vfixed37
## 2026-10-30 → v-fixed36
- ✨ **首页右上角统一信息区**:`vfixed36` 版本角标 + 🔔 通知铃铛(点击弹公告)+ ⭐ 开源地址,三件套仅在首页显示(其它页面自动隐藏,减少干扰)
+3 -3
View File
@@ -53,7 +53,7 @@ git clone https://gitea.88531.cn/jinghui/katelyatv.git && cd katelyatv
docker pull gitea.88531.cn/jinghui/katelyatv:latest
# 国内慢可换腾讯云镜像(东京):
# docker pull jpccr.ccs.tencentyun.com/jinghui/katelyatv:latest
docker tag gitea.88531.cn/jinghui/katelyatv:latest katelyatv:fixed36 # 对齐 compose 的 image 名
docker tag gitea.88531.cn/jinghui/katelyatv:latest katelyatv:fixed37 # 对齐 compose 的 image 名
cp .env.example .env
vi .env # 至少填:PASSWORD(站点密码)、NEXTAUTH_SECRET(随机串)
@@ -136,14 +136,14 @@ docker/katelyatv/
| `patch_access_log.js` | 访问日志注入([ACCESS] IP/UA/路径,供 `usage-stats.sh` 统计使用人数) |
| `patch_license.js` | 授权系统:CardAuth 装机/心跳/公告/版本推送、`/api/license-config` 路由、首页右上角三件套(版本角标+🔔通知铃铛+⭐开源地址,仅首页显示;直播页移除开源按钮)、每 IP 限流 429;运行时组件见 `license-hub.js` |
补丁固化在本地镜像(compose 引用,当前 `katelyatv:fixed36`)。上游大版本升级后重放补丁:
补丁固化在本地镜像(compose 引用,当前 `katelyatv:fixed37`)。上游大版本升级后重放补丁:
```bash
bash patches/apply.sh # 重放补丁
python3 patches/inject_live.py # 重放直播注入(幂等)
docker cp license-hub.js katelyatv:/app/license-hub.js
node patches/patch_license.js # 重放授权/角标/限流(幂等)
docker commit katelyatv katelyatv:fixed36 # 固化新镜像
docker commit katelyatv katelyatv:fixed37 # 固化新镜像
docker compose -f docker-compose.redis.yml up -d
```
+2 -2
View File
@@ -3,7 +3,7 @@ version: '3.8'
services:
# KatelyaTV 应用服务
katelyatv:
image: katelyatv:fixed36
image: katelyatv:fixed37
container_name: katelyatv
ports:
- "3030:3000"
@@ -36,7 +36,7 @@ services:
HUB_PROJECT_ID: ${HUB_PROJECT_ID:-11}
HUB_DISABLED: ${HUB_DISABLED:-0}
# 当前版本号(右上角角标 + 授权中心自检上报)
SITE_VERSION: ${SITE_VERSION:-fixed36}
SITE_VERSION: ${SITE_VERSION:-fixed37}
depends_on:
- katelyatv-redis
volumes:
+9 -5
View File
@@ -9,7 +9,7 @@
*/
const FS = require("fs");
const CP = require("child_process");
const VERSION = process.env.PATCH_VERSION || "fixed36";
const VERSION = process.env.PATCH_VERSION || process.env.SITE_VERSION || "fixed36";
const log = (...a) => console.log("[PATCH-LICENSE]", ...a);
let failures = [];
function checkFile(p) {
@@ -185,15 +185,19 @@ function writeChecked(p, s) {
log("tvbox: live page ghLink removed");
})();
// ---------- 4) tvbox 配置:notice/version/update_url ----------
// ---------- 4) tvbox 配置:notice/warning/version/update_url(V2:双公告字段) ----------
(function () {
const p = "/app/.next/server/app/api/tvbox/route.js";
let s = FS.readFileSync(p, "utf8");
if (s.includes("_hubNST")) { log("tvbox: skip (already)"); return; } // 实际插入标记是 _hubNST/_NST_V1
// V1→V2 升级:把旧插入串整体替换为含 warning 的 V2 串
const oldIns = 'let _hubNST=null;try{_hubNST=eval("require")("/app/license-hub.js")}catch(e){}let l={notice:_hubNST&&_hubNST.getNotice?_hubNST.getNotice():"",version:_hubNST&&_hubNST.getVersion?_hubNST.getVersion():"",update_url:_hubNST&&_hubNST.getUpdateUrl?_hubNST.getUpdateUrl():"",_NST_V1:1,spider:"",wallpaper:';
const newIns = 'let _hubNST=null;try{_hubNST=eval("require")("/app/license-hub.js")}catch(e){}let _hubNTN=_hubNST&&_hubNST.getNotice?_hubNST.getNotice():"";let l={notice:_hubNTN,warning:_hubNTN,version:_hubNST&&_hubNST.getVersion?_hubNST.getVersion():"",update_url:_hubNST&&_hubNST.getUpdateUrl?_hubNST.getUpdateUrl():"",_NST_V2:1,spider:"",wallpaper:';
if (s.includes("_NST_V2")) { log("tvbox: skip (v2 already)"); return; }
if (s.includes(oldIns)) { s = s.replace(oldIns, newIns); writeChecked(p, s); log("tvbox: notice+warning v2 upgraded"); return; }
const a = 'let l={spider:"",wallpaper:';
if (!s.includes(a)) { failures.push("tvbox anchor missing"); return; }
const ins = 'let _hubNST=null;try{_hubNST=eval("require")("/app/license-hub.js")}catch(e){}let l={notice:_hubNST&&_hubNST.getNotice?_hubNST.getNotice():"",version:_hubNST&&_hubNST.getVersion?_hubNST.getVersion():"",update_url:_hubNST&&_hubNST.getUpdateUrl?_hubNST.getUpdateUrl():"",_NST_V1:1,spider:"",wallpaper:';
writeChecked(p, s.replace(a, ins));
writeChecked(p, s.replace(a, newIns));
log("tvbox: notice+warning v2 injected");
})();
if (failures.length) { console.error("[PATCH-LICENSE] FAILURES:", JSON.stringify(failures)); process.exit(1); }