mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 12:39:59 +01:00
Merge pull request #1372 from akihikodaki/misc
Improve WebFinger verification
This commit is contained in:
commit
c69c7b1919
@ -20,14 +20,19 @@ export default async function resolve(query, verifier?: string): Promise<IWebFin
|
|||||||
|
|
||||||
res(result.object);
|
res(result.object);
|
||||||
})) as IWebFinger;
|
})) as IWebFinger;
|
||||||
|
const subject = finger.subject.toLowerCase().replace(/^acct:/, '');
|
||||||
|
|
||||||
if (verifier) {
|
if (typeof verifier === 'string') {
|
||||||
if (finger.subject.toLowerCase().replace(/^acct:/, '') !== verifier) {
|
if (subject !== verifier) {
|
||||||
throw 'WebFinger verfification failed';
|
throw new Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return finger;
|
return finger;
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve(finger.subject, finger.subject.toLowerCase());
|
if (typeof subject === 'string') {
|
||||||
|
return resolve(subject, subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user