mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-07-17 16:36:49 +00:00
feat: add 'Open direct' button to images (#5678)
This commit is contained in:
parent
95e6ed75a7
commit
804b14b698
2 changed files with 16 additions and 0 deletions
|
|
@ -42,6 +42,7 @@
|
|||
"update": "Update",
|
||||
"upload": "Upload",
|
||||
"openFile": "Open file",
|
||||
"openDirect": "View raw",
|
||||
"discardChanges": "Discard",
|
||||
"stopSearch": "Stop searching",
|
||||
"saveChanges": "Save changes",
|
||||
|
|
|
|||
|
|
@ -46,6 +46,16 @@
|
|||
: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"
|
||||
|
|
@ -277,6 +287,10 @@ 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 "";
|
||||
|
|
@ -470,6 +484,7 @@ const close = () => {
|
|||
};
|
||||
|
||||
const download = () => window.open(downloadUrl.value);
|
||||
const openDirect = () => window.open(directUrl.value);
|
||||
|
||||
const editAsText = () => {
|
||||
router.push({ path: route.path, query: { edit: "true" } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue