fix: redesign share management and remove public QR codes
This commit is contained in:
1 parent
618fccd7bb
commit
5dda0dc5f3
5 files changed
+156
-55
No files matched your search
@@ -1,4 +1,92 @@
|
|||||||
/* Lightweight workspace: system fonts, solid surfaces, no blur or filter layers. */
|
/* Lightweight workspace: system fonts, solid surfaces, no blur or filter layers. */
|
||||||
|
.dashboard .row.share-management > .column {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.share-management .card {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.managed-shares {
|
||||||
|
display: grid;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
.managed-share {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 18px;
|
||||||
|
border: 1px solid var(--borderPrimary);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--background);
|
||||||
|
}
|
||||||
|
.managed-share-heading {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 18px;
|
||||||
|
}
|
||||||
|
.managed-share-file {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.managed-share-path {
|
||||||
|
display: block;
|
||||||
|
color: var(--textSecondary);
|
||||||
|
font-weight: 600;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
.managed-share-key {
|
||||||
|
display: block;
|
||||||
|
color: var(--textPrimary);
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 6px;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
.managed-share .share-link-actions {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.managed-share-meta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 14px 32px;
|
||||||
|
margin: 18px 0 0;
|
||||||
|
padding-top: 14px;
|
||||||
|
border-top: 1px solid var(--borderPrimary);
|
||||||
|
}
|
||||||
|
.managed-share-meta > div {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.managed-share-meta dt {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--textPrimary);
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
.managed-share-meta dd {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--textSecondary);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
.managed-share-meta i {
|
||||||
|
font-size: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.managed-share {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
.managed-share-heading {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.managed-share-file {
|
||||||
|
flex-basis: 100%;
|
||||||
|
}
|
||||||
|
.managed-share .share-link-actions {
|
||||||
|
margin-inline-start: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
.user-record-id {
|
.user-record-id {
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--textPrimary);
|
color: var(--textPrimary);
|
||||||
|
|||||||
@@ -129,15 +129,6 @@
|
|||||||
>{{ t("buttons.openFile") }}
|
>{{ t("buttons.openFile") }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<qrcode-vue
|
|
||||||
v-if="req.isDir"
|
|
||||||
:value="link"
|
|
||||||
:size="100"
|
|
||||||
level="M"
|
|
||||||
></qrcode-vue>
|
|
||||||
</div>
|
|
||||||
<div v-if="!req.isDir" class="share__box__element share__box__center">
|
|
||||||
<qrcode-vue :value="link" :size="200" level="M"></qrcode-vue>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="req.isDir"
|
v-if="req.isDir"
|
||||||
@@ -311,7 +302,6 @@ import HeaderBar from "@/components/header/HeaderBar.vue";
|
|||||||
import Action from "@/components/header/Action.vue";
|
import Action from "@/components/header/Action.vue";
|
||||||
import Breadcrumbs from "@/components/Breadcrumbs.vue";
|
import Breadcrumbs from "@/components/Breadcrumbs.vue";
|
||||||
import Errors from "@/views/Errors.vue";
|
import Errors from "@/views/Errors.vue";
|
||||||
import QrcodeVue from "qrcode.vue";
|
|
||||||
import Item from "@/components/files/ListingItem.vue";
|
import Item from "@/components/files/ListingItem.vue";
|
||||||
import { useFileStore } from "@/stores/file";
|
import { useFileStore } from "@/stores/file";
|
||||||
import { useLayoutStore } from "@/stores/layout";
|
import { useLayoutStore } from "@/stores/layout";
|
||||||
|
|||||||
@@ -1,57 +1,70 @@
|
|||||||
<template>
|
<template>
|
||||||
<errors v-if="error" :errorCode="error.status" />
|
<errors v-if="error" :errorCode="error.status" />
|
||||||
<div class="row" v-else-if="!layoutStore.loading">
|
<div class="row share-management" v-else-if="!layoutStore.loading">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
<h2>{{ t("settings.shareManagement") }}</h2>
|
<h2>{{ t("settings.shareManagement") }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-content full" v-if="links.length > 0">
|
<div class="card-content managed-shares" v-if="links.length > 0">
|
||||||
<table>
|
<article v-for="link in links" :key="link.hash" class="managed-share">
|
||||||
<tr>
|
<div class="managed-share-heading">
|
||||||
<th>{{ t("settings.path") }}</th>
|
<div class="managed-share-file">
|
||||||
<th>{{ t("settings.shareDuration") }}</th>
|
<a
|
||||||
<th v-if="authStore.user?.perm.admin">
|
:href="buildLink(link)"
|
||||||
{{ t("settings.username") }}
|
target="_blank"
|
||||||
</th>
|
rel="noopener noreferrer"
|
||||||
<th></th>
|
class="managed-share-path"
|
||||||
<th></th>
|
>{{ link.path }}</a
|
||||||
</tr>
|
>
|
||||||
|
<a
|
||||||
<tr v-for="link in links" :key="link.hash">
|
:href="buildLink(link)"
|
||||||
<td>
|
target="_blank"
|
||||||
<a :href="buildLink(link)" target="_blank">{{ link.path }}</a>
|
rel="noopener noreferrer"
|
||||||
</td>
|
class="managed-share-key"
|
||||||
<td>
|
>/s/{{ link.hash }}</a
|
||||||
<template v-if="link.expire !== 0">{{
|
>
|
||||||
humanTime(link.expire)
|
</div>
|
||||||
}}</template>
|
<div class="share-link-actions">
|
||||||
<template v-else>{{ t("permanent") }}</template>
|
|
||||||
</td>
|
|
||||||
<td v-if="authStore.user?.perm.admin">{{ link.username }}</td>
|
|
||||||
<td class="small">
|
|
||||||
<button
|
<button
|
||||||
class="action"
|
class="action"
|
||||||
|
@click="copyToClipboard(buildLink(link))"
|
||||||
|
:aria-label="t('buttons.copyToClipboard')"
|
||||||
|
:title="t('buttons.copyToClipboard')"
|
||||||
|
>
|
||||||
|
<i class="material-icons">link</i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="action share-link-delete"
|
||||||
@click="deleteLink($event, link)"
|
@click="deleteLink($event, link)"
|
||||||
|
:disabled="deleting === link.hash"
|
||||||
:aria-label="t('buttons.delete')"
|
:aria-label="t('buttons.delete')"
|
||||||
:title="t('buttons.delete')"
|
:title="t('buttons.delete')"
|
||||||
>
|
>
|
||||||
<i class="material-icons">delete</i>
|
<i class="material-icons">delete_outline</i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</div>
|
||||||
<td class="small">
|
</div>
|
||||||
<button
|
<dl class="managed-share-meta">
|
||||||
class="action copy-clipboard"
|
<div>
|
||||||
:aria-label="t('buttons.copyToClipboard')"
|
<dt>{{ t("settings.shareDuration") }}</dt>
|
||||||
:title="t('buttons.copyToClipboard')"
|
<dd>
|
||||||
@click="copyToClipboard(buildLink(link))"
|
{{ link.expire ? humanTime(link.expire) : t("permanent") }}
|
||||||
>
|
</dd>
|
||||||
<i class="material-icons">content_paste</i>
|
</div>
|
||||||
</button>
|
<div v-if="authStore.user?.perm.admin">
|
||||||
</td>
|
<dt>{{ t("settings.username") }}</dt>
|
||||||
</tr>
|
<dd>
|
||||||
</table>
|
{{ link.username || t("settings.user") + " #" + link.userID }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div v-if="link.hasPassword">
|
||||||
|
<dt>{{ t("login.password") }}</dt>
|
||||||
|
<dd><i class="material-icons" aria-hidden="true">lock</i></dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</article>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="message" v-else>
|
<h2 class="message" v-else>
|
||||||
<i class="material-icons">sentiment_dissatisfied</i>
|
<i class="material-icons">sentiment_dissatisfied</i>
|
||||||
@@ -82,6 +95,7 @@ const authStore = useAuthStore();
|
|||||||
|
|
||||||
const error = ref<StatusError | null>(null);
|
const error = ref<StatusError | null>(null);
|
||||||
const links = ref<Share[]>([]);
|
const links = ref<Share[]>([]);
|
||||||
|
const deleting = ref<string | null>(null);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
layoutStore.loading = true;
|
layoutStore.loading = true;
|
||||||
@@ -91,7 +105,13 @@ onMounted(async () => {
|
|||||||
if (authStore.user?.perm.admin) {
|
if (authStore.user?.perm.admin) {
|
||||||
const userMap = new Map<number, string>();
|
const userMap = new Map<number, string>();
|
||||||
for (const user of await users.getAll())
|
for (const user of await users.getAll())
|
||||||
userMap.set(user.id, user.username);
|
userMap.set(
|
||||||
|
user.id,
|
||||||
|
user.displayName ||
|
||||||
|
(user.username.startsWith("sso:")
|
||||||
|
? `${t("settings.user")} #${user.id}`
|
||||||
|
: user.username)
|
||||||
|
);
|
||||||
for (const link of newLinks) {
|
for (const link of newLinks) {
|
||||||
if (link.userID && userMap.has(link.userID))
|
if (link.userID && userMap.has(link.userID))
|
||||||
link.username = userMap.get(link.userID);
|
link.username = userMap.get(link.userID);
|
||||||
@@ -129,22 +149,25 @@ const copyToClipboard = (text: string) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteLink = async (event: Event, link: any) => {
|
const deleteLink = async (event: Event, link: Share) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
layoutStore.showHover({
|
layoutStore.showHover({
|
||||||
prompt: "share-delete",
|
prompt: "share-delete",
|
||||||
confirm: () => {
|
confirm: async () => {
|
||||||
layoutStore.closeHovers();
|
layoutStore.closeHovers();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
api.remove(link.hash);
|
deleting.value = link.hash;
|
||||||
|
await api.remove(link.hash);
|
||||||
links.value = links.value.filter((item) => item.hash !== link.hash);
|
links.value = links.value.filter((item) => item.hash !== link.hash);
|
||||||
$showSuccess(t("settings.shareDeleted"));
|
$showSuccess(t("settings.shareDeleted"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
$showError(err);
|
$showError(err);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
deleting.value = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
param([string]$Version = '3.0.0-sso.3')
|
param([string]$Version = '3.0.0-sso.4')
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||||
Push-Location $repo
|
Push-Location $repo
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
VERSION="${VERSION:-3.0.0-sso.3}"
|
VERSION="${VERSION:-3.0.0-sso.4}"
|
||||||
COMMIT=$(git rev-parse --short HEAD)
|
COMMIT=$(git rev-parse --short HEAD)
|
||||||
(cd frontend && pnpm install --frozen-lockfile && pnpm run build)
|
(cd frontend && pnpm install --frozen-lockfile && pnpm run build)
|
||||||
mkdir -p build/release/linux-amd64
|
mkdir -p build/release/linux-amd64
|
||||||
|
|||||||
Reference in new issue
Block a user