flood: rearrange, remove misc files and reformat

This commit is contained in:
Jesse Chan
2020-11-15 22:54:36 +08:00
parent ba23f0166e
commit 1a878d5423
86 changed files with 700 additions and 917 deletions

View File

@@ -8,7 +8,10 @@ import type {AuthMethod} from '../Auth';
// All auth requests are schema validated to ensure security.
// POST /api/auth/authenticate
export const authAuthenticationSchema = credentialsSchema.pick({username: true, password: true});
export const authAuthenticationSchema = credentialsSchema.pick({
username: true,
password: true,
});
export type AuthAuthenticationOptions = Required<zodInfer<typeof authAuthenticationSchema>>;
// POST /api/auth/authenticate - success response

View File

@@ -1,4 +1,3 @@
// eslint-disable-next-line import/prefer-default-export
export enum AccessLevel {
USER = 5,
ADMINISTRATOR = 10,

View File

@@ -1,2 +1 @@
// eslint-disable-next-line import/prefer-default-export
export const SUPPORTED_CLIENTS = ['qBittorrent', 'rTorrent', 'Transmission'] as const;

View File

@@ -3,16 +3,6 @@ import type {TorrentPeer} from './TorrentPeer';
import type {TorrentStatus} from '../constants/torrentStatusMap';
import type {TorrentTracker} from './TorrentTracker';
export interface Duration {
years?: number;
weeks?: number;
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
cumSeconds: number;
}
export interface TorrentDetails {
contents: Array<TorrentContent>;
peers: Array<TorrentPeer>;

View File

@@ -1,29 +0,0 @@
const formatUtil = {
secondsToDuration: (cumSeconds: number) => {
const years = Math.floor(cumSeconds / 31536000);
const weeks = Math.floor((cumSeconds % 31536000) / 604800);
const days = Math.floor(((cumSeconds % 31536000) % 604800) / 86400);
const hours = Math.floor((((cumSeconds % 31536000) % 604800) % 86400) / 3600);
const minutes = Math.floor(((((cumSeconds % 31536000) % 604800) % 86400) % 3600) / 60);
const seconds = Math.floor(cumSeconds - minutes * 60);
let timeRemaining = null;
if (years > 0) {
timeRemaining = {years, weeks, cumSeconds};
} else if (weeks > 0) {
timeRemaining = {weeks, days, cumSeconds};
} else if (days > 0) {
timeRemaining = {days, hours, cumSeconds};
} else if (hours > 0) {
timeRemaining = {hours, minutes, cumSeconds};
} else if (minutes > 0) {
timeRemaining = {minutes, seconds, cumSeconds};
} else {
timeRemaining = {seconds, cumSeconds};
}
return timeRemaining;
},
};
export default formatUtil;