Merge commit from fork

* Tighten security on channels

* Fix main channel

* add comments, improve typing

* fix indent

* fix: missing membership checks in chat-room

* remove unnecessary check in chat-user

* fix

* refactor: use exists

* fix

---------

Co-authored-by: Julia Johannesen <julia@insertdomain.name>
This commit is contained in:
かっこかり
2026-03-09 08:18:14 +09:00
committed by GitHub
parent b361a10c48
commit 06e74508a2
9 changed files with 96 additions and 27 deletions

View File

@@ -4,6 +4,8 @@
*/
import { Inject, Injectable, Scope } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { AntennasRepository } from '@/models/_.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { NoteStreamingHidingService } from '../NoteStreamingHidingService.js';
import { bindThis } from '@/decorators.js';
@@ -25,6 +27,9 @@ export class AntennaChannel extends Channel {
@Inject(REQUEST)
request: ChannelRequest,
@Inject(DI.antennasRepository)
private antennasReposiotry: AntennasRepository,
private noteEntityService: NoteEntityService,
private noteStreamingHidingService: NoteStreamingHidingService,
) {
@@ -33,12 +38,25 @@ export class AntennaChannel extends Channel {
}
@bindThis
public async init(params: JsonObject) {
if (typeof params.antennaId !== 'string') return;
public async init(params: JsonObject): Promise<boolean> {
if (typeof params.antennaId !== 'string') return false;
if (!this.user) return false;
this.antennaId = params.antennaId;
const antennaExists = await this.antennasReposiotry.exists({
where: {
id: this.antennaId,
userId: this.user.id,
},
});
if (!antennaExists) return false;
// Subscribe stream
this.subscriber.on(`antennaStream:${this.antennaId}`, this.onEvent);
return true;
}
@bindThis