mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 09:38:19 +08:00
bug fixes
This commit is contained in:
11 files changed
+45
-19
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user