misskey/packages/backend/src/server/api/stream/channels/drive.ts

41 lines
906 B
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Injectable } from '@nestjs/common';
import { bindThis } from '@/decorators.js';
import Channel from '../channel.js';
2022-09-18 03:27:08 +09:00
class DriveChannel extends Channel {
public readonly chName = 'drive';
2018-10-11 23:07:20 +09:00
public static shouldShare = true;
2018-11-11 02:22:34 +09:00
public static requireCredential = true;
@bindThis
public async init(params: any) {
// Subscribe drive stream
this.subscriber.on(`driveStream:${this.user!.id}`, data => {
this.send(data);
});
}
}
2022-09-18 03:27:08 +09:00
@Injectable()
export class DriveChannelService {
public readonly shouldShare = DriveChannel.shouldShare;
public readonly requireCredential = DriveChannel.requireCredential;
constructor(
) {
}
@bindThis
2022-09-18 03:27:08 +09:00
public create(id: string, connection: Channel['connection']): DriveChannel {
return new DriveChannel(
id,
connection,
);
}
}