fix: 🐛 only verify if needed

This commit is contained in:
ThatOneCalculator 2023-07-16 19:19:00 -07:00
parent 6d7c5f2b2e
commit 34cfe9c15c
No known key found for this signature in database
GPG key ID: 8703CACD01000000
4 changed files with 11 additions and 5 deletions

View file

@ -26,6 +26,7 @@ export async function verifyLinks(
x.name !== "" &&
typeof x.value === "string" &&
x.value !== "" &&
x.value.startsWith("http") &&
((x.lastVerified &&
x.lastVerified.getTime() < Date.now() - 1000 * 60 * 60 * 24 * 14) ||
!x.lastVerified),

View file

@ -245,10 +245,13 @@ export default define(meta, paramDef, async (ps, _user, token) => {
x.value !== "",
)
.map(async (x) => {
const relMeLinks = await getRelMeLinks(x.value);
const verified = relMeLinks.some((link) =>
link.includes(`${config.host}/@${user.username}`),
);
let verified = false;
if (x.value.startsWith("http")) {
const relMeLinks = await getRelMeLinks(x.value);
verified = relMeLinks.some((link) =>
link.includes(`${config.host}/@${user.username}`),
);
}
return {
name: x.name,
value: x.value,

View file

@ -294,10 +294,10 @@
>
<dt class="name">
<i
v-if="field.verified"
class="ph-bold ph-seal-check ph-lg ph-fw"
style="padding: 5px"
:v-tooltip="i18n.ts.verifiedLink"
:aria-label="i18n.t('verifiedLink')"
></i>
<Mfm
:text="field.name"

View file

@ -2,5 +2,7 @@ namespace MisskeyEntity {
export type Field = {
name: string
value: string
verified?: string
verifiedAt?: Date
}
}