Revert "more readable domain authority check"
This reverts commit 874cf30432
.
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
0caf2d4da1
commit
3c5f9e6fce
1 changed files with 3 additions and 4 deletions
|
@ -17,16 +17,16 @@ function getHrefFrom(one: IObject|string): string | undefined {
|
|||
}
|
||||
|
||||
export function assertActivityMatchesUrls(activity: IObject, urls: string[]) {
|
||||
let idBad = activity.id !== undefined && !urls.includes(activity.id);
|
||||
const idBad = activity.id !== undefined && !urls.includes(activity.id);
|
||||
|
||||
// technically `activity.url` could be an `ApObject = IObject |
|
||||
// string | (IObject | string)[]`, but if it's a complicated thing
|
||||
// and the `activity.id` doesn't match, I think we're fine
|
||||
// rejecting the activity
|
||||
const urlBad = activity.url != undefined && (typeof activity.url !== 'string' || !urls.includes(activity.url));
|
||||
const urlBad = typeof activity.url === 'string' && !urls.includes(activity.url);
|
||||
|
||||
// both of them have to pass checks, if present
|
||||
if (idBad || urlBad) {
|
||||
|
||||
const hosts = urls.map(u => {
|
||||
try {
|
||||
return new URL(u).host;
|
||||
|
@ -42,7 +42,6 @@ export function assertActivityMatchesUrls(activity: IObject, urls: string[]) {
|
|||
throw new Error(`bad Activity: neither id(${activity?.id}) nor url(${JSON.stringify(activity?.url)}) match location(${urls})`);
|
||||
}
|
||||
|
||||
// at least one of the key field must be present
|
||||
if (activity.id || activity.url) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue