diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts index 57f0ad8e1..ae608897e 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts @@ -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(this.userProfile?.mutedInstances ?? []))) return false; if (isUserRelated(note, this.muting)) return false; if (isUserRelated(note, this.blocking)) return false; diff --git a/packages/backend/src/server/api/mastodon/streaming/index.ts b/packages/backend/src/server/api/mastodon/streaming/index.ts index 60c2eb4c8..0e20ea28a 100644 --- a/packages/backend/src/server/api/mastodon/streaming/index.ts +++ b/packages/backend/src/server/api/mastodon/streaming/index.ts @@ -28,6 +28,8 @@ const channels: Record = { "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, }