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

33 lines
733 B
TypeScript
Raw Normal View History

2022-09-18 03:27:08 +09:00
import { Inject, Injectable } from '@nestjs/common';
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;
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(
) {
}
public create(id: string, connection: Channel['connection']): DriveChannel {
return new DriveChannel(
id,
connection,
);
}
}