2023-07-27 07:31:52 +02:00
|
|
|
/*
|
2024-02-12 03:37:45 +01:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-02-16 15:09:41 +01:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2023-02-15 05:06:06 +01:00
|
|
|
import { bindThis } from '@/decorators.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { HybridTimelineChannelService } from './channels/hybrid-timeline.js';
|
|
|
|
import { LocalTimelineChannelService } from './channels/local-timeline.js';
|
|
|
|
import { HomeTimelineChannelService } from './channels/home-timeline.js';
|
|
|
|
import { GlobalTimelineChannelService } from './channels/global-timeline.js';
|
|
|
|
import { MainChannelService } from './channels/main.js';
|
|
|
|
import { ChannelChannelService } from './channels/channel.js';
|
|
|
|
import { AdminChannelService } from './channels/admin.js';
|
|
|
|
import { ServerStatsChannelService } from './channels/server-stats.js';
|
|
|
|
import { QueueStatsChannelService } from './channels/queue-stats.js';
|
|
|
|
import { UserListChannelService } from './channels/user-list.js';
|
|
|
|
import { AntennaChannelService } from './channels/antenna.js';
|
|
|
|
import { DriveChannelService } from './channels/drive.js';
|
|
|
|
import { HashtagChannelService } from './channels/hashtag.js';
|
2023-04-12 04:40:08 +02:00
|
|
|
import { RoleTimelineChannelService } from './channels/role-timeline.js';
|
2024-01-19 12:51:49 +01:00
|
|
|
import { ReversiChannelService } from './channels/reversi.js';
|
|
|
|
import { ReversiGameChannelService } from './channels/reversi-game.js';
|
2023-12-27 07:08:59 +01:00
|
|
|
import { type MiChannelService } from './channel.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class ChannelsService {
|
|
|
|
constructor(
|
|
|
|
private mainChannelService: MainChannelService,
|
|
|
|
private homeTimelineChannelService: HomeTimelineChannelService,
|
|
|
|
private localTimelineChannelService: LocalTimelineChannelService,
|
|
|
|
private hybridTimelineChannelService: HybridTimelineChannelService,
|
|
|
|
private globalTimelineChannelService: GlobalTimelineChannelService,
|
|
|
|
private userListChannelService: UserListChannelService,
|
|
|
|
private hashtagChannelService: HashtagChannelService,
|
2023-04-12 04:40:08 +02:00
|
|
|
private roleTimelineChannelService: RoleTimelineChannelService,
|
2022-09-17 20:27:08 +02:00
|
|
|
private antennaChannelService: AntennaChannelService,
|
|
|
|
private channelChannelService: ChannelChannelService,
|
|
|
|
private driveChannelService: DriveChannelService,
|
|
|
|
private serverStatsChannelService: ServerStatsChannelService,
|
|
|
|
private queueStatsChannelService: QueueStatsChannelService,
|
|
|
|
private adminChannelService: AdminChannelService,
|
2024-01-19 12:51:49 +01:00
|
|
|
private reversiChannelService: ReversiChannelService,
|
|
|
|
private reversiGameChannelService: ReversiGameChannelService,
|
2022-09-17 20:27:08 +02:00
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
2022-12-04 07:03:09 +01:00
|
|
|
@bindThis
|
2023-12-27 07:08:59 +01:00
|
|
|
public getChannelService(name: string): MiChannelService<boolean> {
|
2022-09-17 20:27:08 +02:00
|
|
|
switch (name) {
|
|
|
|
case 'main': return this.mainChannelService;
|
|
|
|
case 'homeTimeline': return this.homeTimelineChannelService;
|
|
|
|
case 'localTimeline': return this.localTimelineChannelService;
|
|
|
|
case 'hybridTimeline': return this.hybridTimelineChannelService;
|
|
|
|
case 'globalTimeline': return this.globalTimelineChannelService;
|
|
|
|
case 'userList': return this.userListChannelService;
|
|
|
|
case 'hashtag': return this.hashtagChannelService;
|
2023-04-12 04:40:08 +02:00
|
|
|
case 'roleTimeline': return this.roleTimelineChannelService;
|
2022-09-17 20:27:08 +02:00
|
|
|
case 'antenna': return this.antennaChannelService;
|
|
|
|
case 'channel': return this.channelChannelService;
|
|
|
|
case 'drive': return this.driveChannelService;
|
|
|
|
case 'serverStats': return this.serverStatsChannelService;
|
|
|
|
case 'queueStats': return this.queueStatsChannelService;
|
|
|
|
case 'admin': return this.adminChannelService;
|
2024-01-19 12:51:49 +01:00
|
|
|
case 'reversi': return this.reversiChannelService;
|
|
|
|
case 'reversiGame': return this.reversiGameChannelService;
|
2023-07-08 00:08:16 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
default:
|
|
|
|
throw new Error(`no such channel: ${name}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|