Modernize icons and file previews; add bounded ZIP directory viewer

This commit is contained in:
SantaSpeen committed 2026-10-22 14:24:50 +03:00
1 parent 9110c8a9d5
commit 2366035c72
67 files changed
+1657 -658

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
<header-bar v-if="showHeader" showMenu showLogo />
<h2 class="message">
<i class="material-icons">{{ info.icon }}</i>
<AppIcon :name="info.icon" />
<span>{{ t(info.message) }}</span>
</h2>
</div>
+6 -17
View File
@@ -67,24 +67,13 @@ const currentView = computed(() => {
if (fileStore.req.isDir) {
return FileListing;
} else if (
[".dcm", ".dicom", ".pdf"].includes(fileStore.req.extension.toLowerCase())
) {
return Preview;
} else if (fileStore.req.extension.toLowerCase() === ".csv") {
// CSV files use Preview for table view, unless ?edit=true
if (route.query.edit === "true") {
return Editor;
}
return Preview;
} else if (
fileStore.req.type === "text" ||
fileStore.req.type === "textImmutable"
) {
return Editor;
} else {
return Preview;
}
if (
route.query.edit === "true" &&
["text", "textImmutable"].includes(fileStore.req.type)
)
return Editor;
return Preview;
});
// Define hooks
+2 -2
View File
@@ -1,13 +1,13 @@
<template>
<main class="sso-welcome">
<div class="sso-symbol" aria-hidden="true">
<i class="material-icons">folder_open</i>
<AppIcon name="folder_open" />
</div>
<span class="eyebrow">FILE WORKSPACE</span>
<h1>{{ name }}</h1>
<p>{{ $t("sso.description") }}</p>
<button class="button sso-signin" @click="signIn">
<i class="material-icons">login</i>{{ $t("sso.signIn") }}
<AppIcon name="login" />{{ $t("sso.signIn") }}
</button>
</main>
</template>
+4 -8
View File
@@ -6,20 +6,16 @@
</div>
<div class="settings-tabs" :aria-label="t('sidebar.settings')">
<router-link to="/settings/profile"
><i class="material-icons">tune</i
>{{ t("settings.profileSettings") }}</router-link
><AppIcon name="tune" />{{ t("settings.profileSettings") }}</router-link
>
<router-link v-if="authStore.user?.perm.share" to="/settings/shares"
><i class="material-icons">link</i
>{{ t("settings.shareManagement") }}</router-link
><AppIcon name="link" />{{ t("settings.shareManagement") }}</router-link
>
<router-link v-if="authStore.user?.perm.admin" to="/settings/global"
><i class="material-icons">dns</i
>{{ t("settings.globalSettings") }}</router-link
><AppIcon name="dns" />{{ t("settings.globalSettings") }}</router-link
>
<router-link v-if="authStore.user?.perm.admin" to="/settings/users"
><i class="material-icons">group</i
>{{ t("settings.userManagement") }}</router-link
><AppIcon name="group" />{{ t("settings.userManagement") }}</router-link
>
</div>
<p v-if="layout.loading" role="status">{{ t("files.loading") }}</p>
+46 -76
View File
@@ -17,7 +17,7 @@
:data-title="t('buttons.copyDownloadLinkToClipboard')"
@click="copyToClipboard(linkSelected())"
>
<i class="material-icons">content_paste</i>
<AppIcon name="content_paste" />
</button>
<action
icon="check_circle"
@@ -74,72 +74,58 @@
<errors v-else :errorCode="error.status" />
</div>
<div v-else-if="req !== null">
<div class="share">
<div
class="share__box share__box__info"
style="
position: -webkit-sticky;
position: sticky;
top: -20.6em;
z-index: 999;
"
>
<div class="share__box__header" style="height: 3em">
<div
class="share"
:class="{
'share-with-preview': !!sharedPreview,
'share-directory': req.isDir,
}"
>
<section class="share__box share__box__info share-info">
<div class="share__box__header">
{{
req.isDir
? t("download.downloadFolder")
: t("download.downloadFile")
}}
</div>
<div
v-if="!req.isDir"
class="share__box__element share__box__center share__box__icon"
>
<i class="material-icons">{{ icon }}</i>
<div v-if="!req.isDir" class="share-file-symbol">
<FileIcon :name="req.name" />
</div>
<div class="share__box__element" style="height: 3em">
<strong>{{ $t("prompts.displayName") }}</strong> {{ req.name }}
</div>
<div v-if="!req.isDir" class="share__box__element" :title="modTime">
<strong>{{ $t("prompts.lastModified") }}:</strong> {{ humanTime }}
</div>
<div class="share__box__element" style="height: 3em">
<strong>{{ $t("prompts.size") }}:</strong> {{ humanSize }}
</div>
<div class="share__box__element share-download-actions">
<a :href="link" class="button share-download-primary">
<i class="material-icons" aria-hidden="true">file_download</i
><span>{{
<dl class="share-file-details">
<div>
<dt>{{ t("prompts.displayName") }}</dt>
<dd>{{ req.name }}</dd>
</div>
<div v-if="!req.isDir">
<dt>{{ t("prompts.lastModified") }}</dt>
<dd :title="modTime">{{ humanTime }}</dd>
</div>
<div>
<dt>{{ t("prompts.size") }}</dt>
<dd>{{ humanSize }}</dd>
</div>
</dl>
<div class="share-download-actions">
<a :href="link" class="button share-download-primary"
><AppIcon name="download" /><span>{{
req.isDir
? t("sso.downloadFolderZip")
: t("download.downloadFile")
}}</span>
</a>
<a
target="_blank"
:href="inlineLink"
class="button button--flat"
v-if="!req.isDir"
}}</span></a
>
<div>
<i class="material-icons">open_in_new</i
>{{ t("buttons.openFile") }}
</div>
</a>
</div>
</div>
</section>
<div
v-if="
!req.isDir &&
['.pdf', '.dcm', '.dicom'].includes(req.extension.toLowerCase())
"
v-if="sharedPreview"
class="share__box share__box__items public-document"
>
<PdfViewer
v-if="req.extension.toLowerCase() === '.pdf'"
<ResourcePreview
:source="inlineLink"
:name="req.name"
:type="req.type"
:size="req.size"
/>
<DicomViewer v-else :source="inlineLink" />
</div>
<div
id="shareList"
@@ -186,7 +172,7 @@
:aria-label="t('buttons.clear')"
class="action"
>
<i class="material-icons">clear</i>
<AppIcon name="clear" />
</div>
</div>
</div>
@@ -196,7 +182,7 @@
class="share__box share__box__items"
>
<h2 class="message">
<i class="material-icons">sentiment_dissatisfied</i>
<AppIcon name="sentiment_dissatisfied" />
<span>{{ t("files.lonely") }}</span>
</h2>
</div>
@@ -217,29 +203,18 @@ import Action from "@/components/header/Action.vue";
import Breadcrumbs from "@/components/Breadcrumbs.vue";
import Errors from "@/views/Errors.vue";
import Item from "@/components/files/ListingItem.vue";
import FileIcon from "@/components/files/FileIcon.vue";
import ResourcePreview from "@/components/files/ResourcePreview.vue";
import { previewKind } from "@/utils/preview";
import { useFileStore } from "@/stores/file";
import { useLayoutStore } from "@/stores/layout";
import {
computed,
defineAsyncComponent,
inject,
onMounted,
onBeforeUnmount,
ref,
watch,
} from "vue";
import { computed, inject, onMounted, onBeforeUnmount, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useI18n } from "vue-i18n";
import { StatusError } from "@/api/utils";
import { copy } from "@/utils/clipboard";
const error = ref<StatusError | null>(null);
const PdfViewer = defineAsyncComponent(
() => import("@/components/files/PdfViewer.vue")
);
const DicomViewer = defineAsyncComponent(
() => import("@/components/files/DicomViewer.vue")
);
const showLimit = ref<number>(100);
const password = ref<string>("");
const attemptedPasswordLogin = ref<boolean>(false);
@@ -264,18 +239,13 @@ watch(route, () => {
});
const req = computed(() => fileStore.req);
const sharedPreview = computed(
() =>
req.value && previewKind(req.value.name, req.value.type, req.value.isDir)
);
// Define computes
const icon = computed(() => {
if (req.value === null) return "insert_drive_file";
if (req.value.isDir) return "folder";
if (req.value.type === "image") return "insert_photo";
if (req.value.type === "audio") return "volume_up";
if (req.value.type === "video") return "movie";
return "insert_drive_file";
});
const link = computed(() => (req.value ? api.getDownloadURL(req.value) : ""));
const inlineLink = computed(() =>
req.value ? api.getDownloadURL(req.value, true) : ""
+4 -4
View File
@@ -49,19 +49,19 @@
:disabled="isSelectionEmpty"
@click="executeEditorCommand('copy')"
>
<span><i class="material-icons">content_copy</i></span>
<span><AppIcon name="content_copy" /></span>
</button>
<button
:disabled="isSelectionEmpty"
@click="executeEditorCommand('cut')"
>
<span><i class="material-icons">content_cut</i></span>
<span><AppIcon name="content_cut" /></span>
</button>
<button @click="executeEditorCommand('paste')">
<span><i class="material-icons">content_paste</i></span>
<span><AppIcon name="content_paste" /></span>
</button>
<button @click="executeEditorCommand('openCommandPalette')">
<span><i class="material-icons">more_vert</i></span>
<span><AppIcon name="more_vert" /></span>
</button>
</div>
</div>
+5 -5
View File
@@ -140,7 +140,7 @@
"
>
<h2 class="message">
<i class="material-icons">sentiment_dissatisfied</i>
<AppIcon name="sentiment_dissatisfied" />
<span>{{ t("files.lonely") }}</span>
</h2>
<input
@@ -181,7 +181,7 @@
:aria-label="t('files.sortByName')"
>
<span>{{ t("files.name") }}</span>
<i class="material-icons">{{ nameIcon }}</i>
<AppIcon :name="nameIcon" />
</p>
<p
@@ -194,7 +194,7 @@
:aria-label="t('files.sortBySize')"
>
<span>{{ t("files.size") }}</span>
<i class="material-icons">{{ sizeIcon }}</i>
<AppIcon :name="sizeIcon" />
</p>
<p
:class="{ active: modifiedSorted }"
@@ -206,7 +206,7 @@
:aria-label="t('files.sortByLastModified')"
>
<span>{{ t("files.lastModified") }}</span>
<i class="material-icons">{{ modifiedIcon }}</i>
<AppIcon :name="modifiedIcon" />
</p>
</div>
</div>
@@ -331,7 +331,7 @@
:aria-label="t('buttons.clear')"
class="action"
>
<i class="material-icons">clear</i>
<AppIcon name="clear" />
</div>
</div>
</div>
+58 -42
View File
@@ -6,7 +6,9 @@
@mousemove="toggleNavigation"
@touchstart="toggleNavigation"
>
<header-bar v-if="isPdf || isDicom || isEpub || isCsv || showNav">
<header-bar
v-if="isPdf || isDicom || isEpub || isCsv || isGenericPreview || showNav"
>
<action icon="close" :label="$t('buttons.close')" @action="close()" />
<title>{{ name }}</title>
<action
@@ -26,7 +28,11 @@
/>
<action
:disabled="layoutStore.loading"
v-if="isCsv && authStore.user?.perm.modify"
v-if="
(isCsv || isTextPreview) &&
['text', 'textImmutable'].includes(fileStore.req?.type || '') &&
authStore.user?.perm.modify
"
icon="edit_note"
:label="t('buttons.editAsText')"
@action="editAsText"
@@ -46,16 +52,6 @@
:label="$t('buttons.download')"
@action="download"
/>
<action
:disabled="layoutStore.loading"
v-if="
['image', 'audio', 'video'].includes(fileStore.req?.type || '') &&
authStore.user?.perm.download
"
icon="open_in_new"
:label="t('buttons.openDirect')"
@action="openDirect"
/>
<action
:disabled="layoutStore.loading"
icon="info"
@@ -73,8 +69,13 @@
</div>
</div>
<template v-else>
<div class="preview" :class="{ 'document-preview': isDicom || isPdf }">
<div v-if="isEpub" class="epub-reader">
<div
class="preview"
:class="{ 'document-preview': isDicom || isPdf || isGenericPreview }"
>
<PdfViewer v-if="isPdf" :source="previewUrl" />
<DicomViewer v-else-if="isDicom" :source="previewUrl" />
<div v-else-if="isEpub" class="epub-reader">
<vue-reader
:location="location"
:url="previewUrl"
@@ -83,7 +84,8 @@
requestCredentials: true,
}"
:epubOptions="{
allowPopups: true,
allowPopups: false,
allowScriptedContent: false,
}"
@update:location="locationChange"
/>
@@ -92,21 +94,29 @@
@click="changeSize(Math.max(100, size - 10))"
class="reader-button"
>
<i class="material-icons">remove</i>
<AppIcon name="remove" />
</button>
<button
@click="changeSize(Math.min(150, size + 10))"
class="reader-button"
>
<i class="material-icons">add</i>
<AppIcon name="add" />
</button>
<span>{{ size }}%</span>
</div>
</div>
<ResourcePreview
v-else-if="isGenericPreview"
:source="previewUrl"
:name="fileStore.req!.name"
:type="fileStore.req!.type"
:size="fileStore.req!.size"
/>
<CsvViewer v-else-if="isCsv" :content="csvContent" :error="csvError" />
<ExtendedImage
v-else-if="fileStore.req?.type == 'image'"
v-else-if="fileStore.req?.type == 'image' && !imageFailed"
:src="previewUrl"
@error="imageFailed = true"
/>
<audio
v-else-if="fileStore.req?.type == 'audio'"
@@ -124,29 +134,18 @@
:options="videoOptions"
>
</VideoPlayer>
<PdfViewer v-else-if="isPdf" :source="previewUrl" />
<DicomViewer v-else-if="isDicom" :source="previewUrl" />
<div v-else-if="fileStore.req?.type == 'blob'" class="info">
<div
v-else-if="fileStore.req?.type == 'blob' || imageFailed"
class="info"
>
<div class="title">
<i class="material-icons">feedback</i>
<FileIcon :name="fileStore.req?.name || ''" />
{{ $t("files.noPreview") }}
</div>
<div>
<a target="_blank" :href="downloadUrl" class="button button--flat">
<div>
<i class="material-icons">file_download</i
>{{ $t("buttons.download") }}
</div>
</a>
<a
target="_blank"
:href="previewUrl"
class="button button--flat"
v-if="!fileStore.req?.isDir"
>
<div>
<i class="material-icons">open_in_new</i
>{{ $t("buttons.openFile") }}
<AppIcon name="file_download" />{{ $t("buttons.download") }}
</div>
</a>
</div>
@@ -162,7 +161,7 @@
:aria-label="$t('buttons.previous')"
:title="$t('buttons.previous')"
>
<i class="material-icons">chevron_left</i>
<AppIcon name="chevron_left" />
</button>
<button
@click="next"
@@ -172,7 +171,7 @@
:aria-label="$t('buttons.next')"
:title="$t('buttons.next')"
>
<i class="material-icons">chevron_right</i>
<AppIcon name="chevron_right" />
</button>
<link rel="prefetch" :href="previousRaw" />
<link rel="prefetch" :href="nextRaw" />
@@ -195,6 +194,9 @@ import Action from "@/components/header/Action.vue";
import ExtendedImage from "@/components/files/ExtendedImage.vue";
import VideoPlayer from "@/components/files/VideoPlayer.vue";
import CsvViewer from "@/components/files/CsvViewer.vue";
import ResourcePreview from "@/components/files/ResourcePreview.vue";
import FileIcon from "@/components/files/FileIcon.vue";
import { previewKind } from "@/utils/preview";
import { VueReader } from "vue-reader";
import {
computed,
@@ -301,10 +303,6 @@ const downloadUrl = computed(() =>
fileStore.req ? api.getDownloadURL(fileStore.req, false) : ""
);
const directUrl = computed(() =>
fileStore.req ? api.getDownloadURL(fileStore.req, true) : ""
);
const previewUrl = computed(() => {
if (!fileStore.req) {
return "";
@@ -321,6 +319,25 @@ const previewUrl = computed(() => {
return api.getDownloadURL(fileStore.req, true);
});
const imageFailed = ref(false);
watch(
() => fileStore.req?.path,
() => (imageFailed.value = false)
);
const resourceKind = computed(() =>
previewKind(fileStore.req?.name || "", fileStore.req?.type)
);
const isGenericPreview = computed(
() =>
["text", "markdown", "tiff", "zip"].includes(resourceKind.value || "") ||
(resourceKind.value === "csv" && !isCsv.value) ||
(resourceKind.value === "image" && fileStore.req?.type !== "image") ||
(resourceKind.value === "audio" && fileStore.req?.type !== "audio") ||
(resourceKind.value === "video" && fileStore.req?.type !== "video")
);
const isTextPreview = computed(() =>
["text", "markdown"].includes(resourceKind.value || "")
);
const isPdf = computed(() => fileStore.req?.extension.toLowerCase() == ".pdf");
const isDicom = computed(() =>
[".dcm", ".dicom"].includes(fileStore.req?.extension.toLowerCase() || "")
@@ -513,7 +530,6 @@ const close = () => {
};
const download = () => window.open(downloadUrl.value);
const openDirect = () => window.open(directUrl.value);
const editAsText = () => {
router.push({ path: route.path, query: { edit: "true" } });
+6 -17
View File
@@ -7,9 +7,7 @@
>
<div class="settings-grid">
<section class="card settings-section">
<h2>
<i class="material-icons">palette</i>{{ t("preferences.appearance") }}
</h2>
<h2><AppIcon name="palette" />{{ t("preferences.appearance") }}</h2>
<label class="settings-field"
>{{ t("settings.instanceName")
}}<input class="input" type="text" v-model="settings.branding.name"
@@ -26,9 +24,7 @@
/></label>
</section>
<section class="card settings-section">
<h2>
<i class="material-icons">public</i>{{ t("preferences.publicPages") }}
</h2>
<h2><AppIcon name="public" />{{ t("preferences.publicPages") }}</h2>
<label class="settings-toggle"
><span>{{ t("settings.hideLoginButton") }}</span
><input type="checkbox" v-model="settings.hideLoginButton"
@@ -40,8 +36,7 @@
</section>
<section class="card settings-section">
<h2>
<i class="material-icons">folder_shared</i
>{{ t("preferences.homeFolders") }}
<AppIcon name="folder_shared" />{{ t("preferences.homeFolders") }}
</h2>
<label class="settings-toggle"
><span>{{ t("settings.createUserDir") }}</span
@@ -56,10 +51,7 @@
/></label>
</section>
<section class="card settings-section">
<h2>
<i class="material-icons">cloud_upload</i
>{{ t("settings.tusUploads") }}
</h2>
<h2><AppIcon name="cloud_upload" />{{ t("settings.tusUploads") }}</h2>
<label class="settings-field"
>{{ t("settings.tusUploadsChunkSize")
}}<input class="input" type="text" v-model="formattedChunkSize"
@@ -75,10 +67,7 @@
/></label>
</section>
<section class="card settings-section settings-wide">
<h2>
<i class="material-icons">person_add</i
>{{ t("settings.userDefaults") }}
</h2>
<h2><AppIcon name="person_add" />{{ t("settings.userDefaults") }}</h2>
<UserForm
:isNew="false"
:isDefault="true"
@@ -86,7 +75,7 @@
/>
</section>
<section class="card settings-section settings-wide">
<h2><i class="material-icons">policy</i>{{ t("settings.rules") }}</h2>
<h2><AppIcon name="policy" />{{ t("settings.rules") }}</h2>
<p class="field-hint">{{ t("settings.globalRules") }}</p>
<Rules v-model:rules="settings.rules" />
</section>
+5 -12
View File
@@ -9,15 +9,12 @@
</div>
</div>
<a class="button account-management" :href="baseURL + '/auth/account'"
>{{ t("preferences.manage")
}}<i class="material-icons">north_east</i></a
>
>{{ t("preferences.manage") }}<AppIcon name="north_east"
/></a>
</section>
<div class="settings-grid">
<section class="card settings-section">
<h2>
<i class="material-icons">palette</i>{{ t("preferences.appearance") }}
</h2>
<h2><AppIcon name="palette" />{{ t("preferences.appearance") }}</h2>
<label class="settings-field"
>{{ t("settings.themes.title")
}}<select
@@ -39,9 +36,7 @@
/></label>
</section>
<section class="card settings-section">
<h2>
<i class="material-icons">mouse</i>{{ t("preferences.behavior") }}
</h2>
<h2><AppIcon name="mouse" />{{ t("preferences.behavior") }}</h2>
<label class="settings-toggle"
><span>{{ t("settings.singleClick") }}</span
><input type="checkbox" v-model="singleClick"
@@ -52,9 +47,7 @@
/></label>
</section>
<section class="card settings-section settings-wide">
<h2>
<i class="material-icons">language</i>{{ t("preferences.regional") }}
</h2>
<h2><AppIcon name="language" />{{ t("preferences.regional") }}</h2>
<label class="settings-field"
>{{ t("settings.language")
}}<Languages class="input" v-model:locale="locale"
+4 -4
View File
@@ -64,7 +64,7 @@
:aria-label="t('sso.newLink')"
:title="t('sso.newLink')"
>
<i class="material-icons">add_link</i>
<AppIcon name="add_link" />
</button>
<button
class="action"
@@ -72,7 +72,7 @@
:aria-label="t('buttons.copyToClipboard')"
:title="t('buttons.copyToClipboard')"
>
<i class="material-icons">link</i>
<AppIcon name="link" />
</button>
<button
class="action share-link-delete"
@@ -81,7 +81,7 @@
:aria-label="t('buttons.delete')"
:title="t('buttons.delete')"
>
<i class="material-icons">delete_outline</i>
<AppIcon name="delete_outline" />
</button>
</div>
</td>
@@ -90,7 +90,7 @@
</table>
</div>
<h2 class="message" v-else>
<i class="material-icons">sentiment_dissatisfied</i>
<AppIcon name="sentiment_dissatisfied" />
<span>{{ t("files.lonely") }}</span>
</h2>
</div>
+2 -2
View File
@@ -28,8 +28,8 @@
:to="'/settings/users/' + user.id"
:title="t('buttons.update')"
:aria-label="t('buttons.update')"
><i class="material-icons">edit</i></router-link
>
><AppIcon name="edit"
/></router-link>
</td>
</tr>
</tbody>