🔧 fix lint errors and bumb version

This commit is contained in:
Thomas Camlong
2022-11-12 08:12:54 +09:00
parent 7414f02667
commit dfdb8678b7
21 changed files with 82 additions and 87 deletions

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options);
const nzbgetHistory:NzbgetHistoryItem[] = await new Promise((resolve, reject) => {
const nzbgetHistory: NzbgetHistoryItem[] = await new Promise((resolve, reject) => {
nzbGet.history(false, (err: any, result: NzbgetHistoryItem[]) => {
if (!err) {
resolve(result);

View File

@@ -47,7 +47,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options);
const nzbgetStatus:NzbgetStatus = await new Promise((resolve, reject) => {
const nzbgetStatus: NzbgetStatus = await new Promise((resolve, reject) => {
nzbGet.status((err: any, result: NzbgetStatus) => {
if (!err) {
resolve(result);

View File

@@ -2,21 +2,21 @@ import NZBGet from 'nzbget-api';
import { NzbgetClientOptions } from './types';
export function NzbgetClient(options: NzbgetClientOptions) {
if (!options?.host) {
throw new Error('Cannot connect to NZBGet. Missing host in service config.');
}
if (!options?.host) {
throw new Error('Cannot connect to NZBGet. Missing host in service config.');
}
if (!options?.port) {
throw new Error('Cannot connect to NZBGet. Missing port in service config.');
}
if (!options?.port) {
throw new Error('Cannot connect to NZBGet. Missing port in service config.');
}
if (!options?.login) {
throw new Error('Cannot connect to NZBGet. Missing username in service config.');
}
if (!options?.login) {
throw new Error('Cannot connect to NZBGet. Missing username in service config.');
}
if (!options?.hash) {
throw new Error('Cannot connect to NZBGet. Missing password in service config.');
}
if (!options?.hash) {
throw new Error('Cannot connect to NZBGet. Missing password in service config.');
}
return new NZBGet(options);
return new NZBGet(options);
}

View File

@@ -25,9 +25,9 @@ export interface NzbgetHistoryItem {
DownloadTimeSec: number;
PostTotalTimeSec: number;
ParTimeSec: number;
RepairTimeSec: number
RepairTimeSec: number;
UnpackTimeSec: number;
MessageCount:number;
MessageCount: number;
DupeKey: string;
DupeScore: number;
DupeMode: 'SCORE' | 'ALL' | 'FORCE';
@@ -71,7 +71,21 @@ export interface NzbgetQueueItem {
MaxPostTime: number;
MaxPriority: number;
ActiveDownloads: number;
Status: 'QUEUED' | 'PAUSED' | 'DOWNLOADING' | 'FETCHING' | 'PP_QUEUED' | 'LOADING_PARS' | 'VERIFYING_SOURCES' | 'REPAIRING' | 'VERIFYING_REPAIRED' | 'RENAMING' | 'UNPACKING' | 'MOVING' | 'EXECUTING_SCRIPT' | 'PP_FINISHED';
Status:
| 'QUEUED'
| 'PAUSED'
| 'DOWNLOADING'
| 'FETCHING'
| 'PP_QUEUED'
| 'LOADING_PARS'
| 'VERIFYING_SOURCES'
| 'REPAIRING'
| 'VERIFYING_REPAIRED'
| 'RENAMING'
| 'UNPACKING'
| 'MOVING'
| 'EXECUTING_SCRIPT'
| 'PP_FINISHED';
TotalArticles: number;
SuccessArticles: number;
FailedArticles: number;
@@ -128,8 +142,8 @@ export interface NzbgetStatus {
}
export interface NzbgetClientOptions {
host: string,
port: string,
login: string | undefined,
hash: string | undefined,
host: string;
port: string;
login: string | undefined;
hash: string | undefined;
}

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options);
const nzbgetQueue:NzbgetQueueItem[] = await new Promise((resolve, reject) => {
const nzbgetQueue: NzbgetQueueItem[] = await new Promise((resolve, reject) => {
nzbGet.listGroups((err: any, result: NzbgetQueueItem[]) => {
if (!err) {
resolve(result);
@@ -62,7 +62,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
throw new Error('Error while getting NZBGet queue');
}
const nzbgetStatus:NzbgetStatus = await new Promise((resolve, reject) => {
const nzbgetStatus: NzbgetStatus = await new Promise((resolve, reject) => {
nzbGet.status((err: any, result: NzbgetStatus) => {
if (!err) {
resolve(result);
@@ -139,7 +139,7 @@ function getNzbgetState(status: string) {
case 'QUEUED':
return 'queued';
case 'PAUSED ':
return 'paused';
return 'paused';
default:
return 'downloading';
}