2023-07-27 14:31:52 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-02-16 23:09:41 +09:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2022-12-04 15:03:09 +09:00
|
|
|
import { bindThis } from '@/decorators.js';
|
2022-02-27 11:07:39 +09:00
|
|
|
import Channel from '../channel.js';
|
2018-10-07 11:06:17 +09:00
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
class DriveChannel extends Channel {
|
2018-10-11 23:01:57 +09:00
|
|
|
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;
|
2018-10-11 23:01:57 +09:00
|
|
|
|
2022-12-04 15:03:09 +09:00
|
|
|
@bindThis
|
2018-10-07 11:06:17 +09:00
|
|
|
public async init(params: any) {
|
|
|
|
// Subscribe drive stream
|
2019-04-13 01:43:22 +09:00
|
|
|
this.subscriber.on(`driveStream:${this.user!.id}`, data => {
|
2018-10-07 11:06:17 +09:00
|
|
|
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(
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
2022-12-04 15:03:09 +09:00
|
|
|
@bindThis
|
2022-09-18 03:27:08 +09:00
|
|
|
public create(id: string, connection: Channel['connection']): DriveChannel {
|
|
|
|
return new DriveChannel(
|
|
|
|
id,
|
|
|
|
connection,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|