summaryrefslogtreecommitdiff
path: root/packages/backend/src/core
diff options
context:
space:
mode:
authorKaity A <supakaity@blahaj.zone>2023-10-24 21:16:09 +1000
committerKaity A <supakaity@blahaj.zone>2023-10-24 21:16:09 +1000
commit14a9e1050ba57bcb4cf82b48829accc98c9bd504 (patch)
tree213d9df370a663f9c154fbb08581db32cc1eea2c /packages/backend/src/core
parentMerge branch 'develop' of https://github.com/transfem-org/Sharkey into develop (diff)
downloadsharkey-14a9e1050ba57bcb4cf82b48829accc98c9bd504.tar.gz
sharkey-14a9e1050ba57bcb4cf82b48829accc98c9bd504.tar.bz2
sharkey-14a9e1050ba57bcb4cf82b48829accc98c9bd504.zip
feat: allow using wildcards in antenna
Diffstat (limited to 'packages/backend/src/core')
-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 65be275548..f5db80dedd 100644
--- a/packages/backend/src/core/AntennaService.ts
+++ b/packages/backend/src/core/AntennaService.ts
@@ -115,13 +115,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