Fix eslint warnings
This commit is contained in:
parent
2908e4f259
commit
e0a6546df5
26 changed files with 47 additions and 54 deletions
|
|
@ -22,6 +22,7 @@
|
|||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"react-hooks/exhaustive-deps": 0,
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"indent": [
|
||||
"error",
|
||||
|
|
|
|||
2
@types/ws.d.ts
vendored
2
@types/ws.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { GUIConfig } from '../modules/module.cfg-loader';
|
||||
import { AuthResponse, CheckTokenResponse, EpisodeListResponse, FolderTypes, QueueItem, ResolveItemsData, ResponseBase, SearchData, SearchResponse } from './messageHandler';
|
||||
import { AuthResponse, CheckTokenResponse, EpisodeListResponse, FolderTypes, QueueItem, ResolveItemsData, SearchData, SearchResponse } from './messageHandler';
|
||||
|
||||
export type WSMessage<T extends keyof MessageTypes, P extends 0|1 = 0> = {
|
||||
name: T,
|
||||
|
|
|
|||
16
crunchy.ts
16
crunchy.ts
|
|
@ -16,14 +16,6 @@ import * as yamlCfg from './modules/module.cfg-loader';
|
|||
import * as yargs from './modules/module.app-args';
|
||||
import Merger, { Font, MergerInput, SubtitleInput } from './modules/module.merger';
|
||||
|
||||
export type sxItem = {
|
||||
language: langsData.LanguageItem,
|
||||
path: string,
|
||||
file: string
|
||||
title: string,
|
||||
fonts: Font[]
|
||||
}
|
||||
|
||||
// args
|
||||
|
||||
// load req
|
||||
|
|
@ -41,6 +33,14 @@ import { AvailableFilenameVars, getDefault } from './modules/module.args';
|
|||
import { AuthData, AuthResponse, Episode, ResponseBase, SearchData, SearchResponse, SearchResponseItem } from './@types/messageHandler';
|
||||
import { ServiceClass } from './@types/serviceClassInterface';
|
||||
|
||||
export type sxItem = {
|
||||
language: langsData.LanguageItem,
|
||||
path: string,
|
||||
file: string
|
||||
title: string,
|
||||
fonts: Font[]
|
||||
}
|
||||
|
||||
export default class Crunchy implements ServiceClass {
|
||||
public cfg: yamlCfg.ConfigObject;
|
||||
private token: Record<string, any>;
|
||||
|
|
|
|||
10
funi.ts
10
funi.ts
|
|
@ -3,10 +3,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
|
||||
// package json
|
||||
import packageJson from './package.json';
|
||||
|
||||
// program name
|
||||
const api_host = 'https://prod-api-funimationnow.dadcdigital.com/api';
|
||||
import packageJson from './package.json';
|
||||
|
||||
// modules extra
|
||||
import * as shlp from 'sei-helper';
|
||||
|
|
@ -39,7 +36,10 @@ import { TitleElement } from './@types/episode';
|
|||
import { AvailableFilenameVars } from './modules/module.args';
|
||||
import { AuthData, AuthResponse, CheckTokenResponse, FuniGetEpisodeData, FuniGetEpisodeResponse, FuniGetShowData, SearchData, FuniSearchReponse, FuniShowResponse, FuniStreamData, FuniSubsData, FuniEpisodeData, ResponseBase } from './@types/messageHandler';
|
||||
import { ServiceClass } from './@types/serviceClassInterface';
|
||||
import { SubtitleRequest } from './@types/funiSubtitleRequest';
|
||||
import { SubtitleRequest } from './@types/funiSubtitleRequest';
|
||||
|
||||
// program name
|
||||
const api_host = 'https://prod-api-funimationnow.dadcdigital.com/api';
|
||||
// check page
|
||||
|
||||
// fn variables
|
||||
|
|
|
|||
2
gui/react/src/@types/FC.d.ts
vendored
2
gui/react/src/@types/FC.d.ts
vendored
|
|
@ -1,3 +1,3 @@
|
|||
type FCWithChildren<T = {}> = React.FC<{
|
||||
children?: React.ReactNode[]|React.ReactNode
|
||||
}>
|
||||
} & T>
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import React from 'react';
|
||||
import { Button, TextField, Box } from '@mui/material';
|
||||
import { messageChannelContext } from './provider/MessageChannel';
|
||||
import Layout from './Layout';
|
||||
|
||||
const App: React.FC = () => {
|
||||
|
|
|
|||
|
|
@ -6,14 +6,12 @@ import LogoutButton from "./components/LogoutButton";
|
|||
import AddToQueue from "./components/AddToQueue/AddToQueue";
|
||||
import { messageChannelContext } from './provider/MessageChannel';
|
||||
import { ClearAll, Folder } from "@mui/icons-material";
|
||||
import useStore from "./hooks/useStore";
|
||||
import StartQueueButton from "./components/StartQueue";
|
||||
import MenuBar from "./components/MenuBar/MenuBar";
|
||||
|
||||
const Layout: React.FC = () => {
|
||||
|
||||
const messageHandler = React.useContext(messageChannelContext);
|
||||
const [, dispatch] = useStore();
|
||||
|
||||
return <Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
||||
<MenuBar />
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import React from "react";
|
||||
import { Backdrop, Box, Button, Checkbox, Chip, FormControl, FormControlLabel, IconButton, InputLabel, MenuItem, OutlinedInput, Select, TextField } from "@mui/material";
|
||||
import { Box, Button, TextField } from "@mui/material";
|
||||
import useStore from "../../../hooks/useStore";
|
||||
import MultiSelect from "../../reusable/MultiSelect";
|
||||
import { messageChannelContext } from "../../../provider/MessageChannel";
|
||||
import LoadingButton from '@mui/lab/LoadingButton';
|
||||
import { useSnackbar } from "notistack";
|
||||
import { Folder } from "@mui/icons-material";
|
||||
|
||||
type DownloadSelectorProps = {
|
||||
onFinish?: () => unknown
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ const EpisodeListing: React.FC = () => {
|
|||
<Typography color='text.primary' sx={{ textAlign: 'center' }}>
|
||||
{e}
|
||||
</Typography>
|
||||
<img style={{ width: 'inherit', maxHeight: '200px', minWidth: '150px' }} src={item.img}></img>
|
||||
<img style={{ width: 'inherit', maxHeight: '200px', minWidth: '150px' }} src={item.img} alt="thumbnail" />
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', pl: 1 }}>
|
||||
<Box sx={{ display: 'grid', gridTemplateColumns: '1fr min-content' }}>
|
||||
<Typography color='text.primary' variant="h5">
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ const SearchBox: React.FC = () => {
|
|||
}}>
|
||||
<Box sx={{ display: 'flex' }}>
|
||||
<Box sx={{ width: '20%', height: '100%', pr: 2 }}>
|
||||
<img ref={imageRef} src={a.image} style={{ width: '100%', height: '100%' }}/>
|
||||
<img ref={imageRef} src={a.image} style={{ width: '100%', height: '100%' }} alt="thumbnail"/>
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', maxWidth: '70%' }}>
|
||||
<Typography variant='h6' component='h6' color='text.primary' sx={{ }}>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React from "react";
|
||||
import { ExtendedProgress } from "../../../../../../@types/messageHandler";
|
||||
import { RandomEvent } from "../../../../../../@types/randomEvents";
|
||||
import useStore from "../../../hooks/useStore";
|
||||
import { messageChannelContext } from "../../../provider/MessageChannel";
|
||||
|
||||
const useDownloadManager = () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Box, Button, Divider, LinearProgress, Skeleton, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import useStore from "../../../hooks/useStore";
|
||||
import { messageChannelContext } from "../../../provider/MessageChannel";
|
||||
import { queueContext } from "../../../provider/QueueProvider";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { ExitToApp, PauseCircleFilled, PlayCircleFilled } from "@mui/icons-material";
|
||||
import { PauseCircleFilled, PlayCircleFilled } from "@mui/icons-material";
|
||||
import { Button } from "@mui/material";
|
||||
import React from "react";
|
||||
import useStore from "../hooks/useStore";
|
||||
import { messageChannelContext } from "../provider/MessageChannel";
|
||||
import Require from "./Require";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { StyledOptions } from "@emotion/styled";
|
||||
import { Box, Button, Card, Divider, List, Typography, SxProps } from "@mui/material";
|
||||
import { Box, Button, Divider, List, SxProps } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
export type Option = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from "react";
|
||||
import { Box, Chip, FormControl, InputLabel, MenuItem, OutlinedInput, Select, Theme, useTheme } from "@mui/material";
|
||||
import { FormControl, InputLabel, MenuItem, OutlinedInput, Select, Theme, useTheme } from "@mui/material";
|
||||
|
||||
export type MultiSelectProps = {
|
||||
values: string[],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Backdrop, Box, Typography } from "@mui/material";
|
||||
import { Box, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
export default class ErrorHandler extends React.Component<{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { MessageHandler, QueueItem } from '../../../../@types/messageHandler';
|
||||
import { MessageHandler } from '../../../../@types/messageHandler';
|
||||
import useStore from '../hooks/useStore';
|
||||
import type { MessageTypes, WSMessage, WSMessageWithID } from '../../../../@types/ws';
|
||||
import type { Handler, RandomEvent, RandomEvents } from '../../../../@types/randomEvents';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Episode, QueueItem } from '../../../../@types/messageHandler';
|
||||
import { Episode } from '../../../../@types/messageHandler';
|
||||
import { dubLanguageCodes } from '../../../../modules/module.langsData';
|
||||
|
||||
export type DownloadOptions = {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ 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 Funi ? 'funi' : 'crunchy'));
|
||||
this.ws.events.on('checkToken', async ({}, respond) => {
|
||||
this.ws.events.on('type', async (_, respond) => respond(this.service === undefined ? undefined : this.service instanceof Funi ? 'funi' : 'crunchy'));
|
||||
this.ws.events.on('checkToken', async (_, respond) => {
|
||||
if (this.service === undefined)
|
||||
return respond({ isOk: false, reason: new Error('No service selected') });
|
||||
respond(await this.service.checkToken());
|
||||
|
|
@ -62,12 +62,12 @@ export default class ServiceHandler {
|
|||
return respond({ isOk: false, reason: new Error('No service selected') });
|
||||
respond(await this.service.handleDefault(data));
|
||||
});
|
||||
this.ws.events.on('availableDubCodes', async ({}, respond) => {
|
||||
this.ws.events.on('availableDubCodes', async (_, respond) => {
|
||||
if (this.service === undefined)
|
||||
return respond([]);
|
||||
respond(await this.service.availableDubCodes());
|
||||
});
|
||||
this.ws.events.on('availableSubCodes', async ({}, respond) => {
|
||||
this.ws.events.on('availableSubCodes', async (_, respond) => {
|
||||
if (this.service === undefined)
|
||||
return respond([]);
|
||||
respond(await this.service.availableSubCodes());
|
||||
|
|
@ -83,33 +83,33 @@ export default class ServiceHandler {
|
|||
respond(await this.service.listEpisodes(data));
|
||||
});
|
||||
this.ws.events.on('downloadItem', async ({ data }, respond) => {
|
||||
this.service!.downloadItem(data);
|
||||
this.service?.downloadItem(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('writeToClipboard', async ({ data }, respond) => {
|
||||
this.service!.writeToClipboard(data);
|
||||
this.service?.writeToClipboard(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('openFolder', async ({ data }, respond) => {
|
||||
this.service!.openFolder(data);
|
||||
this.service?.openFolder(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('openFile', async ({ data }, respond) => {
|
||||
this.service!.openFile(data);
|
||||
this.service?.openFile(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('openURL', async ({ data }, respond) => {
|
||||
this.service!.openURL(data);
|
||||
this.service?.openURL(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('getQueue', async ({ }, respond) => {
|
||||
this.ws.events.on('getQueue', async (_, respond) => {
|
||||
respond(await this.service?.getQueue() ?? []);
|
||||
});
|
||||
this.ws.events.on('removeFromQueue', async ({ data }, respond) => {
|
||||
this.service?.removeFromQueue(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('clearQueue', async ({ }, respond) => {
|
||||
this.ws.events.on('clearQueue', async (_, respond) => {
|
||||
this.service?.clearQueue();
|
||||
respond(undefined);
|
||||
});
|
||||
|
|
@ -117,10 +117,10 @@ export default class ServiceHandler {
|
|||
this.service?.setDownloadQueue(data);
|
||||
respond(undefined);
|
||||
});
|
||||
this.ws.events.on('getDownloadQueue', async ({ }, respond) => {
|
||||
this.ws.events.on('getDownloadQueue', async (_, respond) => {
|
||||
respond(await this.service?.getDownloadQueue() ?? false);
|
||||
});
|
||||
this.ws.events.on('isDownloading', async ({}, respond) => respond(await this.service!.isDownloading()));
|
||||
this.ws.events.on('isDownloading', async (_, respond) => respond(await this.service?.isDownloading() ?? false));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ export default class Base {
|
|||
progress: data
|
||||
}
|
||||
});
|
||||
}).bind(this);
|
||||
});
|
||||
}
|
||||
|
||||
sendMessage<T extends keyof RandomEvents>(data: RandomEvent<T>) {
|
||||
|
|
@ -120,5 +120,8 @@ export default class Base {
|
|||
}
|
||||
|
||||
//Overriten
|
||||
public async downloadItem(data: QueueItem) {}
|
||||
// eslint-disable-next-line
|
||||
public async downloadItem(_: QueueItem) {
|
||||
throw new Error('downloadItem not overriden');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { AuthData, CheckTokenResponse, DownloadData, EpisodeListResponse, MessageHandler, QueueItem, ResolveItemsData, ResponseBase, SearchData, SearchResponse } from '../../../@types/messageHandler';
|
||||
import { AuthData, CheckTokenResponse, DownloadData, EpisodeListResponse, MessageHandler, ResolveItemsData, SearchData, SearchResponse } from '../../../@types/messageHandler';
|
||||
import Crunchy from '../../../crunchy';
|
||||
import { ArgvType } from '../../../modules/module.app-args';
|
||||
import { buildDefault, getDefault } from '../../../modules/module.args';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { AuthData, CheckTokenResponse, DownloadData, EpisodeListResponse, MessageHandler, QueueItem, ResolveItemsData, ResponseBase, SearchData, SearchResponse } from '../../../@types/messageHandler';
|
||||
import { AuthData, CheckTokenResponse, EpisodeListResponse, MessageHandler, QueueItem, ResolveItemsData, SearchData, SearchResponse } from '../../../@types/messageHandler';
|
||||
import Funimation from '../../../funi';
|
||||
import { ArgvType } from '../../../modules/module.app-args';
|
||||
import { buildDefault, getDefault } from '../../../modules/module.args';
|
||||
|
|
|
|||
2
index.ts
2
index.ts
|
|
@ -45,7 +45,7 @@ import update from './modules/module.updater';
|
|||
if (key.endsWith('crunchy.js') || key.endsWith('funi.js'))
|
||||
delete require.cache[key];
|
||||
});
|
||||
const service = new (argv.service === 'funi' ? (await import('./funi')).default : (await import('./crunchy')).default) as ServiceClass;
|
||||
const service = new (argv.service === 'funi' ? (await import('./funi')).default : (await import('./crunchy')).default)() as ServiceClass;
|
||||
await service.cli();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import pkg from '../package.json';
|
|||
import modulesCleanup from 'removeNPMAbsolutePaths';
|
||||
import { exec } from 'pkg';
|
||||
import { execSync } from 'child_process';
|
||||
import path from 'path';
|
||||
|
||||
const buildsDir = './_builds';
|
||||
const nodeVer = 'node16-';
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class Req {
|
|||
options.followRedirect = params.followRedirect;
|
||||
}
|
||||
// if auth
|
||||
const loc = new URL(durl);
|
||||
//const loc = new URL(durl);
|
||||
// avoid cloudflare protection
|
||||
// debug
|
||||
options.hooks = {
|
||||
|
|
|
|||
1
tsc.ts
1
tsc.ts
|
|
@ -2,7 +2,6 @@ import { ChildProcess, exec } from 'child_process';
|
|||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { removeSync, copyFileSync } from 'fs-extra';
|
||||
import packageJSON from './package.json';
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
let buildIgnore: string[] = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue