feat: migrate to vue 3 (#2689)

---------

Co-authored-by: Joep <jcbuhre@gmail.com>
Co-authored-by: Omar Hussein <omarmohammad1951@gmail.com>
Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
This commit is contained in:
kloon15
2024-04-01 17:18:22 +02:00
committed by GitHub
parent 0e3b35b30e
commit 5100e587d7
164 changed files with 12202 additions and 8047 deletions

33
frontend/src/types/api.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
type ApiMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
type ApiContent =
| Blob
| File
| Pick<ReadableStreamDefaultReader<any>, "read">
| "";
interface ApiOpts {
method?: ApiMethod;
headers?: object;
body?: any;
}
interface TusSettings {
retryCount: number;
chunkSize: number;
}
type ChecksumAlg = "md5" | "sha1" | "sha256" | "sha512";
interface Share {
hash: string;
path: string;
expire?: any;
userID?: number;
token?: string;
username?: string;
}
interface SearchParams {
[key: string]: string;
}

58
frontend/src/types/file.d.ts vendored Normal file
View File

@@ -0,0 +1,58 @@
interface ResourceBase {
path: string;
name: string;
size: number;
extension: string;
modified: string; // ISO 8601 datetime
mode: number;
isDir: boolean;
isSymlink: boolean;
type: ResourceType;
url: string;
}
interface Resource extends ResourceBase {
items: ResourceItem[];
numDirs: number;
numFiles: number;
sorting: Sorting;
hash?: string;
token?: string;
index: number;
subtitles?: string[];
content?: string;
}
interface ResourceItem extends ResourceBase {
index: number;
subtitles?: string[];
}
type ResourceType =
| "video"
| "audio"
| "image"
| "pdf"
| "text"
| "blob"
| "textImmutable";
type DownloadFormat =
| "zip"
| "tar"
| "targz"
| "tarbz2"
| "tarxz"
| "tarlz4"
| "tarsz"
| null;
interface ClipItem {
from: string;
name: string;
}
interface BreadCrumb {
name: string;
url: string;
}

13
frontend/src/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
export {};
declare global {
interface Window {
FileBrowser: any;
grecaptcha: any;
}
interface HTMLElement {
// TODO: no idea what the exact type is
__vue__: any;
}
}

8
frontend/src/types/layout.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
interface PopupProps {
prompt: string;
confirm?: any;
action?: PopupAction;
props?: any;
}
type PopupAction = (e: Event) => void;

57
frontend/src/types/settings.d.ts vendored Normal file
View File

@@ -0,0 +1,57 @@
interface ISettings {
signup: boolean;
createUserDir: boolean;
userHomeBasePath: string;
defaults: SettingsDefaults;
rules: any[];
branding: SettingsBranding;
tus: SettingsTus;
shell: string[];
commands: SettingsCommand;
}
interface SettingsDefaults {
scope: string;
locale: string;
viewMode: ViewModeType;
singleClick: boolean;
sorting: Sorting;
perm: Permissions;
commands: any[];
hideDotfiles: boolean;
dateFormat: boolean;
}
interface SettingsBranding {
name: string;
disableExternal: boolean;
disableUsedPercentage: boolean;
files: string;
theme: UserTheme;
color: string;
}
interface SettingsTus {
chunkSize: number;
retryCount: number;
}
interface SettingsCommand {
after_copy?: string[];
after_delete?: string[];
after_rename?: string[];
after_save?: string[];
after_upload?: string[];
before_copy?: string[];
before_delete?: string[];
before_rename?: string[];
before_save?: string[];
before_upload?: string[];
}
interface SettingsUnit {
KB: number;
MB: number;
GB: number;
TB: number;
}

2
frontend/src/types/toast.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
type IToastSuccess = (message: string) => void;
type IToastError = (error: Error | string, displayReport?: boolean) => void;

51
frontend/src/types/upload.d.ts vendored Normal file
View File

@@ -0,0 +1,51 @@
interface Uploads {
[key: number]: Upload;
}
interface Upload {
id: number;
file: UploadEntry;
type?: ResourceType;
}
interface UploadItem {
id: number;
url?: string;
path: string;
file: UploadEntry;
dir?: boolean;
overwrite?: boolean;
type?: ResourceType;
}
interface UploadEntry {
name: string;
size: number;
isDir: boolean;
fullPath?: string;
file?: File;
}
type UploadList = UploadEntry[];
type Progress = number | boolean;
type CurrentUploadList = {
[key: string]: {
upload: import("tus-js-client").Upload;
recentSpeeds: number[];
initialBytesUploaded: number;
currentBytesUploaded: number;
currentAverageSpeed: number;
lastProgressTimestamp: number | null;
sumOfRecentSpeeds: number;
hasStarted: boolean;
interval: number | undefined;
};
};
interface ETAState {
sizes: number[];
progress: Progress[];
speedMbyte: number;
}

66
frontend/src/types/user.d.ts vendored Normal file
View File

@@ -0,0 +1,66 @@
interface IUser {
id: number;
username: string;
password: string;
scope: string;
locale: string;
perm: Permissions;
commands: string[];
rules: IRule[];
lockPassword: boolean;
hideDotfiles: boolean;
singleClick: boolean;
dateFormat: boolean;
viewMode: ViewModeType;
sorting?: Sorting;
}
type ViewModeType = "list" | "mosaic" | "mosaic gallery";
interface IUserForm {
id?: number;
username?: string;
password?: string;
scope?: string;
locale?: string;
perm?: Permissions;
commands?: string[];
rules?: IRule[];
lockPassword?: boolean;
hideDotfiles?: boolean;
singleClick?: boolean;
dateFormat?: boolean;
}
interface Permissions {
admin: boolean;
copy: boolean;
create: boolean;
delete: boolean;
download: boolean;
execute: boolean;
modify: boolean;
move: boolean;
rename: boolean;
share: boolean;
shell: boolean;
upload: boolean;
}
interface Sorting {
by: string;
asc: boolean;
}
interface IRule {
allow: boolean;
path: string;
regex: boolean;
regexp: IRegexp;
}
interface IRegexp {
raw: string;
}
type UserTheme = "light" | "dark" | "";

1
frontend/src/types/utif.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
declare module "utif";