Resolve various issues:
- Remove import types - Mismatch in interface / types - remove some weird git conflicts
This commit is contained in:
parent
bf99823977
commit
101aba86fc
144
frontend/package-lock.json
generated
144
frontend/package-lock.json
generated
@ -35,11 +35,15 @@
|
||||
<<<<<<< HEAD
|
||||
"@intlify/unplugin-vue-i18n": "^0.12.3",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"@intlify/unplugin-vue-i18n": "^1.0.1",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
"@types/node": "^20.6.0",
|
||||
>>>>>>> kloon15/vue3
|
||||
=======
|
||||
"@types/node": "^20.6.0",
|
||||
>>>>>>> vue3-bak
|
||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||
"@vitejs/plugin-legacy": "^4.1.1",
|
||||
"@vitejs/plugin-vue": "^4.3.4",
|
||||
@ -2177,17 +2181,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
<<<<<<< HEAD
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz",
|
||||
"integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==",
|
||||
=======
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz",
|
||||
"integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==",
|
||||
>>>>>>> vue3-bak
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/config-array": {
|
||||
<<<<<<< HEAD
|
||||
"version": "0.11.11",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
|
||||
"integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
|
||||
=======
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
|
||||
"integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==",
|
||||
>>>>>>> vue3-bak
|
||||
"dependencies": {
|
||||
"@humanwhocodes/object-schema": "^1.2.1",
|
||||
"debug": "^4.1.1",
|
||||
@ -2504,6 +2520,7 @@
|
||||
"version": "7.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
|
||||
"integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA=="
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.198",
|
||||
@ -2525,6 +2542,8 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz",
|
||||
"integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==",
|
||||
"dev": true
|
||||
=======
|
||||
>>>>>>> vue3-bak
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.198",
|
||||
@ -2541,6 +2560,12 @@
|
||||
"@types/lodash": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.0.tgz",
|
||||
"integrity": "sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz",
|
||||
@ -3067,6 +3092,39 @@
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node_modules/@vue/eslint-config-typescript/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/eslint-config-typescript/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/eslint-config-typescript/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
>>>>>>> vue3-bak
|
||||
"node_modules/@vue/reactivity": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.3.4.tgz",
|
||||
@ -3969,9 +4027,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
<<<<<<< HEAD
|
||||
"version": "8.49.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz",
|
||||
"integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==",
|
||||
=======
|
||||
"version": "8.48.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz",
|
||||
"integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==",
|
||||
>>>>>>> vue3-bak
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
@ -4082,6 +4146,39 @@
|
||||
"eslint": "^6.2.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node_modules/eslint-plugin-vue/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-vue/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-vue/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
>>>>>>> vue3-bak
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
|
||||
@ -4213,6 +4310,20 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node_modules/espree/node_modules/eslint-visitor-keys": {
|
||||
"version": "3.4.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz",
|
||||
"integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==",
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
>>>>>>> vue3-bak
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
@ -6585,6 +6696,39 @@
|
||||
"eslint": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node_modules/vue-eslint-parser/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/vue-eslint-parser/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/vue-eslint-parser/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
>>>>>>> vue3-bak
|
||||
"node_modules/vue-i18n": {
|
||||
"version": "9.3.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.3.0.tgz",
|
||||
|
||||
@ -38,14 +38,9 @@
|
||||
"vue-toastification": "^2.0.0-rc.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
<<<<<<< HEAD
|
||||
"@intlify/unplugin-vue-i18n": "^0.12.3",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
=======
|
||||
"@intlify/unplugin-vue-i18n": "^1.0.1",
|
||||
"@types/lodash-es": "^4.17.9",
|
||||
"@types/node": "^20.6.0",
|
||||
>>>>>>> kloon15/vue3
|
||||
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||
"@vitejs/plugin-legacy": "^4.1.1",
|
||||
"@vitejs/plugin-vue": "^4.3.4",
|
||||
|
||||
@ -2,13 +2,6 @@ import { createURL, fetchURL, removePrefix } from "./utils";
|
||||
import { baseURL } from "@/utils/constants";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { upload as postTus, useTus } from "./tus";
|
||||
import type {
|
||||
ApiContent,
|
||||
ApiMethod,
|
||||
ApiOpts,
|
||||
ChecksumAlgs,
|
||||
IFile,
|
||||
} from "@/types";
|
||||
|
||||
export async function fetch(url: string) {
|
||||
url = removePrefix(url);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { IShare } from "@/types";
|
||||
import { fetchURL, removePrefix, createURL } from "./utils";
|
||||
import { baseURL } from "@/utils/constants";
|
||||
|
||||
@ -67,7 +66,7 @@ export function download(
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
export function getDownloadURL(share: IShare, inline = false) {
|
||||
export function getDownloadURL(share: IFile, inline = false) {
|
||||
const params = {
|
||||
...(inline && { inline: "true" }),
|
||||
...(share.token && { token: share.token }),
|
||||
@ -75,3 +74,4 @@ export function getDownloadURL(share: IShare, inline = false) {
|
||||
|
||||
return createURL("api/public/dl/" + share.hash + share.path, params, false);
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { fetchURL, removePrefix } from "./utils";
|
||||
import url from "../utils/url";
|
||||
import type { Item } from "@/types";
|
||||
|
||||
export default async function search(base: string, query: string) {
|
||||
base = removePrefix(base);
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { ISettings } from "@/types";
|
||||
import { fetchURL, fetchJSON } from "./utils";
|
||||
|
||||
export function get() {
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import type { ApiUrl, IShare } from "@/types";
|
||||
import { fetchURL, fetchJSON, removePrefix, createURL } from "./utils";
|
||||
|
||||
export async function list() {
|
||||
return fetchJSON("/api/shares");
|
||||
}
|
||||
|
||||
export async function get(url: ApiUrl) {
|
||||
export async function get(url: string) {
|
||||
url = removePrefix(url);
|
||||
return fetchJSON(`/api/share${url}`);
|
||||
}
|
||||
@ -17,7 +16,7 @@ export async function remove(hash: string) {
|
||||
}
|
||||
|
||||
export async function create(
|
||||
url: ApiUrl,
|
||||
url: string,
|
||||
password = "",
|
||||
expires = "",
|
||||
unit = "hours"
|
||||
@ -41,6 +40,6 @@ export async function create(
|
||||
});
|
||||
}
|
||||
|
||||
export function getShareURL(share: IShare) {
|
||||
export function getShareURL(share: Share) {
|
||||
return createURL("share/" + share.hash, {}, false);
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ import { baseURL, tusEndpoint, tusSettings } from "@/utils/constants";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { removePrefix } from "@/api/utils";
|
||||
import { fetchURL } from "./utils";
|
||||
import type { ApiContent, TusSettings } from "@/types";
|
||||
|
||||
const RETRY_BASE_DELAY = 1000;
|
||||
const RETRY_MAX_DELAY = 20000;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { User } from "@/types/user";
|
||||
import { fetchURL, fetchJSON } from "./utils";
|
||||
|
||||
export async function getAll() {
|
||||
@ -9,7 +8,7 @@ export async function get(id: number) {
|
||||
return fetchJSON(`/api/users/${id}`, {});
|
||||
}
|
||||
|
||||
export async function create(user: User) {
|
||||
export async function create(user: IUser) {
|
||||
const res = await fetchURL(`/api/users`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
@ -24,7 +23,11 @@ export async function create(user: User) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
export async function update(user: User, which = ["all"]) {
|
||||
=======
|
||||
export async function update(user: IUser, which = ["all"]) {
|
||||
>>>>>>> vue3-bak
|
||||
await fetchURL(`/api/users/${user.id}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import type { ApiOpts, SearchParams } from "@/types";
|
||||
import { renew, logout } from "@/utils/auth";
|
||||
import { baseURL } from "@/utils/constants";
|
||||
import { encodePath } from "@/utils/url";
|
||||
|
||||
@ -74,10 +74,6 @@ import Commands from "./Commands.vue";
|
||||
import { enableExec } from "@/utils/constants";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import { IUser } from "@/types";
|
||||
>>>>>>> kloon15/vue3
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@ -86,15 +82,9 @@ const originalUserScope = ref<string | null>(null);
|
||||
|
||||
const props = defineProps<{
|
||||
user: IUser;
|
||||
<<<<<<< HEAD
|
||||
createUserDir: boolean;
|
||||
isNew: boolean;
|
||||
isDefault: boolean;
|
||||
=======
|
||||
isNew: boolean;
|
||||
isDefault: boolean;
|
||||
createUserDir?: boolean;
|
||||
>>>>>>> kloon15/vue3
|
||||
}>();
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@ -135,4 +135,4 @@ export const i18n = createI18n({
|
||||
legacy: true,
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
export default i18n;
|
||||
@ -1,4 +1,3 @@
|
||||
import type { IUser } from "@/types";
|
||||
import { defineStore } from "pinia";
|
||||
import dayjs from "dayjs";
|
||||
import i18n, { detectLocale } from "@/i18n";
|
||||
@ -19,29 +18,24 @@ export const useAuthStore = defineStore("auth", {
|
||||
},
|
||||
actions: {
|
||||
// no context as first argument, use `this` instead
|
||||
setUser(user: IUser | null) {
|
||||
if (user === null) {
|
||||
setUser(value: IUser) {
|
||||
if (value === null) {
|
||||
this.user = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const locale = user.locale || detectLocale();
|
||||
const locale = value.locale || detectLocale();
|
||||
dayjs.locale(locale);
|
||||
// according to doc u only need .value if legacy: false but they lied
|
||||
// according to doc u only need .value if legacy: false
|
||||
// in createI18n but they lied
|
||||
// https://vue-i18n.intlify.dev/guide/essentials/scope.html#local-scope-1
|
||||
//@ts-ignore
|
||||
i18n.global.locale.value = locale;
|
||||
this.user = user;
|
||||
i18n.global.locale = locale;
|
||||
this.user = value;
|
||||
},
|
||||
updateUser(user: Partial<IUser>) {
|
||||
if (user.locale) {
|
||||
dayjs.locale(user.locale);
|
||||
// see above
|
||||
//@ts-ignore
|
||||
i18n.global.locale.value = user.locale;
|
||||
}
|
||||
|
||||
this.user = { ...this.user, ...cloneDeep(user) } as IUser;
|
||||
updateUser(value: IUser) {
|
||||
if (typeof value !== "object" || !value) return;
|
||||
this.setUser(cloneDeep(value));
|
||||
},
|
||||
// easily reset state using `$reset`
|
||||
clearUser() {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { IFile } from "@/types";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useFileStore = defineStore("file", {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import type { LayoutValue } from "@/types";
|
||||
import { defineStore } from "pinia";
|
||||
// import { useAuthPreferencesStore } from "./auth-preferences";
|
||||
// import { useAuthEmailStore } from "./auth-email";
|
||||
|
||||
@ -3,7 +3,6 @@ import { useFileStore } from "./file";
|
||||
import { files as api } from "@/api";
|
||||
import throttle from "lodash/throttle";
|
||||
import buttons from "@/utils/buttons";
|
||||
import type { Item, Uploads } from "@/types";
|
||||
|
||||
// TODO: make this into a user setting
|
||||
const UPLOADS_LIMIT = 5;
|
||||
|
||||
25
frontend/src/types/api.d.ts
vendored
25
frontend/src/types/api.d.ts
vendored
@ -1,45 +1,38 @@
|
||||
export type ApiUrl = string; // Can also be set as a path eg: "path1" | "path2"
|
||||
type ApiMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
||||
|
||||
export type ApiMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
||||
|
||||
export type ApiContent =
|
||||
type ApiContent =
|
||||
| Blob
|
||||
| File
|
||||
| Pick<ReadableStreamDefaultReader<any>, "read">
|
||||
| "";
|
||||
|
||||
export interface ApiOpts {
|
||||
interface ApiOpts {
|
||||
method?: ApiMethod;
|
||||
headers?: object;
|
||||
body?: any;
|
||||
}
|
||||
|
||||
export interface TusSettings {
|
||||
interface TusSettings {
|
||||
retryCount: number;
|
||||
chunkSize: number;
|
||||
}
|
||||
|
||||
export type ChecksumAlgs = "md5" | "sha1" | "sha256" | "sha512";
|
||||
type ChecksumAlgs = "md5" | "sha1" | "sha256" | "sha512";
|
||||
|
||||
type inline = any;
|
||||
|
||||
<<<<<<< HEAD
|
||||
interface IShare {
|
||||
interface Share {
|
||||
expire: any;
|
||||
=======
|
||||
export interface IShare {
|
||||
>>>>>>> kloon15/vue3
|
||||
hash: string;
|
||||
path: string;
|
||||
expire?: any;
|
||||
userID?: number;
|
||||
token?: string;
|
||||
userID: number;
|
||||
token: string;
|
||||
}
|
||||
|
||||
interface settings {
|
||||
any;
|
||||
}
|
||||
|
||||
export interface SearchParams {
|
||||
interface SearchParams {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
10
frontend/src/types/file.d.ts
vendored
10
frontend/src/types/file.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
export interface IFile {
|
||||
interface IFile {
|
||||
index?: number;
|
||||
name: string;
|
||||
modified: string;
|
||||
@ -14,7 +14,7 @@ export interface IFile {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export type FileType =
|
||||
type FileType =
|
||||
| "video"
|
||||
| "audio"
|
||||
| "image"
|
||||
@ -37,17 +37,17 @@ type req = {
|
||||
hash: string;
|
||||
};
|
||||
|
||||
export interface Uploads {
|
||||
interface Uploads {
|
||||
[key: string]: Upload;
|
||||
}
|
||||
|
||||
export interface Upload {
|
||||
interface Upload {
|
||||
id: number;
|
||||
file: IFile;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Item {
|
||||
interface Item {
|
||||
id: number;
|
||||
url?: string;
|
||||
path: string;
|
||||
|
||||
6
frontend/src/types/index.d.ts
vendored
6
frontend/src/types/index.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export * from "./api";
|
||||
export * from "./file";
|
||||
export * from "./layout";
|
||||
export * from "./settings";
|
||||
export * from "./toast";
|
||||
export * from "./user";
|
||||
8
frontend/src/types/settings.d.ts
vendored
8
frontend/src/types/settings.d.ts
vendored
@ -1,6 +1,4 @@
|
||||
import type { Permissions } from "./user";
|
||||
|
||||
export interface ISettings {
|
||||
interface ISettings {
|
||||
signup: boolean;
|
||||
createUserDir: boolean;
|
||||
userHomeBasePath: string;
|
||||
@ -43,7 +41,7 @@ interface SettingsTus {
|
||||
retryCount: number;
|
||||
}
|
||||
|
||||
export interface SettingsCommand {
|
||||
interface SettingsCommand {
|
||||
after_copy?: string[];
|
||||
after_delete?: string[];
|
||||
after_rename?: string[];
|
||||
@ -56,7 +54,7 @@ export interface SettingsCommand {
|
||||
before_upload?: string[];
|
||||
}
|
||||
|
||||
export interface SettingsUnit {
|
||||
interface SettingsUnit {
|
||||
KB: number;
|
||||
MB: number;
|
||||
GB: number;
|
||||
|
||||
4
frontend/src/types/toast.d.ts
vendored
4
frontend/src/types/toast.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
export type IToastSuccess = (message: string) => void;
|
||||
export type IToastError = (
|
||||
type IToastSuccess = (message: string) => void;
|
||||
type IToastError = (
|
||||
error: Error | string,
|
||||
displayReport?: boolean
|
||||
) => void;
|
||||
|
||||
48
frontend/src/types/user.d.ts
vendored
48
frontend/src/types/user.d.ts
vendored
@ -1,16 +1,11 @@
|
||||
<<<<<<< HEAD
|
||||
type UserKey = keyof IUser;
|
||||
|
||||
interface IUser {
|
||||
=======
|
||||
export interface IUser {
|
||||
>>>>>>> kloon15/vue3
|
||||
id: number;
|
||||
username: string;
|
||||
password: string;
|
||||
scope: string;
|
||||
locale: string;
|
||||
<<<<<<< HEAD
|
||||
lockPassword: boolean;
|
||||
viewMode: string;
|
||||
singleClick: boolean;
|
||||
@ -36,45 +31,4 @@ interface UserPerm {
|
||||
interface UserSorting {
|
||||
by: string;
|
||||
asc: boolean;
|
||||
}
|
||||
=======
|
||||
perm: Permissions;
|
||||
commands: string[];
|
||||
rules: IRule[];
|
||||
lockPassword: boolean;
|
||||
hideDotfiles: boolean;
|
||||
singleClick: boolean;
|
||||
dateFormat: boolean;
|
||||
}
|
||||
|
||||
export 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;
|
||||
}
|
||||
|
||||
export interface UserSorting {
|
||||
by: string;
|
||||
asc: boolean;
|
||||
}
|
||||
|
||||
export interface IRule {
|
||||
allow: boolean;
|
||||
path: string;
|
||||
regex: boolean;
|
||||
regexp: IRegexp;
|
||||
}
|
||||
|
||||
interface IRegexp {
|
||||
raw: string;
|
||||
}
|
||||
>>>>>>> kloon15/vue3
|
||||
}
|
||||
@ -3,11 +3,10 @@ import router from "@/router";
|
||||
import jwt_decode from "jwt-decode";
|
||||
import { baseURL } from "./constants";
|
||||
import { StatusError } from "@/api/utils";
|
||||
import type { User } from "@/types";
|
||||
|
||||
export function parseToken(token: string) {
|
||||
// falsy or malformed jwt will throw InvalidTokenError
|
||||
const data = jwt_decode<{ [key: string]: any; user: User }>(token);
|
||||
const data = jwt_decode<{ [key: string]: any; user: IUser }>(token);
|
||||
|
||||
document.cookie = `auth=${token}; Path=/; SameSite=Strict;`;
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useUploadStore } from "@/stores/upload";
|
||||
import type { IFile, Item, FileType } from "@/types";
|
||||
import url from "@/utils/url";
|
||||
|
||||
export function checkConflict(files: IFile[], items: Item[]) {
|
||||
|
||||
@ -197,7 +197,6 @@ import { useLayoutStore } from "@/stores/layout";
|
||||
import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { IToastSuccess } from "@/types";
|
||||
|
||||
const error = ref<null | any>(null);
|
||||
const showLimit = ref<number>(100);
|
||||
@ -335,6 +334,7 @@ const download = () => {
|
||||
const linkSelected = () => {
|
||||
return isSingleFile() && req.value
|
||||
? api.getDownloadURL({
|
||||
...req.value,
|
||||
hash: hash.value,
|
||||
path: req.value.items[fileStore.selected[0]].path,
|
||||
})
|
||||
|
||||
@ -158,7 +158,6 @@
|
||||
<div class="card-content">
|
||||
<p class="small">{{ t("settings.defaultUserDescription") }}</p>
|
||||
|
||||
<!-- TODO: idk how to fix this ts error -->
|
||||
<user-form
|
||||
:isNew="false"
|
||||
:isDefault="true"
|
||||
@ -240,13 +239,6 @@ import Themes from "@/components/settings/Themes.vue";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
import { computed, inject, onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type {
|
||||
ISettings,
|
||||
IToastError,
|
||||
IToastSuccess,
|
||||
SettingsCommand,
|
||||
SettingsUnit,
|
||||
} from "@/types";
|
||||
|
||||
const error = ref<any>(null);
|
||||
const originalSettings = ref<ISettings | null>(null);
|
||||
@ -254,12 +246,12 @@ const settings = ref<ISettings | null>(null);
|
||||
const debounceTimeout = ref<number | null>(null);
|
||||
|
||||
const commandObject = ref<{
|
||||
[key in keyof SettingsCommand]: string[] | string;
|
||||
[key in keyof SettingsCommand]: string;
|
||||
}>({});
|
||||
const shellValue = ref<string>("");
|
||||
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess") as IToastSuccess;
|
||||
const $showError = inject<IToastError>("$showError") as IToastError;
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@ -312,7 +304,6 @@ const save = async () => {
|
||||
commands: {},
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
// @ts-ignore
|
||||
for (const name of Object.keys(settings.value.commands)) {
|
||||
// @ts-ignore
|
||||
@ -326,22 +317,6 @@ const save = async () => {
|
||||
} else {
|
||||
// @ts-ignore
|
||||
newSettings.commands[name] = newValue;
|
||||
=======
|
||||
const keys = Object.keys(settings.value.commands) as Array<
|
||||
keyof SettingsCommand
|
||||
>;
|
||||
for (const key of keys) {
|
||||
// not sure if we can safely assert non-null
|
||||
const newValue = commandObject.value[key];
|
||||
if (!newValue) continue;
|
||||
|
||||
if (Array.isArray(newValue)) {
|
||||
newSettings.commands[key] = newValue;
|
||||
} else if (key in commandObject.value) {
|
||||
newSettings.commands[key] = newValue
|
||||
.split("\n")
|
||||
.filter((cmd: string) => cmd !== "");
|
||||
>>>>>>> kloon15/vue3
|
||||
}
|
||||
}
|
||||
newSettings.shell = shellValue.value.split("\n");
|
||||
@ -396,20 +371,16 @@ onMounted(async () => {
|
||||
const original: ISettings = await api.get();
|
||||
let newSettings: ISettings = { ...original, commands: {} };
|
||||
|
||||
const keys = Object.keys(original.commands) as Array<keyof SettingsCommand>;
|
||||
for (const key in keys) {
|
||||
//@ts-ignore
|
||||
for (const key in original.commands) {
|
||||
// @ts-ignore
|
||||
newSettings.commands[key] = original.commands[key];
|
||||
//@ts-ignore
|
||||
// @ts-ignore
|
||||
commandObject.value[key] = original.commands[key].join("\n");
|
||||
}
|
||||
|
||||
originalSettings.value = original;
|
||||
settings.value = newSettings;
|
||||
<<<<<<< HEAD
|
||||
// @ts-ignore
|
||||
=======
|
||||
>>>>>>> kloon15/vue3
|
||||
shellValue.value = newSettings.shell.join("\n");
|
||||
} catch (e) {
|
||||
error.value = e;
|
||||
|
||||
@ -83,22 +83,13 @@ import Languages from "@/components/settings/Languages.vue";
|
||||
// import i18n, { rtlLanguages } from "@/i18n";
|
||||
import { inject, onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import type { IToastError, IToastSuccess } from "@/types";
|
||||
>>>>>>> kloon15/vue3
|
||||
|
||||
const layoutStore = useLayoutStore();
|
||||
const authStore = useAuthStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
<<<<<<< HEAD
|
||||
const $showError = inject("$showError") as TToast;
|
||||
const $showSuccess = inject("$showSuccess") as TToast;
|
||||
=======
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
>>>>>>> kloon15/vue3
|
||||
const $showSuccess = inject("$showSuccess") as IToastSuccess;
|
||||
const $showError = inject("$showError") as IToastError;
|
||||
|
||||
const password = ref<string>("");
|
||||
const passwordConf = ref<string>("");
|
||||
@ -147,7 +138,7 @@ const updatePassword = async (event: Event) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const data = { id: authStore.user.id, password: password.value };
|
||||
const data = {...authStore.user, id: authStore.user.id, password: password.value };
|
||||
await api.update(data, ["password"]);
|
||||
authStore.updateUser(data);
|
||||
$showSuccess(t("settings.passwordUpdated"));
|
||||
@ -162,6 +153,7 @@ const updateSettings = async (event: Event) => {
|
||||
if (authStore.user === null) throw "User is not set";
|
||||
|
||||
const data = {
|
||||
...authStore.user,
|
||||
id: authStore.user.id,
|
||||
locale: locale.value,
|
||||
hideDotfiles: hideDotfiles.value,
|
||||
|
||||
@ -71,16 +71,9 @@ import Clipboard from "clipboard";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
import { inject, onBeforeUnmount, ref, onMounted } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
<<<<<<< HEAD
|
||||
|
||||
const $showError = inject("$showError") as TToast;
|
||||
const $showSuccess = inject("$showSuccess") as TToast;
|
||||
=======
|
||||
import type { IShare, IToastError, IToastSuccess } from "@/types";
|
||||
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
>>>>>>> kloon15/vue3
|
||||
const $showError = inject("$showError") as IToastSuccess;
|
||||
const $showSuccess = inject("$showSuccess") as IToastError;
|
||||
const { t } = useI18n();
|
||||
|
||||
const layoutStore = useLayoutStore();
|
||||
@ -142,7 +135,7 @@ const humanTime = (time: number) => {
|
||||
return dayjs(time * 1000).fromNow();
|
||||
};
|
||||
|
||||
const buildLink = (share: IShare) => {
|
||||
const buildLink = (share: Share) => {
|
||||
return api.getShareURL(share);
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -75,31 +75,19 @@ import { useLayoutStore } from "@/stores/layout";
|
||||
import { users as api, settings } from "@/api";
|
||||
import UserForm from "@/components/settings/UserForm.vue";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
<<<<<<< HEAD
|
||||
// @ts-ignore
|
||||
import { cloneDeep } from "lodash-es";
|
||||
import { computed, inject, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
=======
|
||||
import { computed, inject, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { IToastError, IToastSuccess, IUser } from "@/types";
|
||||
>>>>>>> kloon15/vue3
|
||||
|
||||
const error = ref<any | null>(null);
|
||||
const originalUser = ref<IUser | null>(null);
|
||||
const user = ref<IUser | null>(null);
|
||||
const createUserDir = ref<boolean>(false);
|
||||
|
||||
<<<<<<< HEAD
|
||||
const $showError = inject("$showError") as TToast;
|
||||
const $showSuccess = inject("$showSuccess") as TToast;
|
||||
=======
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
>>>>>>> kloon15/vue3
|
||||
const $showError = inject("$showError") as IToastError;
|
||||
const $showSuccess = inject("$showSuccess") as IToastSuccess;
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const layoutStore = useLayoutStore();
|
||||
@ -133,8 +121,6 @@ const fetchData = async () => {
|
||||
rules: [],
|
||||
lockPassword: false,
|
||||
id: 0,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
};
|
||||
} else {
|
||||
const id = Array.isArray(route.params.id)
|
||||
@ -175,58 +161,8 @@ const save = async (event: Event) => {
|
||||
const newUser: IUser = {
|
||||
...originalUser.value,
|
||||
...user.value,
|
||||
>>>>>>> kloon15/vue3
|
||||
};
|
||||
} else {
|
||||
const id = Array.isArray(route.params.id)
|
||||
? route.params.id.join("")
|
||||
: route.params.id;
|
||||
user.value = { ...(await api.get(parseInt(id))) };
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = e;
|
||||
} finally {
|
||||
layoutStore.loading = false;
|
||||
}
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const deletePrompt = () => layoutStore.showHover("deleteUser");
|
||||
|
||||
const deleteUser = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
if (user.value === null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await api.remove(user.value.id);
|
||||
router.push({ path: "/settings/users" });
|
||||
$showSuccess(t("settings.userDeleted"));
|
||||
} catch (e: any) {
|
||||
e.message === "403" ? $showError(t("errors.forbidden")) : $showError(e);
|
||||
}
|
||||
};
|
||||
const save = async (event: Event) => {
|
||||
event.preventDefault();
|
||||
if (originalUser.value === null || user.value === null) {
|
||||
return false;
|
||||
}
|
||||
let newUser: IUser = {
|
||||
...originalUser.value,
|
||||
...user.value,
|
||||
};
|
||||
|
||||
try {
|
||||
if (isNew.value) {
|
||||
const loc = (await api.create(newUser)) as string;
|
||||
router.push({ path: loc });
|
||||
$showSuccess(t("settings.userCreated"));
|
||||
} else {
|
||||
await api.update(user);
|
||||
|
||||
if (user.value.id === authStore.user?.id) {
|
||||
authStore.setUser({ ...cloneDeep(user) });
|
||||
=======
|
||||
const loc = (await api.create(newUser)) as string;
|
||||
router.push({ path: loc });
|
||||
$showSuccess(t("settings.userCreated"));
|
||||
@ -235,7 +171,6 @@ const save = async (event: Event) => {
|
||||
|
||||
if (user.value.id === authStore.user?.id) {
|
||||
authStore.updateUser(user.value);
|
||||
>>>>>>> kloon15/vue3
|
||||
}
|
||||
|
||||
$showSuccess(t("settings.userUpdated"));
|
||||
|
||||
@ -47,10 +47,6 @@ import { users as api } from "@/api";
|
||||
import Errors from "@/views/Errors.vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import type { IUser } from "@/types";
|
||||
>>>>>>> kloon15/vue3
|
||||
|
||||
const error = ref<any>(null);
|
||||
const users = ref<IUser[]>([]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user