summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/AntennaService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-05-30 09:14:21 +0000
committerdakkar <dakkar@thenautilus.net>2024-05-30 09:14:21 +0000
commitdc0bd3c2eea7fb4d2196f1e613a1930552abeafb (patch)
tree9c35d34066f2eba5ea01a6079794664129231bac /packages/backend/src/core/AntennaService.ts
parentmerge: put back button to delete all files for a user - fixes #535 (!526) (diff)
parentfeat: allow using wildcards in antenna (diff)
downloadsharkey-dc0bd3c2eea7fb4d2196f1e613a1930552abeafb.tar.gz
sharkey-dc0bd3c2eea7fb4d2196f1e613a1930552abeafb.tar.bz2
sharkey-dc0bd3c2eea7fb4d2196f1e613a1930552abeafb.zip
merge: feat: allow using wildcards in antenna (!114)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/114 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Leah <kevinlukej@gmail.com>
Diffstat (limited to 'packages/backend/src/core/AntennaService.ts')
-rw-r--r--packages/backend/src/core/AntennaService.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts
index 4f956a43ed..5168b6576f 100644
--- a/packages/backend/src/core/AntennaService.ts
+++ b/packages/backend/src/core/AntennaService.ts
@@ -131,13 +131,17 @@ export class AntennaService implements OnApplicationShutdown {
const { username, host } = Acct.parse(x);
return this.utilityService.getFullApAccount(username, host).toLowerCase();
});
- if (!accts.includes(this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase())) return false;
+ const matchUser = this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase();
+ const matchWildcard = this.utilityService.getFullApAccount('*', noteUser.host).toLowerCase();
+ if (!accts.includes(matchUser) && !accts.includes(matchWildcard)) return false;
} else if (antenna.src === 'users_blacklist') {
const accts = antenna.users.map(x => {
const { username, host } = Acct.parse(x);
return this.utilityService.getFullApAccount(username, host).toLowerCase();
});
- if (accts.includes(this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase())) return false;
+ const matchUser = this.utilityService.getFullApAccount(noteUser.username, noteUser.host).toLowerCase();
+ const matchWildcard = this.utilityService.getFullApAccount('*', noteUser.host).toLowerCase();
+ if (accts.includes(matchUser) || accts.includes(matchWildcard)) return false;
}
const keywords = antenna.keywords