AndroidStation(原中控改造为纯设备端) - 只做三件事:UDP 48899 被桌面端发现、TCP 8087 推送 USB 扫码结果、离线语音播报 - 扫码不再经过 UI:去掉逐键重绘,50ms 自动提交,同一码重复扫码也一律上报 - 离线语音种子(数字/字母/“开始打包”/欢迎语)随包安装,MediaPlayer 播放,启动把音量拉满 - 启动播报「欢迎使用溯源系统,初始化已经完成,扫码即可开始打包」 - 移除 Device Owner / 设备管理员 / lock task / 网络与 IP 设置等非普通应用能力(仅保留开机自启) - 正式签名 keystore + release 签名配置,versionName/versionCode 可由打包脚本覆盖 发布脚手架 - backend/android_client:Android 正式包构建(build.ps1 + package.config.json) - backend/scripts/deploy/publish-android.cjs + npm run android:build / android:publish - 桌面端安装包改为 download/desktop,Android 为 download/android_client; version.json 仍走 /download/version.json(老客户端写死),新增 /download/android_client/version.json - 谷歌插件随桌面端 MSI 安装到 <安装目录>\extension,工具菜单新增「复制谷歌插件地址」 - git-safety-check 增加仓库级禁区(keystore.properties / *.jks / local.properties) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
'use strict';
|
||
|
||
const path = require('node:path');
|
||
const { REPO_ROOT, ROOT, runCommand } = require('./deploy-lib.cjs');
|
||
|
||
const BLOCKED_PATH_PATTERNS = [
|
||
/^config\/config\.local\.js$/,
|
||
/^config\/config\.prod\.js$/,
|
||
/^config\/deploy\.config\.local\.cjs$/,
|
||
/^temp\/(?!docs\/).+/,
|
||
/^logs\//,
|
||
/^run\//,
|
||
/^versioning\/(?!\.gitkeep$).+/,
|
||
/^app\/public\/download\/(?!\.gitkeep$).+/,
|
||
/^app\/public\/version\/(?!\.gitkeep$).+/,
|
||
/\.pem$/i,
|
||
/\.key$/i,
|
||
/^\.env(?:\..+)?$/,
|
||
];
|
||
|
||
/** 仓库根视角的禁区:Android 正式签名与本地机器配置,绝不入库 */
|
||
const BLOCKED_REPO_PATH_PATTERNS = [
|
||
/(^|\/)keystore\.properties$/,
|
||
/\.jks$/i,
|
||
/(^|\/)local\.properties$/,
|
||
/(^|\/)\.dev-adb\.local\.json$/,
|
||
];
|
||
|
||
function normalizePath(filePath) {
|
||
return filePath.replace(/\\/g, '/');
|
||
}
|
||
|
||
function listStagedFiles(cwd, relative) {
|
||
const args = [ 'diff', '--cached', '--name-only', '--diff-filter=ACMR' ];
|
||
if (relative) args.push('--relative');
|
||
const output = runCommand('git', args, { cwd });
|
||
if (!output) {
|
||
return [];
|
||
}
|
||
return output.split(/\r?\n/).map(item => normalizePath(item.trim())).filter(Boolean);
|
||
}
|
||
|
||
function main() {
|
||
const blocked = [
|
||
...listStagedFiles(ROOT, true).filter(filePath => BLOCKED_PATH_PATTERNS.some(pattern => pattern.test(filePath))),
|
||
...listStagedFiles(REPO_ROOT, false).filter(filePath => BLOCKED_REPO_PATH_PATTERNS.some(pattern => pattern.test(filePath))),
|
||
];
|
||
|
||
if (blocked.length === 0) {
|
||
console.log('git safety check passed');
|
||
return;
|
||
}
|
||
|
||
console.error('以下文件禁止提交到 git,请先取消暂存:');
|
||
for (const filePath of new Set(blocked)) {
|
||
console.error(`- ${filePath}`);
|
||
}
|
||
console.error('建议使用 git restore --staged <file> 取消暂存,再继续提交。');
|
||
process.exit(1);
|
||
}
|
||
|
||
main();
|