mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Add service name to handler
This commit is contained in:
parent
b4d0c65cd2
commit
f7ddaf1176
5 changed files with 6 additions and 2 deletions
3
@types/messageHandler.d.ts
vendored
3
@types/messageHandler.d.ts
vendored
|
|
@ -21,7 +21,8 @@ export interface MessageHandler {
|
|||
removeFromQueue: (index: number) => void,
|
||||
clearQueue: () => void,
|
||||
setDownloadQueue: (data: boolean) => void,
|
||||
getDownloadQueue: () => Promise<boolean>
|
||||
getDownloadQueue: () => Promise<boolean>,
|
||||
name: string
|
||||
}
|
||||
|
||||
export type FolderTypes = 'content' | 'config';
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export default class ServiceHandler {
|
|||
return respond({ isOk: false, reason: new Error('No service selected') });
|
||||
respond(await this.service.auth(data));
|
||||
});
|
||||
this.ws.events.on('type', async (_, respond) => respond(this.service === undefined ? undefined : this.service instanceof FunimationHandler ? 'funi' : this.service instanceof CrunchyHandler ? 'crunchy' : 'hidive'));
|
||||
this.ws.events.on('type', async (_, respond) => respond(this.service === undefined ? undefined : this.service.name as 'hidive'|'crunchy'|'funi'));
|
||||
this.ws.events.on('checkToken', async (_, respond) => {
|
||||
if (this.service === undefined)
|
||||
return respond({ isOk: false, reason: new Error('No service selected') });
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import * as yargs from '../../../modules/module.app-args';
|
|||
|
||||
class CrunchyHandler extends Base implements MessageHandler {
|
||||
private crunchy: Crunchy;
|
||||
public name = 'crunchy';
|
||||
constructor(ws: WebSocketHandler) {
|
||||
super(ws);
|
||||
this.crunchy = new Crunchy();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import * as yargs from '../../../modules/module.app-args';
|
|||
|
||||
class FunimationHandler extends Base implements MessageHandler {
|
||||
private funi: Funimation;
|
||||
public name = 'funi';
|
||||
constructor(ws: WebSocketHandler) {
|
||||
super(ws);
|
||||
this.funi = new Funimation();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import * as yargs from '../../../modules/module.app-args';
|
|||
|
||||
class HidiveHandler extends Base implements MessageHandler {
|
||||
private hidive: Hidive;
|
||||
public name = 'hidive';
|
||||
constructor(ws: WebSocketHandler) {
|
||||
super(ws);
|
||||
this.hidive = new Hidive();
|
||||
|
|
|
|||
Loading…
Reference in a new issue