mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-29 01:13:02 +00:00
Merge branch 'develop' into feature/misskey-2024.07
This commit is contained in:
commit
99a0765eaf
1 changed files with 5 additions and 3 deletions
|
@ -22,7 +22,9 @@ export type IWebFinger = {
|
||||||
const urlRegex = /^https?:\/\//;
|
const urlRegex = /^https?:\/\//;
|
||||||
const mRegex = /^([^@]+)@(.*)/;
|
const mRegex = /^([^@]+)@(.*)/;
|
||||||
|
|
||||||
const defaultProtocol = process.env.MISSKEY_WEBFINGER_USE_HTTP?.toLowerCase() === 'true' ? 'http' : 'https';
|
// we have the colons here, because URL.protocol does as well, so it's
|
||||||
|
// more uniform in the places we use both
|
||||||
|
const defaultProtocol = process.env.MISSKEY_WEBFINGER_USE_HTTP?.toLowerCase() === 'true' ? 'http:' : 'https:';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WebfingerService {
|
export class WebfingerService {
|
||||||
|
@ -82,7 +84,7 @@ export class WebfingerService {
|
||||||
const m = query.match(mRegex);
|
const m = query.match(mRegex);
|
||||||
if (m) {
|
if (m) {
|
||||||
const hostname = m[2];
|
const hostname = m[2];
|
||||||
return `${defaultProtocol}://${hostname}/.well-known/host-meta`;
|
return `${defaultProtocol}//${hostname}/.well-known/host-meta`;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Invalid query (${query})`);
|
throw new Error(`Invalid query (${query})`);
|
||||||
|
@ -101,7 +103,7 @@ export class WebfingerService {
|
||||||
const template = (hostMeta['XRD']['Link'] as Array<any>).filter(p => p['@_rel'] === 'lrdd')[0]['@_template'];
|
const template = (hostMeta['XRD']['Link'] as Array<any>).filter(p => p['@_rel'] === 'lrdd')[0]['@_template'];
|
||||||
return template.indexOf('{uri}') < 0 ? null : template;
|
return template.indexOf('{uri}') < 0 ? null : template;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`error while request host-meta for ${url}`);
|
console.error(`error while request host-meta for ${url}: ${err}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue