remove sync

This commit is contained in:
2025-12-28 16:16:23 +08:00
parent 9f51d27398
commit df6db9d88b
10 changed files with 42 additions and 53 deletions

View File

@@ -82,6 +82,6 @@ AppDomainModel.init(
},
);
AppDomainModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('AppDomainModel sync', e);
});
// AppDomainModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('AppDomainModel sync', e);
// });

View File

@@ -51,6 +51,6 @@ AppListModel.init(
},
);
AppListModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('AppListModel sync', e);
});
// AppListModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('AppListModel sync', e);
// });

View File

@@ -155,6 +155,6 @@ AppModel.init(
},
);
AppModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('AppModel sync', e);
});
// AppModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('AppModel sync', e);
// });

View File

@@ -142,8 +142,8 @@ ConfigModel.init(
},
);
ConfigModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('ConfigModel sync', e);
});
// ConfigModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('ConfigModel sync', e);
// });
useContextKey('ConfigModel', () => ConfigModel);

View File

@@ -96,6 +96,6 @@ ContainerModel.init(
},
);
ContainerModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('ContainerModel sync', e);
});
// ContainerModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('ContainerModel sync', e);
// });

View File

@@ -40,6 +40,6 @@ GithubModel.init(
},
);
GithubModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('GithubModel sync', e);
});
// GithubModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('GithubModel sync', e);
// });

View File

@@ -83,6 +83,6 @@ PageModel.init(
},
);
PageModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('PageModel sync', e);
});
// PageModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('PageModel sync', e);
// });

View File

@@ -53,37 +53,35 @@ app
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'token is expired and redirect error');
}
return;
}
if (!loginToken) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'loginToken is required');
}
if (!sign) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'sign is required');
}
if (!randomId) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'randomId is required');
}
const tokenSecret = 'xiao' + randomId;
let payload: any = {};
try {
payload = jsonwebtoken.verify(loginToken, tokenSecret);
} catch (e) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'loginToken error');
}
const { timestamp } = payload;
if (sign) {
let payload: any = {};
try {
payload = jsonwebtoken.verify(loginToken, tokenSecret);
} catch (e) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'loginToken error');
}
const { timestamp } = payload;
const checkSign = MD5(`${tokenSecret}${timestamp}`).toString();
if (sign !== checkSign) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'sign error');
const checkSign = MD5(`${tokenSecret}${timestamp}`).toString();
if (sign !== checkSign) {
await setErrorLoginTokenRedis(loginToken);
ctx.throw(400, 'sign error');
}
}
const user = await User.findByPk(tokenUser.id);
if (!user) {
await setErrorLoginTokenRedis(loginToken);