Redesign file context menus and download archives using global preference

This commit is contained in:
SantaSpeen committed 2026-10-22 15:35:25 +03:00
1 parent 6aca927851
commit 042392f611
22 files changed
+530 -363

No files matched your search

+1 -1
View File
@@ -99,7 +99,7 @@ export function download(format: any, ...files: string[]) {
url += `algo=${format}&`;
}
window.open(url);
window.location.assign(url);
}
export async function post(
+1 -1
View File
@@ -62,7 +62,7 @@ export function download(
url += `token=${token}&`;
}
window.open(url);
window.location.assign(url);
}
export function getDownloadURL(res: Resource, inline = false) {
+90 -38
View File
@@ -1,47 +1,99 @@
<template>
<div
class="context-menu"
ref="contextMenu"
v-show="show"
:style="{
top: `${props.pos.y}px`,
left: `${left}px`,
}"
>
<slot />
</div>
<Teleport to="body">
<div
v-if="show"
ref="contextMenu"
class="context-menu"
role="menu"
tabindex="-1"
:style="{ top: top + 'px', left: left + 'px' }"
@click="hide"
@contextmenu.prevent.stop
@keydown="keyboard"
>
<slot />
</div>
</Teleport>
</template>
<script setup lang="ts">
import { ref, watch, computed, onUnmounted } from "vue";
import { ref, watch, nextTick, onBeforeUnmount } from "vue";
const emit = defineEmits(["hide"]);
const props = defineProps<{ show: boolean; pos: { x: number; y: number } }>();
const contextMenu = ref<HTMLElement | null>(null);
const left = computed(() => {
return Math.min(
props.pos.x,
window.innerWidth - (contextMenu.value?.clientWidth ?? 0)
const contextMenu = ref<HTMLElement | null>(null),
left = ref(0),
top = ref(0);
let previousFocus: HTMLElement | null = null;
const hide = () => emit("hide");
function outside(event: Event) {
if (
event.target instanceof Node &&
!contextMenu.value?.contains(event.target)
)
hide();
}
function keyboard(event: KeyboardEvent) {
const buttons = Array.from(
contextMenu.value?.querySelectorAll<HTMLButtonElement>(
"button:not(:disabled)"
) || []
);
});
const hideContextMenu = () => {
emit("hide");
};
watch(
() => props.show,
(val) => {
if (val) {
document.addEventListener("click", hideContextMenu);
} else {
document.removeEventListener("click", hideContextMenu);
}
const index = buttons.indexOf(document.activeElement as HTMLButtonElement);
if (event.key === "Escape") {
event.preventDefault();
event.stopPropagation();
hide();
previousFocus?.focus();
} else if (event.key === "Tab") hide();
else if (
["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key) &&
buttons.length
) {
event.preventDefault();
event.stopPropagation();
const next =
event.key === "Home"
? 0
: event.key === "End"
? buttons.length - 1
: (index + (event.key === "ArrowDown" ? 1 : -1) + buttons.length) %
buttons.length;
buttons[next].focus();
}
}
function removeListeners() {
document.removeEventListener("pointerdown", outside, true);
window.removeEventListener("scroll", outside, true);
window.removeEventListener("resize", hide);
}
watch(
[() => props.show, () => props.pos],
async ([visible]) => {
removeListeners();
if (!visible) return;
previousFocus =
document.activeElement instanceof HTMLElement
? document.activeElement
: null;
await nextTick();
if (!props.show || !contextMenu.value) return;
const rect = contextMenu.value.getBoundingClientRect();
left.value = Math.max(
8,
Math.min(props.pos.x, window.innerWidth - rect.width - 8)
);
top.value = Math.max(
8,
Math.min(props.pos.y, window.innerHeight - rect.height - 8)
);
const buttons =
contextMenu.value.querySelectorAll<HTMLButtonElement>("button");
buttons.forEach((button) => button.setAttribute("role", "menuitem"));
buttons[0]?.focus({ preventScroll: true });
document.addEventListener("pointerdown", outside, true);
window.addEventListener("scroll", outside, true);
window.addEventListener("resize", hide);
},
{ immediate: true }
);
onUnmounted(() => {
document.removeEventListener("click", hideContextMenu);
});
onBeforeUnmount(removeListeners);
</script>
@@ -26,6 +26,7 @@
</div>
<Action
v-if="!hideTheme"
icon="contrast"
:label="t('sso.toggleTheme')"
@action="toggleTheme"
@@ -59,6 +60,7 @@ import { useI18n } from "vue-i18n";
defineProps<{
showLogo?: boolean;
showMenu?: boolean;
hideTheme?: boolean;
}>();
const layoutStore = useLayoutStore();
@@ -1,42 +0,0 @@
<template>
<div class="card floating" id="download">
<div class="card-title">
<h2>{{ t("prompts.download") }}</h2>
</div>
<div class="card-content">
<p>{{ t("prompts.downloadMessage") }}</p>
<button
id="focus-prompt"
v-for="(ext, format) in formats"
:key="format"
class="button button--block"
@click="layoutStore.currentPrompt?.confirm(format)"
>
{{ ext }}
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { useLayoutStore } from "@/stores/layout";
const layoutStore = useLayoutStore();
const { t } = useI18n();
const formats = {
zip: "zip",
tar: "tar",
targz: "tar.gz",
tarbz2: "tar.bz2",
tarxz: "tar.xz",
tarlz4: "tar.lz4",
tarsz: "tar.sz",
tarbr: "tar.br",
tarzst: "tar.zst",
};
</script>
@@ -16,7 +16,6 @@ const Help = defineAsyncComponent(() => import("./Help.vue"));
const Info = defineAsyncComponent(() => import("./Info.vue"));
const Delete = defineAsyncComponent(() => import("./Delete.vue"));
const DeleteUser = defineAsyncComponent(() => import("./DeleteUser.vue"));
const Download = defineAsyncComponent(() => import("./Download.vue"));
const Rename = defineAsyncComponent(() => import("./Rename.vue"));
const Move = defineAsyncComponent(() => import("./Move.vue"));
const Copy = defineAsyncComponent(() => import("./Copy.vue"));
@@ -49,7 +48,6 @@ const components = new Map<string, any>([
["copy", Copy],
["newFile", NewFile],
["newDir", NewDir],
["download", Download],
["replace", Replace],
["share", Share],
["upload", Upload],
+102 -12
View File
@@ -1,21 +1,111 @@
.context-menu {
position: absolute;
position: fixed;
padding: 6px;
min-width: 230px;
max-width: min(300px, calc(100vw - 16px));
max-height: calc(100vh - 16px);
max-height: calc(100dvh - 16px);
overflow-y: auto;
border-radius: 12px;
background: var(--surfacePrimary);
min-width: 180px;
max-width: 220px;
border: 1px solid var(--borderSecondary);
box-shadow: 0 2px 4px var(--borderPrimary);
z-index: 999;
color: var(--textPrimary);
border: 1px solid var(--borderPrimary);
box-shadow: 0 12px 40px #0004;
z-index: 12000;
}
.context-menu .action {
display: block;
width: 100%;
border-radius: 0;
display: flex;
align-items: center;
gap: 12px;
width: 100%;
min-height: 38px;
padding: 8px 10px;
border-radius: 7px;
color: var(--textPrimary);
text-align: start;
font-size: 13px;
line-height: 1.4;
}
.context-menu .action .app-icon {
padding: 0;
width: 20px;
height: 20px;
font-size: 20px;
color: var(--textSecondary);
flex-shrink: 0;
}
.context-menu .action > span:not(.counter) {
flex: 1;
}
.context-menu .action:hover,
.context-menu .action:focus-visible {
background: var(--hover);
outline: none;
}
.context-menu .action:focus-visible {
box-shadow: inset 0 0 0 1px var(--blue);
}
.context-menu .context-danger,
.context-menu .context-danger .app-icon {
color: var(--red);
}
.context-menu .action .counter {
left: 1.75em;
position: static;
display: inline-block;
margin-inline-start: auto;
font-size: 10px;
flex-shrink: 0;
border: 0;
min-width: 20px;
height: 20px;
line-height: 20px;
}
.context-menu-separator {
height: 1px;
margin: 5px 6px;
background: var(--borderPrimary);
}
.file-listing-workspace {
min-height: calc(100vh - 5em);
}
.file-browser-header #search:not(.active) {
display: block;
flex: 1 1 520px;
min-width: 0;
max-width: 640px;
height: 40px;
margin-inline-start: auto;
}
.file-browser-header #dropdown {
display: none;
}
.workspace-actions-button {
background: var(--hover);
color: var(--textPrimary);
border: 1px solid var(--borderPrimary);
border-radius: 8px;
padding: 10px 12px;
margin-inline-start: 12px;
cursor: pointer;
font-size: 13px;
white-space: nowrap;
}
@media (max-width: 600px) {
.file-browser-header .workspace-brand {
display: none;
}
.file-browser-header #search:not(.active) {
flex-basis: 0;
}
.file-browser-header #search input {
min-width: 0;
font-size: 13px;
}
.workspace-actions-button {
margin-inline-start: 6px;
padding: 10px 8px;
}
.context-menu .action {
min-height: 42px;
}
}
-4
View File
@@ -252,10 +252,6 @@ body.rtl .card .card-action {
word-wrap: break-word;
}
.card#download {
max-width: 15em;
}
.card#share input,
.card#share select,
.card#share input::-webkit-inner-spin-button,
+9 -2
View File
@@ -282,7 +282,10 @@
"username": "Username",
"users": "Users",
"currentPassword": "Your Current Password",
"showPreviews": "Show previews"
"showPreviews": "Show previews",
"downloadsTitle": "Downloads",
"downloadArchiveFormat": "Archive format",
"downloadArchiveHint": "Folders and multiple selected files download immediately using this format. A single file downloads without an archive."
},
"sidebar": {
"diskUsed": "{used} of {total} used",
@@ -379,7 +382,11 @@
"pinCurrent": "Pin current folder",
"unpin": "Remove bookmark",
"folders": "Folders",
"retry": "Retry"
"retry": "Retry",
"actions": "Actions",
"paste": "Paste",
"refresh": "Refresh",
"downloadFolderArchive": "Download folder archive"
},
"preferences": {
"appearance": "Appearance",
+9 -2
View File
@@ -279,7 +279,10 @@
"username": "Имя пользователя",
"users": "Пользователи",
"currentPassword": "Your Current Password",
"showPreviews": "Показ превью"
"showPreviews": "Показ превью",
"downloadsTitle": "Скачивание",
"downloadArchiveFormat": "Формат архива",
"downloadArchiveHint": "Папки и несколько выбранных файлов скачиваются сразу в этом формате. Отдельный файл скачивается без архива."
},
"sidebar": {
"diskUsed": "Занято {used} из {total}",
@@ -376,7 +379,11 @@
"pinCurrent": "Закрепить текущую папку",
"unpin": "Убрать закладку",
"folders": "Папки",
"retry": "Повторить"
"retry": "Повторить",
"actions": "Действия",
"paste": "Вставить",
"refresh": "Обновить",
"downloadFolderArchive": "Скачать папку архивом"
},
"preferences": {
"appearance": "Внешний вид",
+1
View File
@@ -1,4 +1,5 @@
interface ISettings {
downloadArchiveFormat: string;
signup: boolean;
createUserDir: boolean;
hideLoginButton: boolean;
+4 -29
View File
@@ -110,7 +110,7 @@
<a :href="link" class="button share-download-primary"
><AppIcon name="download" /><span>{{
req.isDir
? t("sso.downloadFolderZip")
? t("explorer.downloadFolderArchive")
: t("download.downloadFile")
}}</span></a
>
@@ -322,34 +322,9 @@ const isSingleFile = () =>
const download = () => {
if (!req.value) return false;
if (isSingleFile()) {
api.download(
null,
hash.value,
token.value,
req.value.items[fileStore.selected[0]].path
);
return true;
}
layoutStore.showHover({
prompt: "download",
confirm: (format: DownloadFormat) => {
if (req.value === null) return false;
layoutStore.closeHovers();
const files: string[] = [];
for (const i of fileStore.selected) {
files.push(req.value.items[i].path);
}
api.download(format, hash.value, token.value, ...files);
return true;
},
});
const files = fileStore.selected.map((i) => req.value!.items[i].path);
if (!files.length) files.push(req.value.path);
api.download(null, hash.value, token.value, ...files);
return true;
};
+157 -223
View File
@@ -1,128 +1,21 @@
<template>
<div>
<header-bar showMenu showLogo>
<div class="file-listing-workspace" @contextmenu="showContextMenu">
<header-bar showMenu showLogo hideTheme class="file-browser-header">
<search />
<title />
<action
class="search-button"
icon="search"
:label="t('buttons.search')"
@action="openSearch()"
/>
<template #actions>
<template v-if="!isMobile">
<action
v-if="headerButtons.share"
icon="share"
:label="t('buttons.share')"
show="share"
/>
<action
v-if="headerButtons.rename"
icon="mode_edit"
:label="t('buttons.rename')"
show="rename"
/>
<action
v-if="headerButtons.copy"
id="copy-button"
icon="content_copy"
:label="t('buttons.copyFile')"
show="copy"
/>
<action
v-if="headerButtons.move"
id="move-button"
icon="forward"
:label="t('buttons.moveFile')"
show="move"
/>
<action
v-if="headerButtons.delete"
id="delete-button"
icon="delete"
:label="t('buttons.delete')"
show="delete"
/>
</template>
<action
v-if="headerButtons.shell"
icon="code"
:label="t('buttons.shell')"
@action="layoutStore.toggleShell"
/>
<action
:icon="viewIcon"
:label="t('buttons.switchView')"
@action="switchView"
/>
<action
v-if="headerButtons.download"
icon="file_download"
:label="t('buttons.download')"
@action="download"
:counter="fileStore.selectedCount"
/>
<action
v-if="headerButtons.upload"
icon="file_upload"
id="upload-button"
:label="t('buttons.upload')"
@action="uploadFunc"
/>
<action icon="info" :label="t('buttons.info')" show="info" />
<action
icon="check_circle"
:label="t('buttons.selectMultiple')"
@action="toggleMultipleSelection"
/>
</template>
<button
class="workspace-actions-button"
type="button"
aria-haspopup="menu"
:aria-expanded="isContextMenuVisible"
@click.stop="openActions"
>
{{ t("explorer.actions")
}}<span v-if="fileStore.selectedCount">
({{ fileStore.selectedCount }})</span
>
</button>
</header-bar>
<div
v-if="isMobile"
id="file-selection"
:class="{
'file-selection-margin-bottom': fileStore.multiple,
}"
>
<span v-if="fileStore.selectedCount > 0">
{{ t("prompts.filesSelected", fileStore.selectedCount) }}
</span>
<action
v-if="headerButtons.share"
icon="share"
:label="t('buttons.share')"
show="share"
/>
<action
v-if="headerButtons.rename"
icon="mode_edit"
:label="t('buttons.rename')"
show="rename"
/>
<action
v-if="headerButtons.copy"
icon="content_copy"
:label="t('buttons.copyFile')"
show="copy"
/>
<action
v-if="headerButtons.move"
icon="forward"
:label="t('buttons.moveFile')"
show="move"
/>
<action
v-if="headerButtons.delete"
icon="delete"
:label="t('buttons.delete')"
show="delete"
/>
</div>
<div v-if="layoutStore.loading">
<h2 class="message delayed">
<div class="spinner">
@@ -215,11 +108,7 @@
<h2 data-clear-on-click="true" v-if="fileStore.req?.numDirs ?? false">
{{ t("files.folders") }}
</h2>
<div
v-if="fileStore.req?.numDirs ?? false"
data-clear-on-click="true"
@contextmenu="showContextMenu"
>
<div v-if="fileStore.req?.numDirs ?? false" data-clear-on-click="true">
<item
v-for="item in dirs"
:key="base64(item.name)"
@@ -238,11 +127,7 @@
<h2 data-clear-on-click="true" v-if="fileStore.req?.numFiles ?? false">
{{ t("files.files") }}
</h2>
<div
v-if="fileStore.req?.numFiles ?? false"
data-clear-on-click="true"
@contextmenu="showContextMenu"
>
<div v-if="fileStore.req?.numFiles ?? false" data-clear-on-click="true">
<item
v-for="item in files"
:key="base64(item.name)"
@@ -257,53 +142,6 @@
>
</item>
</div>
<context-menu
:show="isContextMenuVisible"
:pos="contextMenuPos"
@hide="hideContextMenu"
>
<action
v-if="headerButtons.share"
icon="share"
:label="t('buttons.share')"
show="share"
/>
<action
v-if="headerButtons.rename"
icon="mode_edit"
:label="t('buttons.rename')"
show="rename"
/>
<action
v-if="headerButtons.copy"
id="copy-button"
icon="content_copy"
:label="t('buttons.copyFile')"
show="copy"
/>
<action
v-if="headerButtons.move"
id="move-button"
icon="forward"
:label="t('buttons.moveFile')"
show="move"
/>
<action
v-if="headerButtons.delete"
id="delete-button"
icon="delete"
:label="t('buttons.delete')"
show="delete"
/>
<action
v-if="headerButtons.download"
icon="file_download"
:label="t('buttons.download')"
@action="download"
:counter="fileStore.selectedCount"
/>
<action icon="info" :label="t('buttons.info')" show="info" />
</context-menu>
<input
style="display: none"
@@ -336,6 +174,106 @@
</div>
</div>
</template>
<context-menu
:show="isContextMenuVisible"
:pos="contextMenuPos"
@hide="hideContextMenu"
>
<action
v-if="headerButtons.share"
icon="share"
:label="t('buttons.share')"
show="share"
/>
<action
v-if="headerButtons.rename"
icon="mode_edit"
:label="t('buttons.rename')"
show="rename"
/>
<action
v-if="headerButtons.copy"
id="copy-button"
icon="content_copy"
:label="t('buttons.copyFile')"
show="copy"
/>
<action
v-if="headerButtons.move"
id="move-button"
icon="forward"
:label="t('buttons.moveFile')"
show="move"
/>
<action
v-if="headerButtons.delete"
id="delete-button"
class="context-danger"
icon="delete"
:label="t('buttons.delete')"
show="delete"
/>
<action
v-if="headerButtons.download"
icon="file_download"
:label="t('buttons.download')"
@action="download"
:counter="fileStore.selectedCount"
/>
<div class="context-menu-separator" v-if="fileStore.selectedCount" />
<action
v-if="authStore.user?.perm.create"
icon="create_new_folder"
:label="t('sidebar.newFolder')"
show="newDir"
/>
<action
v-if="authStore.user?.perm.create"
icon="note_add"
:label="t('sidebar.newFile')"
show="newFile"
/>
<action
v-if="headerButtons.upload"
icon="upload"
:label="t('buttons.upload')"
@action="uploadFunc"
/>
<action
v-if="canPaste"
icon="paste"
:label="t('explorer.paste')"
@action="pasteFromMenu"
/>
<div class="context-menu-separator" />
<action
:icon="viewIcon"
:label="t('buttons.switchView')"
@action="switchView"
/>
<action
icon="check_circle"
:label="t('buttons.selectMultiple')"
@action="toggleMultipleSelection"
/>
<action
icon="refresh"
:label="t('explorer.refresh')"
@action="refreshFolder"
/>
<action
v-if="headerButtons.shell"
icon="code"
:label="t('buttons.shell')"
@action="layoutStore.toggleShell"
/>
<action
icon="contrast"
:label="t('sso.toggleTheme')"
@action="toggleTheme"
/>
<action icon="info" :label="t('buttons.info')" show="info" />
</context-menu>
</div>
</template>
@@ -346,6 +284,7 @@ import { useFileStore } from "@/stores/file";
import { useLayoutStore } from "@/stores/layout";
import { users, files as api } from "@/api";
import { toggleTheme } from "@/utils/theme";
import { enableExec } from "@/utils/constants";
import * as upload from "@/utils/upload";
import buttons from "@/utils/buttons";
@@ -375,7 +314,7 @@ import { removePrefix } from "@/api/utils";
const showLimit = ref<number>(50);
const columnWidth = ref<number>(280);
const dragCounter = ref<number>(0);
const width = ref<number>(window.innerWidth);
const itemWeight = ref<number>(0);
const isContextMenuVisible = ref<boolean>(false);
const contextMenuPos = ref<{ x: number; y: number }>({ x: 0, y: 0 });
@@ -490,10 +429,6 @@ const headerButtons = computed(() => {
};
});
const isMobile = computed(() => {
return width.value <= 736;
});
watch(req, () => {
// Reset the show value
showLimit.value = 50;
@@ -611,7 +546,7 @@ const keyEvent = (event: KeyboardEvent) => {
break;
case "s":
event.preventDefault();
document.getElementById("download-button")?.click();
if (authStore.user?.perm.download) download();
break;
}
};
@@ -622,7 +557,11 @@ const preventDefault = (event: Event) => {
};
const copyCut = (event: Event | KeyboardEvent): void => {
if ((event.target as HTMLElement).tagName?.toLowerCase() === "input") return;
if (
event.target instanceof HTMLElement &&
event.target.closest("input, textarea, [contenteditable=true]")
)
return;
if (fileStore.req === null) return;
@@ -650,7 +589,11 @@ const copyCut = (event: Event | KeyboardEvent): void => {
};
const paste = async (event: Event) => {
if ((event.target as HTMLElement).tagName?.toLowerCase() === "input") return;
if (
event.target instanceof HTMLElement &&
event.target.closest("input, textarea, [contenteditable=true]")
)
return;
// TODO router location should it be
const items: any[] = [];
@@ -961,10 +904,6 @@ const sort = async (by: string) => {
fileStore.reload = true;
};
const openSearch = () => {
layoutStore.showHover("search");
};
const toggleMultipleSelection = () => {
fileStore.toggleMultiple();
layoutStore.closeHovers();
@@ -972,7 +911,6 @@ const toggleMultipleSelection = () => {
const windowsResize = throttle(() => {
columnsResize();
width.value = window.innerWidth;
// Listing element is not displayed
if (listing.value == null) return;
@@ -985,34 +923,11 @@ const windowsResize = throttle(() => {
}, 100);
const download = () => {
if (fileStore.req === null) return;
if (
fileStore.selectedCount === 1 &&
!fileStore.req.items[fileStore.selected[0]].isDir
) {
api.download(null, fileStore.req.items[fileStore.selected[0]].url);
return;
}
layoutStore.showHover({
prompt: "download",
confirm: (format: any) => {
layoutStore.closeHovers();
const files = [];
if (fileStore.selectedCount > 0 && fileStore.req !== null) {
for (const i of fileStore.selected) {
files.push(fileStore.req.items[i].url);
}
} else {
files.push(route.path);
}
api.download(format, ...files);
},
});
if (!fileStore.req || !authStore.user?.perm.download) return;
const files = fileStore.selectedCount
? fileStore.selected.map((i) => fileStore.req!.items[i].url)
: [route.path];
api.download(null, ...files);
};
const switchView = async () => {
@@ -1099,13 +1014,32 @@ const revealPreviousItem = () => {
return true;
};
const canPaste = computed(
() =>
!!authStore.user?.perm.create &&
clipboardStore.items.length > 0 &&
(clipboardStore.key !== "x" || !!authStore.user?.perm.rename)
);
const pasteFromMenu = () => paste(new Event("paste"));
const refreshFolder = () => {
fileStore.reload = true;
};
const openActions = (event: MouseEvent) => {
const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();
contextMenuPos.value = { x: rect.right, y: rect.bottom + 6 };
isContextMenuVisible.value = !isContextMenuVisible.value;
};
const showContextMenu = (event: MouseEvent) => {
const target = event.target;
if (
!(target instanceof Element) ||
target.closest("header, .context-menu, input, textarea")
)
return;
event.preventDefault();
if (!target.closest(".item:not(.header)")) fileStore.selected = [];
isContextMenuVisible.value = true;
contextMenuPos.value = {
x: event.clientX + 8,
y: event.clientY + Math.floor(window.scrollY),
};
contextMenuPos.value = { x: event.clientX, y: event.clientY };
};
const hideContextMenu = () => {
+2 -2
View File
@@ -143,7 +143,7 @@
{{ $t("files.noPreview") }}
</div>
<div>
<a target="_blank" :href="downloadUrl" class="button button--flat">
<a :href="downloadUrl" class="button button--flat">
<div>
<AppIcon name="file_download" />{{ $t("buttons.download") }}
</div>
@@ -529,7 +529,7 @@ const close = () => {
router.push({ path: uri });
};
const download = () => window.open(downloadUrl.value);
const download = () => window.location.assign(downloadUrl.value);
const editAsText = () => {
router.push({ path: route.path, query: { edit: "true" } });
+27
View File
@@ -6,6 +6,22 @@
@submit.prevent="save"
>
<div class="settings-grid">
<section class="card settings-section">
<h2><AppIcon name="archive" />{{ t("settings.downloadsTitle") }}</h2>
<label class="settings-field"
>{{ t("settings.downloadArchiveFormat") }}
<select class="input" v-model="settings.downloadArchiveFormat">
<option
v-for="(label, value) in archiveFormats"
:key="value"
:value="value"
>
{{ label }}
</option>
</select>
</label>
<p class="field-hint">{{ t("settings.downloadArchiveHint") }}</p>
</section>
<section class="card settings-section">
<h2><AppIcon name="palette" />{{ t("preferences.appearance") }}</h2>
<label class="settings-field"
@@ -103,6 +119,17 @@
</form>
</template>
<script setup lang="ts">
const archiveFormats = {
zip: "ZIP",
tar: "TAR",
targz: "TAR.GZ",
tarbz2: "TAR.BZ2",
tarxz: "TAR.XZ",
tarlz4: "TAR.LZ4",
tarsz: "TAR.SZ",
tarbr: "TAR.BR",
tarzst: "TAR.ZST",
};
import { settings as api } from "@/api";
import { StatusError } from "@/api/utils";
import Rules from "@/components/settings/Rules.vue";