mirror of
https://github.com/zoriya/flood.git
synced 2025-12-05 23:06:20 +00:00
flood: rearrange, remove misc files and reformat
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export enum AccessLevel {
|
||||
USER = 5,
|
||||
ADMINISTRATOR = 10,
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const SUPPORTED_CLIENTS = ['qBittorrent', 'rTorrent', 'Transmission'] as const;
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user