合并自建歌曲源支线(selfhost-source)+ 版本号按约定修正为 1.6.0

版本号:
- 1.5.11 越界(规则 3 规定 patch ≤ 10)→ 修正为 1.6.0(进位到 minor、patch 归 0)
- versionCode 43 不变:43 从未对外发布,本次修正只是把命名拉回约定

合并支线(原在工作区根目录、App 仓库之外,DESIGN.md 自称"支线"):
- selfhost-source/server/   自建歌曲源服务器(纯 Python 标准库、零 pip 依赖)
- selfhost-source/deploy/、DESIGN.md、LIBRARY.md、build_inventory.py
- selfhost-source/inventory/ 小清单(playlists.csv、song-stats.md 等)
- ⚠️ inventory 生成物(songs-*.csv / singers-top.csv,共 84MB)不入库,
  已写入 .gitignore;需要时用 build_inventory.py 依据 muse.db 重新生成

同时入库的 App 侧支线改动(此前为工作树未提交状态):
- Whoami.kt(whoami 设备心跳)、DeviceIdentity.kt(设备身份伪装)
- PushDownload.kt / PushDownloadClient.kt(点歌推送)
- AdVideoFilter 带 query/fragment 的地址闸门;KTV_BRIDGE_API 11 → 13
- 修 ktv_api.js 的 global.KtvBridgeApiVersion(12 → 13,与注释及 Kotlin 两处校验一致)
- 对应单测:WhoamiTest / DeviceIdentityTest / PushDownloadTest / AdVideoFilterTest(共 39 例)

文档:
- DESIGN.md 的"在 App 仓库之外"约定改为"已并入仓库统一版本化"
- AGENTS.md 版本号行更新为 1.6.0/43,并新增支线并入说明

验证:assembleRelease + testReleaseUnitTest 全过(39 例)
This commit is contained in:
zijunchiang
2026-10-14 02:06:28 +08:00
parent e060ae5ebe
commit 87aa979abd
68 changed files with 21305 additions and 105 deletions
@@ -0,0 +1,34 @@
[Unit]
Description=麦动KTV 自建歌曲源服务器(服务端口 + 管理端口)
Documentation=file:/opt/ktv-source/README.md
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ktv
Group=ktv
WorkingDirectory=/opt/ktv-source
Environment=PYTHONUNBUFFERED=1
Environment=KTV_CONFIG=/etc/ktv-source/server-config.json
ExecStart=/usr/bin/python3 /opt/ktv-source/run.py --config /etc/ktv-source/server-config.json
# 管理端口与服务端口由同一进程监听;需要彻底隔离时拆成两个单元(用 --no-download 只跑服务)
Restart=always
RestartSec=3
TimeoutStopSec=20
KillSignal=SIGTERM
# ⚠️ 数据目录布局两种(本部署用的是第二种):
# A) 数据在 /var/lib/ktv-source → User=ktv + ProtectHome=yes
# B) 数据在 /home/<user>/… (尤其 FUSE/云盘/网络盘)→ 必须 User=<该目录属主> + ProtectHome=no,
# 并把 db_journal_mode 设为 DELETE(WAL 需要 mmap -shm,这类文件系统上会 SIGBUS 打死进程)
# 安全加固(Debian 13 / systemd 256+)
NoNewPrivileges=true
PrivateTmp=true
# true 只保护 /usr 与 /boot;full 会把 /etc 变只读,导致管理界面无法保存 server-config.json
ProtectSystem=true
ProtectHome=true
ReadWritePaths=/var/lib/ktv-source /etc/ktv-source
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target