Use Kloon15 changes which apperantly disappeard
This commit is contained in:
parent
24dd6b4fa1
commit
a70bf08889
6
frontend/src/types/api.d.ts
vendored
6
frontend/src/types/api.d.ts
vendored
@ -22,11 +22,11 @@ type ChecksumAlgs = "md5" | "sha1" | "sha256" | "sha512";
|
||||
type inline = any;
|
||||
|
||||
interface Share {
|
||||
expire: any;
|
||||
hash: string;
|
||||
path: string;
|
||||
userID: number;
|
||||
token: string;
|
||||
expire?: any;
|
||||
userID?: number;
|
||||
token?: string;
|
||||
}
|
||||
|
||||
interface settings {
|
||||
|
||||
37
frontend/src/types/user.d.ts
vendored
37
frontend/src/types/user.d.ts
vendored
@ -1,34 +1,45 @@
|
||||
type UserKey = keyof IUser;
|
||||
|
||||
interface IUser {
|
||||
id: number;
|
||||
username: string;
|
||||
password: string;
|
||||
scope: string;
|
||||
locale: string;
|
||||
perm: Permissions;
|
||||
commands: string[];
|
||||
rules: IRule[];
|
||||
lockPassword: boolean;
|
||||
viewMode: string;
|
||||
singleClick: boolean;
|
||||
perm: UserPerm;
|
||||
commands: any[];
|
||||
sorting: UserSorting;
|
||||
rules: any[];
|
||||
hideDotfiles: boolean;
|
||||
singleClick: boolean;
|
||||
dateFormat: boolean;
|
||||
}
|
||||
|
||||
interface UserPerm {
|
||||
interface Permissions {
|
||||
admin: boolean;
|
||||
execute: boolean;
|
||||
copy: boolean;
|
||||
create: boolean;
|
||||
rename: boolean;
|
||||
modify: boolean;
|
||||
delete: boolean;
|
||||
share: boolean;
|
||||
download: boolean;
|
||||
execute: boolean;
|
||||
modify: boolean;
|
||||
move: boolean;
|
||||
rename: boolean;
|
||||
share: boolean;
|
||||
shell: boolean;
|
||||
upload: boolean;
|
||||
}
|
||||
|
||||
interface UserSorting {
|
||||
by: string;
|
||||
asc: boolean;
|
||||
}
|
||||
|
||||
interface IRule {
|
||||
allow: boolean;
|
||||
path: string;
|
||||
regex: boolean;
|
||||
regexp: IRegexp;
|
||||
}
|
||||
|
||||
interface IRegexp {
|
||||
raw: string;
|
||||
}
|
||||
@ -158,6 +158,7 @@
|
||||
<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"
|
||||
@ -246,12 +247,12 @@ const settings = ref<ISettings | null>(null);
|
||||
const debounceTimeout = ref<number | null>(null);
|
||||
|
||||
const commandObject = ref<{
|
||||
[key in keyof SettingsCommand]: string;
|
||||
[key in keyof SettingsCommand]: string[] | string;
|
||||
}>({});
|
||||
const shellValue = ref<string>("");
|
||||
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess") as IToastSuccess;
|
||||
const $showError = inject<IToastError>("$showError") as IToastError;
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
const $showSuccess = inject<IToastSuccess>("$showSuccess")!;
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@ -304,19 +305,20 @@ const save = async () => {
|
||||
commands: {},
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
for (const name of Object.keys(settings.value.commands)) {
|
||||
// @ts-ignore
|
||||
const newValue = commandObject.value[name];
|
||||
// @ts-ignore
|
||||
if (name in commandObject.value && !Array.isArray(newValue)) {
|
||||
// @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 !== "");
|
||||
} else {
|
||||
// @ts-ignore
|
||||
newSettings.commands[name] = newValue;
|
||||
}
|
||||
}
|
||||
newSettings.shell = shellValue.value.split("\n");
|
||||
@ -371,16 +373,16 @@ onMounted(async () => {
|
||||
const original: ISettings = await api.get();
|
||||
let newSettings: ISettings = { ...original, commands: {} };
|
||||
|
||||
for (const key in original.commands) {
|
||||
// @ts-ignore
|
||||
const keys = Object.keys(original.commands) as Array<keyof SettingsCommand>;
|
||||
for (const key in keys) {
|
||||
//@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;
|
||||
// @ts-ignore
|
||||
shellValue.value = newSettings.shell.join("\n");
|
||||
} catch (e) {
|
||||
error.value = e;
|
||||
@ -395,4 +397,4 @@ onBeforeUnmount(() => {
|
||||
clearTimeout(debounceTimeout.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user