mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-15 08:05:36 +02:00
refactor: use TRANSIENT scope to avoid service bucket relay (#16985)
* refactor: use TRANSIENT scope to avoid service bucket relay * lint: fix lints * refactor: use transient for apResolver * Update packages/backend/src/core/activitypub/models/ApImageService.ts * fix
This commit is contained in:
@@ -3,17 +3,26 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class AdminChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class AdminChannel extends Channel {
|
||||
public readonly chName = 'admin';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = true as const;
|
||||
public static kind = 'read:admin:stream';
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
// Subscribe admin stream
|
||||
@@ -22,22 +31,3 @@ class AdminChannel extends Channel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class AdminChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = AdminChannel.shouldShare;
|
||||
public readonly requireCredential = AdminChannel.requireCredential;
|
||||
public readonly kind = AdminChannel.kind;
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): AdminChannel {
|
||||
return new AdminChannel(
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class AntennaChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class AntennaChannel extends Channel {
|
||||
public readonly chName = 'antenna';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -18,12 +20,12 @@ class AntennaChannel extends Channel {
|
||||
private antennaId: string;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onEvent = this.onEvent.bind(this);
|
||||
}
|
||||
|
||||
@@ -55,24 +57,3 @@ class AntennaChannel extends Channel {
|
||||
this.subscriber.off(`antennaStream:${this.antennaId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class AntennaChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = AntennaChannel.shouldShare;
|
||||
public readonly requireCredential = AntennaChannel.requireCredential;
|
||||
public readonly kind = AntennaChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): AntennaChannel {
|
||||
return new AntennaChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
@@ -11,20 +11,23 @@ import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class ChannelChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ChannelChannel extends Channel {
|
||||
public readonly chName = 'channel';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
private channelId: string;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private noteEntityService: NoteEntityService,
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -92,24 +95,3 @@ class ChannelChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ChannelChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = ChannelChannel.shouldShare;
|
||||
public readonly requireCredential = ChannelChannel.requireCredential;
|
||||
public readonly kind = ChannelChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ChannelChannel {
|
||||
return new ChannelChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { ChatService } from '@/core/ChatService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class ChatRoomChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ChatRoomChannel extends Channel {
|
||||
public readonly chName = 'chatRoom';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -18,12 +20,12 @@ class ChatRoomChannel extends Channel {
|
||||
private roomId: string;
|
||||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -55,24 +57,3 @@ class ChatRoomChannel extends Channel {
|
||||
this.subscriber.off(`chatRoomStream:${this.roomId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ChatRoomChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = ChatRoomChannel.shouldShare;
|
||||
public readonly requireCredential = ChatRoomChannel.requireCredential;
|
||||
public readonly kind = ChatRoomChannel.kind;
|
||||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ChatRoomChannel {
|
||||
return new ChatRoomChannel(
|
||||
this.chatService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { ChatService } from '@/core/ChatService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class ChatUserChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ChatUserChannel extends Channel {
|
||||
public readonly chName = 'chatUser';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -18,12 +20,12 @@ class ChatUserChannel extends Channel {
|
||||
private otherId: string;
|
||||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -55,24 +57,3 @@ class ChatUserChannel extends Channel {
|
||||
this.subscriber.off(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ChatUserChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = ChatUserChannel.shouldShare;
|
||||
public readonly requireCredential = ChatUserChannel.requireCredential;
|
||||
public readonly kind = ChatUserChannel.kind;
|
||||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ChatUserChannel {
|
||||
return new ChatUserChannel(
|
||||
this.chatService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,26 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class DriveChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class DriveChannel extends Channel {
|
||||
public readonly chName = 'drive';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = true as const;
|
||||
public static kind = 'read:account';
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async init(params: JsonObject) {
|
||||
// Subscribe drive stream
|
||||
@@ -22,22 +31,3 @@ class DriveChannel extends Channel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class DriveChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = DriveChannel.shouldShare;
|
||||
public readonly requireCredential = DriveChannel.requireCredential;
|
||||
public readonly kind = DriveChannel.kind;
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): DriveChannel {
|
||||
return new DriveChannel(
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
@@ -11,9 +11,11 @@ import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class GlobalTimelineChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class GlobalTimelineChannel extends Channel {
|
||||
public readonly chName = 'globalTimeline';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
@@ -21,14 +23,14 @@ class GlobalTimelineChannel extends Channel {
|
||||
private withFiles: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -74,28 +76,3 @@ class GlobalTimelineChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class GlobalTimelineChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = GlobalTimelineChannel.shouldShare;
|
||||
public readonly requireCredential = GlobalTimelineChannel.requireCredential;
|
||||
public readonly kind = GlobalTimelineChannel.kind;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): GlobalTimelineChannel {
|
||||
return new GlobalTimelineChannel(
|
||||
this.metaService,
|
||||
this.roleService,
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,30 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class HashtagChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class HashtagChannel extends Channel {
|
||||
public readonly chName = 'hashtag';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
private q: string[][];
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -62,24 +64,3 @@ class HashtagChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class HashtagChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = HashtagChannel.shouldShare;
|
||||
public readonly requireCredential = HashtagChannel.requireCredential;
|
||||
public readonly kind = HashtagChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): HashtagChannel {
|
||||
return new HashtagChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class HomeTimelineChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class HomeTimelineChannel extends Channel {
|
||||
public readonly chName = 'homeTimeline';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -20,12 +22,12 @@ class HomeTimelineChannel extends Channel {
|
||||
private withFiles: boolean;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -98,24 +100,3 @@ class HomeTimelineChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class HomeTimelineChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = HomeTimelineChannel.shouldShare;
|
||||
public readonly requireCredential = HomeTimelineChannel.requireCredential;
|
||||
public readonly kind = HomeTimelineChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): HomeTimelineChannel {
|
||||
return new HomeTimelineChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
@@ -11,9 +11,11 @@ import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class HybridTimelineChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class HybridTimelineChannel extends Channel {
|
||||
public readonly chName = 'hybridTimeline';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = true as const;
|
||||
@@ -23,14 +25,14 @@ class HybridTimelineChannel extends Channel {
|
||||
private withFiles: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -118,28 +120,3 @@ class HybridTimelineChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class HybridTimelineChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = HybridTimelineChannel.shouldShare;
|
||||
public readonly requireCredential = HybridTimelineChannel.requireCredential;
|
||||
public readonly kind = HybridTimelineChannel.kind;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): HybridTimelineChannel {
|
||||
return new HybridTimelineChannel(
|
||||
this.metaService,
|
||||
this.roleService,
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
@@ -11,25 +11,27 @@ import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class LocalTimelineChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class LocalTimelineChannel extends Channel {
|
||||
public readonly chName = 'localTimeline';
|
||||
public static shouldShare = false;
|
||||
public static shouldShare = false as const;
|
||||
public static requireCredential = false as const;
|
||||
private withRenotes: boolean;
|
||||
private withReplies: boolean;
|
||||
private withFiles: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -84,28 +86,3 @@ class LocalTimelineChannel extends Channel {
|
||||
this.subscriber.off('notesStream', this.onNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class LocalTimelineChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = LocalTimelineChannel.shouldShare;
|
||||
public readonly requireCredential = LocalTimelineChannel.requireCredential;
|
||||
public readonly kind = LocalTimelineChannel.kind;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): LocalTimelineChannel {
|
||||
return new LocalTimelineChannel(
|
||||
this.metaService,
|
||||
this.roleService,
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,26 +3,28 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { isInstanceMuted, isUserFromMutedInstance } from '@/misc/is-instance-muted.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class MainChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class MainChannel extends Channel {
|
||||
public readonly chName = 'main';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = true as const;
|
||||
public static kind = 'read:account';
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -61,24 +63,3 @@ class MainChannel extends Channel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class MainChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = MainChannel.shouldShare;
|
||||
public readonly requireCredential = MainChannel.requireCredential;
|
||||
public readonly kind = MainChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): MainChannel {
|
||||
return new MainChannel(
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,26 @@
|
||||
*/
|
||||
|
||||
import Xev from 'xev';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isJsonObject } from '@/misc/json-value.js';
|
||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
class QueueStatsChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class QueueStatsChannel extends Channel {
|
||||
public readonly chName = 'queueStats';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = false as const;
|
||||
|
||||
constructor(id: string, connection: Channel['connection']) {
|
||||
super(id, connection);
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
) {
|
||||
super(request);
|
||||
//this.onStats = this.onStats.bind(this);
|
||||
//this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
@@ -56,22 +61,3 @@ class QueueStatsChannel extends Channel {
|
||||
ev.removeListener('queueStats', this.onStats);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class QueueStatsChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = QueueStatsChannel.shouldShare;
|
||||
public readonly requireCredential = QueueStatsChannel.requireCredential;
|
||||
public readonly kind = QueueStatsChannel.kind;
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): QueueStatsChannel {
|
||||
return new QueueStatsChannel(
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,31 +3,32 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { MiReversiGame } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { ReversiService } from '@/core/ReversiService.js';
|
||||
import { ReversiGameEntityService } from '@/core/entities/ReversiGameEntityService.js';
|
||||
import { isJsonObject } from '@/misc/json-value.js';
|
||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { reversiUpdateKeys } from 'misskey-js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class ReversiGameChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ReversiGameChannel extends Channel {
|
||||
public readonly chName = 'reversiGame';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
private gameId: MiReversiGame['id'] | null = null;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private reversiService: ReversiService,
|
||||
private reversiGameEntityService: ReversiGameEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -107,25 +108,3 @@ class ReversiGameChannel extends Channel {
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ReversiGameChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = ReversiGameChannel.shouldShare;
|
||||
public readonly requireCredential = ReversiGameChannel.requireCredential;
|
||||
public readonly kind = ReversiGameChannel.kind;
|
||||
|
||||
constructor(
|
||||
private reversiService: ReversiService,
|
||||
private reversiGameEntityService: ReversiGameEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ReversiGameChannel {
|
||||
return new ReversiGameChannel(
|
||||
this.reversiService,
|
||||
this.reversiGameEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,22 +3,24 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class ReversiChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ReversiChannel extends Channel {
|
||||
public readonly chName = 'reversi';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = true as const;
|
||||
public static kind = 'read:account';
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -32,22 +34,3 @@ class ReversiChannel extends Channel {
|
||||
this.subscriber.off(`reversiStream:${this.user!.id}`, this.send);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ReversiChannelService implements MiChannelService<true> {
|
||||
public readonly shouldShare = ReversiChannel.shouldShare;
|
||||
public readonly requireCredential = ReversiChannel.requireCredential;
|
||||
public readonly kind = ReversiChannel.kind;
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ReversiChannel {
|
||||
return new ReversiChannel(
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,30 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class RoleTimelineChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class RoleTimelineChannel extends Channel {
|
||||
public readonly chName = 'roleTimeline';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
private roleId: string;
|
||||
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private noteEntityService: NoteEntityService,
|
||||
private roleservice: RoleService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -60,26 +62,3 @@ class RoleTimelineChannel extends Channel {
|
||||
this.subscriber.off(`roleTimelineStream:${this.roleId}`, this.onEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class RoleTimelineChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = RoleTimelineChannel.shouldShare;
|
||||
public readonly requireCredential = RoleTimelineChannel.requireCredential;
|
||||
public readonly kind = RoleTimelineChannel.kind;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
private roleservice: RoleService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): RoleTimelineChannel {
|
||||
return new RoleTimelineChannel(
|
||||
this.noteEntityService,
|
||||
this.roleservice,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,26 @@
|
||||
*/
|
||||
|
||||
import Xev from 'xev';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isJsonObject } from '@/misc/json-value.js';
|
||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
class ServerStatsChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ServerStatsChannel extends Channel {
|
||||
public readonly chName = 'serverStats';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = false as const;
|
||||
|
||||
constructor(id: string, connection: Channel['connection']) {
|
||||
super(id, connection);
|
||||
constructor(
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
) {
|
||||
super(request);
|
||||
//this.onStats = this.onStats.bind(this);
|
||||
//this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
@@ -54,22 +59,3 @@ class ServerStatsChannel extends Channel {
|
||||
ev.removeListener('serverStats', this.onStats);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ServerStatsChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = ServerStatsChannel.shouldShare;
|
||||
public readonly requireCredential = ServerStatsChannel.requireCredential;
|
||||
public readonly kind = ServerStatsChannel.kind;
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): ServerStatsChannel {
|
||||
return new ServerStatsChannel(
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import type { MiUserListMembership, UserListMembershipsRepository, UserListsRepository } from '@/models/_.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
@@ -11,9 +11,11 @@ import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
import Channel, { type ChannelRequest } from '../channel.js';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
class UserListChannel extends Channel {
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class UserListChannel extends Channel {
|
||||
public readonly chName = 'userList';
|
||||
public static shouldShare = false;
|
||||
public static requireCredential = false as const;
|
||||
@@ -24,14 +26,18 @@ class UserListChannel extends Channel {
|
||||
private withRenotes: boolean;
|
||||
|
||||
constructor(
|
||||
@Inject(DI.userListsRepository)
|
||||
private userListsRepository: UserListsRepository,
|
||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||
private noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
@Inject(DI.userListMembershipsRepository)
|
||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||
|
||||
@Inject(REQUEST)
|
||||
request: ChannelRequest,
|
||||
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(request);
|
||||
//this.updateListUsers = this.updateListUsers.bind(this);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
@@ -130,32 +136,3 @@ class UserListChannel extends Channel {
|
||||
clearInterval(this.listUsersClock);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class UserListChannelService implements MiChannelService<false> {
|
||||
public readonly shouldShare = UserListChannel.shouldShare;
|
||||
public readonly requireCredential = UserListChannel.requireCredential;
|
||||
public readonly kind = UserListChannel.kind;
|
||||
|
||||
constructor(
|
||||
@Inject(DI.userListsRepository)
|
||||
private userListsRepository: UserListsRepository,
|
||||
|
||||
@Inject(DI.userListMembershipsRepository)
|
||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public create(id: string, connection: Channel['connection']): UserListChannel {
|
||||
return new UserListChannel(
|
||||
this.userListsRepository,
|
||||
this.userListMembershipsRepository,
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user