mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 17:23:08 +02:00
Merge pull request #1372 from akihikodaki/misc
Improve WebFinger verification
This commit is contained in:
commit
da36d50cfe
1 changed files with 9 additions and 4 deletions
|
@ -20,14 +20,19 @@ export default async function resolve(query, verifier?: string): Promise<IWebFin
|
|||
|
||||
res(result.object);
|
||||
})) as IWebFinger;
|
||||
const subject = finger.subject.toLowerCase().replace(/^acct:/, '');
|
||||
|
||||
if (verifier) {
|
||||
if (finger.subject.toLowerCase().replace(/^acct:/, '') !== verifier) {
|
||||
throw 'WebFinger verfification failed';
|
||||
if (typeof verifier === 'string') {
|
||||
if (subject !== verifier) {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
return finger;
|
||||
}
|
||||
|
||||
return resolve(finger.subject, finger.subject.toLowerCase());
|
||||
if (typeof subject === 'string') {
|
||||
return resolve(subject, subject);
|
||||
}
|
||||
|
||||
throw new Error;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue