summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/channels/local-timeline.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/local-timeline.ts')
-rw-r--r--packages/backend/src/server/api/stream/channels/local-timeline.ts43
1 files changed, 10 insertions, 33 deletions
diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts
index 3d7ed6acdb..b394e9663f 100644
--- a/packages/backend/src/server/api/stream/channels/local-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts
@@ -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,
- );
- }
-}