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>
This commit is contained in:
commit
dc0bd3c2ee
3 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue