bug fixes

This commit is contained in:
undefined committed 2025-03-25 14:26:46 +08:00
1 parent 62fb745322
commit dc9cc9eecf
11 files changed
+45 -19

No files matched your search

+3 -3
View File
@@ -181,7 +181,6 @@ export class HomeHandler extends Handler {
class HomeSecurityHandler extends Handler {
@requireSudo
async get() {
const geoip = this.ctx.get('geoip');
// TODO(iceboy): pagination? or limit session count for uid?
const sessions = await token.getSessionListByUid(this.user._id);
for (const session of sessions) {
@@ -189,7 +188,7 @@ class HomeSecurityHandler extends Handler {
session._id = md5(session._id);
const ua = session.updateUa || session.createUa;
if (ua) session.updateUaInfo = UAParser(ua);
session.updateGeoip = geoip?.lookup?.(
session.updateGeoip = this.ctx.geoip?.lookup?.(
session.updateIp || session.createIp,
this.translate('geoip_locale'),
);
@@ -202,7 +201,7 @@ class HomeSecurityHandler extends Handler {
'credentialID', 'name', 'credentialType', 'credentialDeviceType',
'authenticatorAttachment', 'regat', 'fmt',
])),
geoipProvider: geoip?.provider,
geoipProvider: this.ctx.geoip?.provider,
};
}
@@ -610,6 +609,7 @@ class HomeMessagesConnectionHandler extends ConnectionHandler {
}
}
export const inject = { geoip: { required: false } };
export function apply(ctx: Context) {
ctx.Route('homepage', '/', HomeHandler);
ctx.Route('home_security', '/home/security', HomeSecurityHandler, PRIV.PRIV_USER_PROFILE);