1
1
mirror of https://github.com/ZeroCatDev/ClassworksKV.git synced 2025-12-09 23:53:11 +00:00

Compare commits

..

No commits in common. "114069a99951854de9c29474f7c971854213e8eb" and "296473633c0c820d1938904a97563a19c3e87c1d" have entirely different histories.

2 changed files with 4 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ClassworksKV",
"version": "1.2.1",
"version": "1.2.0",
"private": true,
"scripts": {
"start": "node ./bin/www",

View File

@ -28,7 +28,7 @@ router.use(prepareTokenForRateLimit);
router.get(
"/_info",
tokenReadLimiter,
errors.catchAsync(async (req, res, next) => {
errors.catchAsync(async (req, res) => {
const deviceId = res.locals.deviceId;
// 获取设备信息,包含关联的账号
@ -43,24 +43,17 @@ router.get(
return next(errors.createError(404, "设备不存在"));
}
// 构建响应对象:当设备没有关联账号时返回 uuid若已关联账号则不返回 uuid
// 构建响应对象
const response = {
device: {
id: device.id,
uuid: device.uuid,
name: device.name,
createdAt: device.createdAt,
updatedAt: device.updatedAt,
},
};
// 仅当设备未绑定账号时,包含 uuid 字段
if (!device.account) {
response.device.uuid = device.uuid;
}
// 标识是否已绑定账号
response.hasAccount = !!device.account;
// 如果关联了账号,添加账号信息
if (device.account) {
response.account = {