mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-01 00:08:10 +09:00
[mastodon-client] Add support for public:allow_local_only stream
This commit is contained in:
parent
f14b3cec97
commit
b5393e41d0
@ -13,12 +13,14 @@ export class MastodonStreamPublic extends MastodonStream {
|
||||
private readonly mediaOnly: boolean;
|
||||
private readonly localOnly: boolean;
|
||||
private readonly remoteOnly: boolean;
|
||||
private readonly allowLocalOnly: boolean;
|
||||
|
||||
constructor(connection: MastodonStream["connection"], name: string) {
|
||||
super(connection, name);
|
||||
this.mediaOnly = name.endsWith(":media");
|
||||
this.localOnly = name.startsWith("public:local");
|
||||
this.remoteOnly = name.startsWith("public:remote");
|
||||
this.allowLocalOnly = name.startsWith("public:allow_local_only");
|
||||
this.onNote = this.onNote.bind(this);
|
||||
this.onNoteEvent = this.onNoteEvent.bind(this);
|
||||
}
|
||||
@ -64,6 +66,7 @@ export class MastodonStreamPublic extends MastodonStream {
|
||||
if (this.mediaOnly && note.fileIds.length < 1) return false;
|
||||
if (this.localOnly && note.userHost !== null) return false;
|
||||
if (this.remoteOnly && note.userHost === null) return false;
|
||||
if (note.localOnly && !this.allowLocalOnly && !this.localOnly) return false;
|
||||
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return false;
|
||||
if (isUserRelated(note, this.muting)) return false;
|
||||
if (isUserRelated(note, this.blocking)) return false;
|
||||
|
@ -28,6 +28,8 @@ const channels: Record<string, any> = {
|
||||
"public:local:media": MastodonStreamPublic,
|
||||
"public:remote": MastodonStreamPublic,
|
||||
"public:remote:media": MastodonStreamPublic,
|
||||
"public:allow_local_only": MastodonStreamPublic,
|
||||
"public:allow_local_only:media": MastodonStreamPublic,
|
||||
"hashtag": MastodonStreamTag,
|
||||
"hashtag:local": MastodonStreamTag,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user