mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
CR & lint fixes
This commit is contained in:
parent
866a6b5923
commit
899aac28ee
@ -165,7 +165,7 @@
|
|||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
<div class="list-group-item pt-3">
|
<div class="list-group-item pt-3">
|
||||||
<h6>
|
<h6>
|
||||||
<Icon v="key"/> Authenticators
|
<Icon v="key" /> Authenticators
|
||||||
</h6>
|
</h6>
|
||||||
<Loading :value="authenticators">
|
<Loading :value="authenticators">
|
||||||
<p>
|
<p>
|
||||||
@ -175,10 +175,12 @@
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<template v-for="authenticator in authenticators">
|
<template v-for="authenticator in authenticators">
|
||||||
<li v-if="showExpiredAuthenticators || authenticator.validUntil === null"
|
<li
|
||||||
:class="authenticator.validUntil === null ? '' : 'small text-muted'">
|
v-if="showExpiredAuthenticators || authenticator.validUntil === null"
|
||||||
|
:class="authenticator.validUntil === null ? '' : 'small text-muted'"
|
||||||
|
>
|
||||||
<Tooltip :text="authenticator.type">
|
<Tooltip :text="authenticator.type">
|
||||||
<Icon :v="authenticatorIcon(authenticator.type)"/>
|
<Icon :v="authenticatorIcon(authenticator.type)" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
{{ $datetime($ulidTime(authenticator.id)) }}
|
{{ $datetime($ulidTime(authenticator.id)) }}
|
||||||
<pre><code>{{ authenticator.payload }}</code></pre>
|
<pre><code>{{ authenticator.payload }}</code></pre>
|
||||||
@ -440,10 +442,10 @@ export default mainPronoun.extend({
|
|||||||
case 'mfa_recovery':
|
case 'mfa_recovery':
|
||||||
return 'mobile';
|
return 'mobile';
|
||||||
default:
|
default:
|
||||||
return 'b:' + type;
|
return `b:${type}`;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import SQL from 'sql-template-strings';
|
import SQL from 'sql-template-strings';
|
||||||
import avatar from '../avatar.ts';
|
import avatar from '../avatar.ts';
|
||||||
import {buildDict, now, shuffle, handleErrorAsync, filterObjectKeys} from '../../src/helpers.ts';
|
import { buildDict, now, shuffle, handleErrorAsync, filterObjectKeys } from '../../src/helpers.ts';
|
||||||
import allLocales from '../../locale/locales.ts';
|
import allLocales from '../../locale/locales.ts';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { caches } from '../../src/cache.js';
|
import { caches } from '../../src/cache.js';
|
||||||
@ -666,16 +666,16 @@ router.get('/admin/authenticators/:id', handleErrorAsync(async (req, res) => {
|
|||||||
SELECT * FROM authenticators
|
SELECT * FROM authenticators
|
||||||
WHERE userId = ${req.params.id}
|
WHERE userId = ${req.params.id}
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
`)).map(auth => {
|
`)).map((auth) => {
|
||||||
delete auth.userId;
|
delete auth.userId;
|
||||||
|
|
||||||
let payload = JSON.parse(auth.payload);
|
const payload = JSON.parse(auth.payload);
|
||||||
auth.payload = typeof(payload) === 'string'
|
auth.payload = typeof payload === 'string'
|
||||||
? null
|
? null
|
||||||
: filterObjectKeys(payload, ['id', 'email', 'name', 'instance', 'username']);
|
: filterObjectKeys(payload, ['id', 'email', 'name', 'instance', 'username']);
|
||||||
|
|
||||||
return auth;
|
return auth;
|
||||||
})
|
});
|
||||||
|
|
||||||
return res.json(authenticators);
|
return res.json(authenticators);
|
||||||
}));
|
}));
|
||||||
|
@ -503,11 +503,11 @@ export const parseUserJwt = (token: string): string | JwtPayload | null => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const filterObjectKeys = (obj: Record<string, any>, keysToKeep: Array<string>) => {
|
export const filterObjectKeys = <T extends Record<string, any>, K extends keyof T>(obj: T, keysToKeep: K[]): Pick<T, K> => {
|
||||||
return Object.keys(obj).reduce((filteredObj: Record<string, any>, key) => {
|
return keysToKeep.reduce((filteredObj, key) => {
|
||||||
if (keysToKeep.includes(key)) {
|
if (key in obj) {
|
||||||
filteredObj[key] = obj[key];
|
filteredObj[key] = obj[key];
|
||||||
}
|
}
|
||||||
return filteredObj;
|
return filteredObj;
|
||||||
}, {});
|
}, {} as Pick<T, K>);
|
||||||
}
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user