AndroidStation - 有的扫码枪(Newtologic DW-8200,T95MAX/Android 12)用 KEYCODE_DPAD_CENTER 当结束键, 之前只认 ENTER/TAB:结束键会落到当前焦点按钮上(一扫就进「服务设置」,焦点在 「清空记录」时还会清空记录),而且扫码只能等 50ms 超时才提交。现在按 deviceId 认 “刚发过条码字符的那台设备”,DPAD_CENTER 也算结束键,遥控器 OK 键不受影响。 - 新增「播报走本机扬声器(AV / 3.5mm)」开关(默认关):个别机型插 HDMI 时 HAL 会把 媒体声音锁在 HDMI 声卡,需要显式指定内建扬声器。 桌面端 - 发现列表改为按 MAC 就地合并,不再整表 Clear(每 3 秒一次刷新会把 ListView 的选中项 和滚动位置清掉,现场表现为“设备选不中”)。 - 「添加为通道」从标题行移到列表行内「操作」列,不再依赖选中项。 后端 - NVR 唯一键由全局 (host, port, username) 改为 (subject_id, host, port, username): 不同仓库的内网地址经常相同,之前会报「已被其他主体添加」。查重也只查本主体。 - 新增迁移 20261116010000-scope-nvr-unique-to-subject 与按主体范围的测试。 构建 - android_client/build.ps1:gradle 把 javac 的 stderr 提示写出来时,PowerShell 的 $ErrorActionPreference='Stop' 会把它当终止错误,release 包必失败;改为只以退出码判定。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* NVR 唯一键从「全局」改成「按主体」
|
||
*
|
||
* 之前是 `(host, port, username)` 全局唯一 —— 结果是**别的仓库**加过同一个内网地址
|
||
* (192.168.8.242:8000 这种各仓库都一样的默认地址)后,本主体就再也加不进去,
|
||
* 报「已被其他主体添加」。不同主体本来就是不同的仓库,地址撞车是正常现象。
|
||
*
|
||
* 改成 `(subject_id, host, port, username)`:同一主体内仍然不允许重复添加同一台 NVR,
|
||
* 不同主体之间互不影响。
|
||
*/
|
||
|
||
const INDEX_NAME = 'uk_host_port_username';
|
||
const SCOPED_INDEX_NAME = 'uk_subject_host_port_username';
|
||
|
||
/** 判断索引是否存在(重跑/已经手工改过的库不报错) */
|
||
async function hasIndex(queryInterface, table, name) {
|
||
const indexes = await queryInterface.showIndex(table);
|
||
return indexes.some(item => item.name === name);
|
||
}
|
||
|
||
module.exports = {
|
||
async up(queryInterface) {
|
||
if (await hasIndex(queryInterface, 'nvrs', INDEX_NAME)) {
|
||
await queryInterface.removeIndex('nvrs', INDEX_NAME);
|
||
}
|
||
|
||
if (!(await hasIndex(queryInterface, 'nvrs', SCOPED_INDEX_NAME))) {
|
||
await queryInterface.addIndex('nvrs', [ 'subject_id', 'host', 'port', 'username' ], {
|
||
name: SCOPED_INDEX_NAME,
|
||
unique: true,
|
||
});
|
||
}
|
||
},
|
||
|
||
async down(queryInterface) {
|
||
if (await hasIndex(queryInterface, 'nvrs', SCOPED_INDEX_NAME)) {
|
||
await queryInterface.removeIndex('nvrs', SCOPED_INDEX_NAME);
|
||
}
|
||
|
||
if (!(await hasIndex(queryInterface, 'nvrs', INDEX_NAME))) {
|
||
await queryInterface.addIndex('nvrs', [ 'host', 'port', 'username' ], {
|
||
name: INDEX_NAME,
|
||
unique: true,
|
||
});
|
||
}
|
||
},
|
||
};
|