feat: refresh settings, sync account avatars and link account management
This commit is contained in:
1 parent
fa1832dfa7
commit
d3d164910b
22 files changed
+789
-407
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<span class="account-avatar" aria-hidden="true">
|
||||
<img
|
||||
v-if="user?.picture && !failed"
|
||||
:src="user.picture"
|
||||
alt=""
|
||||
@error="failed = true"
|
||||
/>
|
||||
<template v-else>{{
|
||||
(user?.username || "?").slice(0, 1).toUpperCase()
|
||||
}}</template>
|
||||
</span>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
const props = defineProps<{
|
||||
user: { picture?: string; username?: string } | null;
|
||||
}>();
|
||||
const failed = ref(false);
|
||||
watch(
|
||||
() => props.user?.picture,
|
||||
() => (failed.value = false)
|
||||
);
|
||||
</script>
|
||||
@@ -110,6 +110,13 @@
|
||||
role="menu"
|
||||
@keydown="menuKey"
|
||||
>
|
||||
<a
|
||||
role="menuitem"
|
||||
:href="baseURL + '/auth/account'"
|
||||
@click="navigate"
|
||||
><i class="material-icons">account_circle</i
|
||||
>{{ t("preferences.accountSettings") }}</a
|
||||
>
|
||||
<router-link
|
||||
role="menuitem"
|
||||
to="/settings/profile"
|
||||
@@ -154,13 +161,11 @@
|
||||
@click="accountOpen = !accountOpen"
|
||||
@keydown.down.prevent="openAccount"
|
||||
>
|
||||
<span class="account-avatar">{{
|
||||
auth.user.username.slice(0, 1).toUpperCase()
|
||||
}}</span>
|
||||
<AccountAvatar :user="auth.user" />
|
||||
<span class="account-label"
|
||||
><strong>{{ auth.user.username }}</strong
|
||||
><small>{{
|
||||
auth.user.email || auth.user.profileName || "AniDev SSO"
|
||||
auth.user.email || auth.user.profileName || ""
|
||||
}}</small></span
|
||||
><i class="material-icons">more_horiz</i>
|
||||
</button>
|
||||
@@ -192,6 +197,7 @@ import {
|
||||
} from "@/utils/constants";
|
||||
import { parseBookmarks, type Bookmark } from "@/utils/bookmarks";
|
||||
import FolderTreeNode from "./FolderTreeNode.vue";
|
||||
import AccountAvatar from "./AccountAvatar.vue";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
const auth = useAuthStore(),
|
||||
file = useFileStore(),
|
||||
|
||||
@@ -1,45 +1,39 @@
|
||||
<template>
|
||||
<div>
|
||||
<section class="permission-editor">
|
||||
<h3>{{ $t("settings.permissions") }}</h3>
|
||||
<p class="small">{{ $t("settings.permissionsHelp") }}</p>
|
||||
|
||||
<p class="field-hint">{{ $t("sso.managed") }}</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.create" />
|
||||
{{ $t("settings.perm.create") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.delete" />
|
||||
{{ $t("settings.perm.delete") }}
|
||||
</p>
|
||||
<p>
|
||||
<input
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.create") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.create"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.rename") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.rename"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.modify") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.modify"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.delete") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.delete"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.share") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.share"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.download") }}</span
|
||||
><input
|
||||
type="checkbox"
|
||||
:disabled="admin || perm.share"
|
||||
v-model="perm.download"
|
||||
/>
|
||||
{{ $t("settings.perm.download") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.modify" />
|
||||
{{ $t("settings.perm.modify") }}
|
||||
</p>
|
||||
<p v-if="isExecEnabled">
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.execute" />
|
||||
{{ $t("settings.perm.execute") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.rename" />
|
||||
{{ $t("settings.perm.rename") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" :disabled="admin" v-model="perm.share" />
|
||||
{{ $t("settings.perm.share") }}
|
||||
</p>
|
||||
</div>
|
||||
/></label>
|
||||
<label v-if="isExecEnabled" class="settings-toggle"
|
||||
><span>{{ $t("settings.perm.execute") }}</span
|
||||
><input type="checkbox" :disabled="admin" v-model="perm.execute"
|
||||
/></label>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { enableExec } from "@/utils/constants";
|
||||
export default {
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
.settings-page {
|
||||
margin-top: 18px;
|
||||
}
|
||||
.settings-page .row {
|
||||
margin: 0;
|
||||
}
|
||||
.settings-page .row .column {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
.settings-page .permission-editor {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.permission-editor h3 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.settings-toggle input:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
.settings-page-heading {
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.settings-page-heading h1 {
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
font-weight: 650;
|
||||
}
|
||||
.settings-tabs {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-bottom: 22px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--borderPrimary);
|
||||
overflow-x: auto;
|
||||
}
|
||||
.settings-tabs a {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
padding: 10px 14px;
|
||||
border-radius: 8px;
|
||||
white-space: nowrap;
|
||||
font-size: 13px;
|
||||
color: var(--textPrimary);
|
||||
}
|
||||
.settings-tabs a:hover {
|
||||
background: var(--hover);
|
||||
}
|
||||
.settings-tabs a.router-link-active {
|
||||
background: var(--surfaceSecondary);
|
||||
color: var(--blue);
|
||||
}
|
||||
.settings-tabs i {
|
||||
font-size: 19px;
|
||||
}
|
||||
.preferences-form {
|
||||
max-width: 1200px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
.settings-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
align-items: start;
|
||||
}
|
||||
.settings-page .settings-section {
|
||||
padding: 22px;
|
||||
margin: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.settings-section h2 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
margin: 0 0 18px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.settings-section h2 > i {
|
||||
font-size: 21px;
|
||||
color: var(--blue);
|
||||
}
|
||||
.settings-wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.settings-section .settings-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
margin: 16px 0;
|
||||
font-size: 12px;
|
||||
color: var(--textPrimary);
|
||||
}
|
||||
.settings-field .input {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
.settings-section .settings-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
margin: 0;
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: var(--textSecondary);
|
||||
cursor: pointer;
|
||||
}
|
||||
.settings-toggle:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.settings-toggle input[type="checkbox"] {
|
||||
appearance: none;
|
||||
position: relative;
|
||||
width: 34px;
|
||||
height: 20px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--borderPrimary);
|
||||
background: var(--surfaceSecondary);
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.settings-toggle input[type="checkbox"]::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
background: var(--textPrimary);
|
||||
}
|
||||
.settings-toggle input[type="checkbox"]:checked {
|
||||
background: var(--blue);
|
||||
border-color: var(--blue);
|
||||
}
|
||||
.settings-toggle input[type="checkbox"]:checked::after {
|
||||
left: 16px;
|
||||
background: white;
|
||||
}
|
||||
.settings-toggle input[type="checkbox"]:focus-visible {
|
||||
outline: 2px solid var(--blue);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
.settings-section summary {
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.account-identity {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
.account-identity > div {
|
||||
min-width: 0;
|
||||
}
|
||||
.account-identity h2 {
|
||||
margin-bottom: 6px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.account-identity p {
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
color: var(--textPrimary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.account-avatar {
|
||||
overflow: hidden;
|
||||
}
|
||||
.account-avatar img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.account-identity .account-avatar {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 16px;
|
||||
font-size: 26px;
|
||||
}
|
||||
.settings-account-links {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 22px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.settings-account-links > div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
border-top: 1px solid var(--divider);
|
||||
padding-top: 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.settings-account-links .button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
padding: 8px;
|
||||
}
|
||||
.settings-account-links i {
|
||||
font-size: 16px;
|
||||
}
|
||||
.account-summary {
|
||||
margin-bottom: 18px !important;
|
||||
}
|
||||
.settings-save {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 18px 0 0;
|
||||
}
|
||||
.settings-page .card {
|
||||
border-radius: 12px;
|
||||
}
|
||||
.settings-page .card-title {
|
||||
padding: 18px 22px;
|
||||
}
|
||||
.settings-page .card-content {
|
||||
padding: 18px 22px;
|
||||
}
|
||||
.settings-page .card-content.full {
|
||||
padding: 0;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.settings-page table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.settings-page th,
|
||||
.settings-page td {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
text-align: start;
|
||||
font-size: 13px;
|
||||
}
|
||||
.settings-page th {
|
||||
font-size: 11px;
|
||||
color: var(--textPrimary);
|
||||
font-weight: 500;
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.settings-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.settings-account-links {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.settings-page .settings-section {
|
||||
padding: 16px;
|
||||
}
|
||||
.settings-tabs a {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
@import "./context-menu.css";
|
||||
@import "./workspace.css";
|
||||
@import "./explorer.css";
|
||||
@import "./settings.css";
|
||||
|
||||
/* For testing only
|
||||
:focus {
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
},
|
||||
"permissions": "Permissions",
|
||||
"permissionsHelp": "File access permissions. Administrators are determined by SSO roles.",
|
||||
"profileSettings": "Profile Settings",
|
||||
"profileSettings": "Preferences",
|
||||
"redirectAfterCopyMove": "Redirect to destination after copy/move",
|
||||
"ruleExample1": "prevents the access to any dotfile (such as .git, .gitignore) in every folder.\n",
|
||||
"ruleExample2": "blocks the access to the file named Caddyfile on the root of the scope.",
|
||||
@@ -312,8 +312,7 @@
|
||||
},
|
||||
"sso": {
|
||||
"description": "Your files. One secure workspace.",
|
||||
"signIn": "Continue with SSO",
|
||||
"managed": "Your account and access are managed by AniDev SSO",
|
||||
"signIn": "Sign in",
|
||||
"shortName": "Short link name",
|
||||
"randomName": "Generate automatically",
|
||||
"shortHint": "2–64 letters, digits, underscores or hyphens. Public names are discoverable; protect sensitive shares with a password.",
|
||||
@@ -376,5 +375,15 @@
|
||||
"unpin": "Remove bookmark",
|
||||
"folders": "Folders",
|
||||
"retry": "Retry"
|
||||
},
|
||||
"preferences": {
|
||||
"accountSettings": "Account settings",
|
||||
"password": "Change password",
|
||||
"go": "Open",
|
||||
"appearance": "Appearance",
|
||||
"behavior": "File behavior",
|
||||
"regional": "Language and dates",
|
||||
"publicPages": "Public pages",
|
||||
"homeFolders": "Home folders"
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@
|
||||
},
|
||||
"permissions": "Права доступа",
|
||||
"permissionsHelp": "Права на работу с файлами. Администраторы определяются ролями SSO.",
|
||||
"profileSettings": "Настройки профиля",
|
||||
"profileSettings": "Интерфейс",
|
||||
"redirectAfterCopyMove": "Redirect to destination after copy/move",
|
||||
"ruleExample1": "предотвратить доступ к любому скрытому файлу (например: .git, .gitignore) в каждой папке.\n",
|
||||
"ruleExample2": "блокирует доступ к файлу с именем Caddyfile в корневой области.",
|
||||
@@ -309,8 +309,7 @@
|
||||
},
|
||||
"sso": {
|
||||
"description": "Ваши файлы. Одно удобное пространство.",
|
||||
"signIn": "Войти через SSO",
|
||||
"managed": "Учётная запись и доступ управляются в AniDev SSO",
|
||||
"signIn": "Войти",
|
||||
"shortName": "Короткое имя ссылки",
|
||||
"randomName": "Сгенерировать автоматически",
|
||||
"shortHint": "2–64 латинские буквы, цифры, дефис или подчёркивание. Для конфиденциальных файлов установите пароль ссылки.",
|
||||
@@ -373,5 +372,15 @@
|
||||
"unpin": "Убрать закладку",
|
||||
"folders": "Папки",
|
||||
"retry": "Повторить"
|
||||
},
|
||||
"preferences": {
|
||||
"accountSettings": "Настройки аккаунта",
|
||||
"password": "Сменить пароль",
|
||||
"go": "Перейти",
|
||||
"appearance": "Внешний вид",
|
||||
"behavior": "Работа с файлами",
|
||||
"regional": "Язык и даты",
|
||||
"publicPages": "Публичные страницы",
|
||||
"homeFolders": "Личные папки"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ interface IUser {
|
||||
displayName?: string;
|
||||
profileName?: string;
|
||||
email?: string;
|
||||
picture?: string;
|
||||
id: number;
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<button class="button sso-signin" @click="signIn">
|
||||
<i class="material-icons">login</i>{{ $t("sso.signIn") }}
|
||||
</button>
|
||||
<small>{{ $t("sso.managed") }}</small>
|
||||
</main>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -1,66 +1,37 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<div class="dashboard settings-page">
|
||||
<header-bar showMenu showLogo />
|
||||
|
||||
<div id="nav">
|
||||
<div class="wrapper">
|
||||
<ul>
|
||||
<router-link to="/settings/profile"
|
||||
><li :class="{ active: $route.path === '/settings/profile' }">
|
||||
{{ t("settings.profileSettings") }}
|
||||
</li></router-link
|
||||
>
|
||||
<router-link to="/settings/shares" v-if="user?.perm.share"
|
||||
><li :class="{ active: $route.path === '/settings/shares' }">
|
||||
{{ t("settings.shareManagement") }}
|
||||
</li></router-link
|
||||
>
|
||||
<router-link to="/settings/global" v-if="user?.perm.admin"
|
||||
><li :class="{ active: $route.path === '/settings/global' }">
|
||||
{{ t("settings.globalSettings") }}
|
||||
</li></router-link
|
||||
>
|
||||
<router-link to="/settings/users" v-if="user?.perm.admin"
|
||||
><li
|
||||
:class="{
|
||||
active:
|
||||
$route.path === '/settings/users' || $route.name === 'User',
|
||||
}"
|
||||
>
|
||||
{{ t("settings.userManagement") }}
|
||||
</li></router-link
|
||||
>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="settings-page-heading">
|
||||
<h1>{{ t("sidebar.settings") }}</h1>
|
||||
</div>
|
||||
|
||||
<div v-if="loading">
|
||||
<h2 class="message delayed">
|
||||
<div class="spinner">
|
||||
<div class="bounce1"></div>
|
||||
<div class="bounce2"></div>
|
||||
<div class="bounce3"></div>
|
||||
</div>
|
||||
<span>{{ t("files.loading") }}</span>
|
||||
</h2>
|
||||
<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
|
||||
>
|
||||
<router-link v-if="authStore.user?.perm.share" to="/settings/shares"
|
||||
><i class="material-icons">link</i
|
||||
>{{ 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
|
||||
>
|
||||
<router-link v-if="authStore.user?.perm.admin" to="/settings/users"
|
||||
><i class="material-icons">group</i
|
||||
>{{ t("settings.userManagement") }}</router-link
|
||||
>
|
||||
</div>
|
||||
|
||||
<router-view></router-view>
|
||||
<p v-if="layout.loading" role="status">{{ t("files.loading") }}</p>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import HeaderBar from "@/components/header/HeaderBar.vue";
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const layoutStore = useLayoutStore();
|
||||
|
||||
const user = computed(() => authStore.user);
|
||||
const loading = computed(() => layoutStore.loading);
|
||||
const layout = useLayoutStore();
|
||||
</script>
|
||||
@@ -1,233 +1,122 @@
|
||||
<template>
|
||||
<errors v-if="error" :errorCode="error.status" />
|
||||
<div class="row" v-else-if="!layoutStore.loading && settings !== null">
|
||||
<div class="column">
|
||||
<form class="card" @submit.prevent="save">
|
||||
<div class="card-title">
|
||||
<h2>{{ t("settings.globalSettings") }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<p>
|
||||
<input type="checkbox" v-model="settings.createUserDir" />
|
||||
{{ t("settings.createUserDir") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" v-model="settings.hideLoginButton" />
|
||||
{{ t("settings.hideLoginButton") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label class="small">{{ t("settings.userHomeBasePath") }}</label>
|
||||
<input
|
||||
class="input input--block"
|
||||
type="text"
|
||||
v-model="settings.userHomeBasePath"
|
||||
/>
|
||||
</p>
|
||||
|
||||
<h3>{{ t("settings.rules") }}</h3>
|
||||
<p class="small">{{ t("settings.globalRules") }}</p>
|
||||
<rules v-model:rules="settings.rules" />
|
||||
|
||||
<div v-if="enableExec">
|
||||
<h3>{{ t("settings.executeOnShell") }}</h3>
|
||||
<p class="small">{{ t("settings.executeOnShellDescription") }}</p>
|
||||
<input
|
||||
class="input input--block"
|
||||
type="text"
|
||||
placeholder="bash -c, cmd /c, ..."
|
||||
v-model="shellValue"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h3>{{ t("settings.branding") }}</h3>
|
||||
|
||||
<i18n-t
|
||||
keypath="settings.brandingHelp"
|
||||
tag="p"
|
||||
class="small"
|
||||
scope="global"
|
||||
>
|
||||
<a
|
||||
class="link"
|
||||
target="_blank"
|
||||
href="https://github.com/filebrowser/filebrowser/blob/master/docs/customization.md#custom-branding"
|
||||
>{{ t("settings.documentation") }}</a
|
||||
>
|
||||
</i18n-t>
|
||||
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="settings.branding.disableExternal"
|
||||
id="branding-links"
|
||||
/>
|
||||
{{ t("settings.disableExternalLinks") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="settings.branding.disableUsedPercentage"
|
||||
id="branding-used-disk"
|
||||
/>
|
||||
{{ t("settings.disableUsedDiskPercentage") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="theme">{{ t("settings.themes.title") }}</label>
|
||||
<themes
|
||||
class="input input--block"
|
||||
v-model:theme="settings.branding.theme"
|
||||
id="theme"
|
||||
></themes>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="branding-name">{{ t("settings.instanceName") }}</label>
|
||||
<input
|
||||
class="input input--block"
|
||||
type="text"
|
||||
v-model="settings.branding.name"
|
||||
id="branding-name"
|
||||
/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="branding-files">{{
|
||||
t("settings.brandingDirectoryPath")
|
||||
}}</label>
|
||||
<input
|
||||
class="input input--block"
|
||||
type="text"
|
||||
v-model="settings.branding.files"
|
||||
id="branding-files"
|
||||
/>
|
||||
</p>
|
||||
|
||||
<h3>{{ t("settings.tusUploads") }}</h3>
|
||||
|
||||
<p class="small">{{ t("settings.tusUploadsHelp") }}</p>
|
||||
|
||||
<div class="tusConditionalSettings">
|
||||
<p>
|
||||
<label for="tus-chunkSize">{{
|
||||
t("settings.tusUploadsChunkSize")
|
||||
}}</label>
|
||||
<input
|
||||
class="input input--block"
|
||||
type="text"
|
||||
v-model="formattedChunkSize"
|
||||
id="tus-chunkSize"
|
||||
/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="tus-retryCount">{{
|
||||
t("settings.tusUploadsRetryCount")
|
||||
}}</label>
|
||||
<vue-number-input
|
||||
controls
|
||||
v-model.number="settings.tus.retryCount"
|
||||
id="tus-retryCount"
|
||||
:min="0"
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<input
|
||||
class="button button--flat"
|
||||
type="submit"
|
||||
:value="t('buttons.update')"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<form class="card" @submit.prevent="save">
|
||||
<div class="card-title">
|
||||
<h2>{{ t("settings.userDefaults") }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<p class="small">{{ t("settings.defaultUserDescription") }}</p>
|
||||
|
||||
<user-form
|
||||
:isNew="false"
|
||||
:isDefault="true"
|
||||
v-model:user="settings.defaults"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<input
|
||||
class="button button--flat"
|
||||
type="submit"
|
||||
:value="t('buttons.update')"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<form v-if="enableExec" class="card" @submit.prevent="save">
|
||||
<div class="card-title">
|
||||
<h2>{{ t("settings.commandRunner") }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<i18n-t
|
||||
keypath="settings.commandRunnerHelp"
|
||||
tag="p"
|
||||
class="small"
|
||||
scope="global"
|
||||
>
|
||||
<code>FILE</code>
|
||||
<code>SCOPE</code>
|
||||
<a
|
||||
class="link"
|
||||
target="_blank"
|
||||
href="https://github.com/filebrowser/filebrowser/blob/master/docs/command-execution.md#hook-runner"
|
||||
>{{ t("settings.documentation") }}</a
|
||||
>
|
||||
</i18n-t>
|
||||
|
||||
<div
|
||||
v-for="(command, key) in settings.commands"
|
||||
<form
|
||||
v-else-if="!layoutStore.loading && settings"
|
||||
class="preferences-form"
|
||||
@submit.prevent="save"
|
||||
>
|
||||
<div class="settings-grid">
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">palette</i>{{ t("preferences.appearance") }}
|
||||
</h2>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.instanceName")
|
||||
}}<input class="input" type="text" v-model="settings.branding.name"
|
||||
/></label>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.themes.title")
|
||||
}}<Themes class="input" v-model:theme="settings.branding.theme"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.disableUsedDiskPercentage") }}</span
|
||||
><input
|
||||
type="checkbox"
|
||||
v-model="settings.branding.disableUsedPercentage"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">public</i>{{ t("preferences.publicPages") }}
|
||||
</h2>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.hideLoginButton") }}</span
|
||||
><input type="checkbox" v-model="settings.hideLoginButton"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.disableExternalLinks") }}</span
|
||||
><input type="checkbox" v-model="settings.branding.disableExternal"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">folder_shared</i
|
||||
>{{ t("preferences.homeFolders") }}
|
||||
</h2>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.createUserDir") }}</span
|
||||
><input type="checkbox" v-model="settings.createUserDir"
|
||||
/></label>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.userHomeBasePath")
|
||||
}}<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="settings.userHomeBasePath"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">cloud_upload</i
|
||||
>{{ t("settings.tusUploads") }}
|
||||
</h2>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.tusUploadsChunkSize")
|
||||
}}<input class="input" type="text" v-model="formattedChunkSize"
|
||||
/></label>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.tusUploadsRetryCount")
|
||||
}}<input
|
||||
class="input"
|
||||
type="number"
|
||||
min="0"
|
||||
max="1000"
|
||||
v-model.number="settings.tus.retryCount"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section settings-wide">
|
||||
<h2>
|
||||
<i class="material-icons">person_add</i
|
||||
>{{ t("settings.userDefaults") }}
|
||||
</h2>
|
||||
<UserForm
|
||||
:isNew="false"
|
||||
:isDefault="true"
|
||||
v-model:user="settings.defaults"
|
||||
/>
|
||||
</section>
|
||||
<section class="card settings-section settings-wide">
|
||||
<h2><i class="material-icons">policy</i>{{ t("settings.rules") }}</h2>
|
||||
<p class="field-hint">{{ t("settings.globalRules") }}</p>
|
||||
<Rules v-model:rules="settings.rules" />
|
||||
</section>
|
||||
<details class="card settings-section settings-wide">
|
||||
<summary>{{ t("sso.advancedSettings") }}</summary>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.brandingDirectoryPath")
|
||||
}}<input class="input" type="text" v-model="settings.branding.files"
|
||||
/></label>
|
||||
<template v-if="enableExec">
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.executeOnShell")
|
||||
}}<input class="input" type="text" v-model="shellValue"
|
||||
/></label>
|
||||
<h3>{{ t("settings.commandRunner") }}</h3>
|
||||
<label
|
||||
v-for="(_, key) in settings.commands"
|
||||
:key="key"
|
||||
class="collapsible"
|
||||
>
|
||||
<input :id="key" type="checkbox" />
|
||||
<label :for="key">
|
||||
<p>{{ capitalize(key) }}</p>
|
||||
<i class="material-icons">arrow_drop_down</i>
|
||||
</label>
|
||||
<div class="collapse">
|
||||
<textarea
|
||||
class="input input--block input--textarea"
|
||||
v-model.trim="commandObject[key]"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<input
|
||||
class="button button--flat"
|
||||
type="submit"
|
||||
:value="t('buttons.update')"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
class="settings-field"
|
||||
>{{ capitalize(key)
|
||||
}}<textarea class="input" v-model.trim="commandObject[key]" />
|
||||
</label>
|
||||
</template>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-save">
|
||||
<button class="button" :disabled="saving">{{ t("buttons.save") }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { settings as api } from "@/api";
|
||||
import { StatusError } from "@/api/utils";
|
||||
@@ -244,6 +133,7 @@ import { useI18n } from "vue-i18n";
|
||||
const error = ref<StatusError | null>(null);
|
||||
const originalSettings = ref<ISettings | null>(null);
|
||||
const settings = ref<ISettings | null>(null);
|
||||
const saving = ref(false);
|
||||
const debounceTimeout = ref<number | null>(null);
|
||||
const pendingChunkSize = ref<string | null>(null);
|
||||
|
||||
@@ -311,7 +201,7 @@ const capitalize = (name: string, where: string | RegExp = "_") => {
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
if (settings.value === null) return false;
|
||||
if (settings.value === null || saving.value) return false;
|
||||
applyChunkSize();
|
||||
const newSettings: ISettings = {
|
||||
...settings.value,
|
||||
@@ -349,11 +239,14 @@ const save = async () => {
|
||||
setTheme(newSettings.branding.theme);
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
try {
|
||||
await api.update(newSettings);
|
||||
$showSuccess(t("settings.settingsUpdated"));
|
||||
} catch (e: any) {
|
||||
$showError(e);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,77 +1,97 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<form class="card" @submit="updateSettings">
|
||||
<div class="card-title">
|
||||
<h2>{{ t("settings.profileSettings") }}</h2>
|
||||
<form class="preferences-form" @submit="updateSettings">
|
||||
<section class="card settings-section account-summary">
|
||||
<div class="account-identity">
|
||||
<AccountAvatar :user="authStore.user" />
|
||||
<div>
|
||||
<h2>{{ authStore.user?.profileName || authStore.user?.username }}</h2>
|
||||
<p>{{ authStore.user?.email || authStore.user?.username }}</p>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<div class="profile-summary">
|
||||
<strong>{{ authStore.user?.username }}</strong
|
||||
><span v-if="authStore.user?.profileName">{{
|
||||
authStore.user.profileName
|
||||
}}</span
|
||||
><span v-if="authStore.user?.email">{{ authStore.user.email }}</span
|
||||
><small>{{ t("sso.managed") }}</small>
|
||||
</div>
|
||||
<p>
|
||||
<input type="checkbox" name="hideDotfiles" v-model="hideDotfiles" />
|
||||
{{ t("settings.hideDotfiles") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="singleClick" v-model="singleClick" />
|
||||
{{ t("settings.singleClick") }}
|
||||
</p>
|
||||
<p>
|
||||
<label
|
||||
><input
|
||||
type="checkbox"
|
||||
name="showPreviews"
|
||||
v-model="showPreviews"
|
||||
/>
|
||||
{{ t("settings.showPreviews") }}</label
|
||||
>
|
||||
</p>
|
||||
<p>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="redirectAfterCopyMove"
|
||||
v-model="redirectAfterCopyMove"
|
||||
/>
|
||||
{{ t("settings.redirectAfterCopyMove") }}
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" name="dateFormat" v-model="dateFormat" />
|
||||
{{ t("settings.setDateFormat") }}
|
||||
</p>
|
||||
<h3>{{ t("settings.language") }}</h3>
|
||||
<languages
|
||||
class="input input--block"
|
||||
v-model:locale="locale"
|
||||
></languages>
|
||||
|
||||
<p class="field-hint">{{ t("sso.editorTheme") }}</p>
|
||||
</div>
|
||||
<div class="settings-account-links">
|
||||
<div>
|
||||
<span>{{ t("preferences.accountSettings") }}</span
|
||||
><a class="button button--flat" :href="baseURL + '/auth/account'"
|
||||
>{{ t("preferences.go")
|
||||
}}<i class="material-icons">north_east</i></a
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<input
|
||||
class="button button--flat"
|
||||
type="submit"
|
||||
name="submitProfile"
|
||||
:value="t('buttons.update')"
|
||||
/>
|
||||
<div>
|
||||
<span>{{ t("preferences.password") }}</span
|
||||
><a class="button button--flat" :href="baseURL + '/auth/account'"
|
||||
>{{ t("preferences.go")
|
||||
}}<i class="material-icons">north_east</i></a
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
<div class="settings-grid">
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">palette</i>{{ t("preferences.appearance") }}
|
||||
</h2>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.themes.title")
|
||||
}}<select
|
||||
v-model="selectedTheme"
|
||||
class="input"
|
||||
@change="setTheme(selectedTheme)"
|
||||
>
|
||||
<option value="light">{{ t("settings.themes.light") }}</option>
|
||||
<option value="dark">{{ t("settings.themes.dark") }}</option>
|
||||
</select></label
|
||||
>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.showPreviews") }}</span
|
||||
><input type="checkbox" v-model="showPreviews"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.hideDotfiles") }}</span
|
||||
><input type="checkbox" v-model="hideDotfiles"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section">
|
||||
<h2>
|
||||
<i class="material-icons">mouse</i>{{ t("preferences.behavior") }}
|
||||
</h2>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.singleClick") }}</span
|
||||
><input type="checkbox" v-model="singleClick"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.redirectAfterCopyMove") }}</span
|
||||
><input type="checkbox" v-model="redirectAfterCopyMove"
|
||||
/></label>
|
||||
</section>
|
||||
<section class="card settings-section settings-wide">
|
||||
<h2>
|
||||
<i class="material-icons">language</i>{{ t("preferences.regional") }}
|
||||
</h2>
|
||||
<label class="settings-field"
|
||||
>{{ t("settings.language")
|
||||
}}<Languages class="input" v-model:locale="locale"
|
||||
/></label>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ t("settings.setDateFormat") }}</span
|
||||
><input type="checkbox" v-model="dateFormat"
|
||||
/></label>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-save">
|
||||
<button class="button" type="submit" :disabled="saving">
|
||||
{{ t("buttons.save") }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
import { users as api } from "@/api";
|
||||
import Languages from "@/components/settings/Languages.vue";
|
||||
import AccountAvatar from "@/components/AccountAvatar.vue";
|
||||
import { baseURL } from "@/utils/constants";
|
||||
import { getTheme, setTheme } from "@/utils/theme";
|
||||
import { inject, onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
@@ -88,18 +108,21 @@ const singleClick = ref<boolean>(false);
|
||||
const redirectAfterCopyMove = ref<boolean>(false);
|
||||
const dateFormat = ref<boolean>(false);
|
||||
const locale = ref<string>("");
|
||||
const aceEditorTheme = ref<string>("");
|
||||
const selectedTheme = ref<UserTheme>(getTheme());
|
||||
const saving = ref(false);
|
||||
|
||||
onMounted(async () => {
|
||||
layoutStore.loading = true;
|
||||
if (authStore.user === null) return false;
|
||||
if (authStore.user === null) {
|
||||
layoutStore.loading = false;
|
||||
return false;
|
||||
}
|
||||
locale.value = authStore.user.locale;
|
||||
hideDotfiles.value = authStore.user.hideDotfiles;
|
||||
showPreviews.value = !authStore.user.hidePreviews;
|
||||
singleClick.value = authStore.user.singleClick;
|
||||
redirectAfterCopyMove.value = authStore.user.redirectAfterCopyMove;
|
||||
dateFormat.value = authStore.user.dateFormat;
|
||||
aceEditorTheme.value = authStore.user.aceEditorTheme;
|
||||
layoutStore.loading = false;
|
||||
|
||||
return true;
|
||||
@@ -107,6 +130,8 @@ onMounted(async () => {
|
||||
|
||||
const updateSettings = async (event: Event) => {
|
||||
event.preventDefault();
|
||||
if (saving.value) return;
|
||||
saving.value = true;
|
||||
|
||||
try {
|
||||
if (authStore.user === null) throw new Error("User is not set!");
|
||||
@@ -120,7 +145,6 @@ const updateSettings = async (event: Event) => {
|
||||
singleClick: singleClick.value,
|
||||
redirectAfterCopyMove: redirectAfterCopyMove.value,
|
||||
dateFormat: dateFormat.value,
|
||||
aceEditorTheme: aceEditorTheme.value,
|
||||
};
|
||||
|
||||
await api.update(data, [
|
||||
@@ -130,7 +154,6 @@ const updateSettings = async (event: Event) => {
|
||||
"singleClick",
|
||||
"redirectAfterCopyMove",
|
||||
"dateFormat",
|
||||
"aceEditorTheme",
|
||||
]);
|
||||
authStore.updateUser(data);
|
||||
$showSuccess(t("settings.settingsUpdated"));
|
||||
@@ -138,6 +161,8 @@ const updateSettings = async (event: Event) => {
|
||||
if (err instanceof Error) {
|
||||
$showError(err);
|
||||
}
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -4,8 +4,7 @@
|
||||
<div class="card-title">
|
||||
<h2>{{ user.displayName || user.username }}</h2>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p class="field-hint">{{ $t("sso.managed") }}</p>
|
||||
<div class="card-content settings-section">
|
||||
<label for="user-scope">{{ $t("settings.scope") }}</label>
|
||||
<input
|
||||
id="user-scope"
|
||||
@@ -14,10 +13,10 @@
|
||||
required
|
||||
/>
|
||||
<p v-for="permission in permissions" :key="permission">
|
||||
<label
|
||||
><input type="checkbox" v-model="user.perm[permission]" />
|
||||
{{ $t("settings.perm." + permission) }}</label
|
||||
>
|
||||
<label class="settings-toggle"
|
||||
><span>{{ $t("settings.perm." + permission) }}</span
|
||||
><input type="checkbox" v-model="user.perm[permission]"
|
||||
/></label>
|
||||
</p>
|
||||
<rules v-model:rules="user.rules" />
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
<tr v-for="user in users" :key="user.id">
|
||||
<td>
|
||||
{{ user.displayName || user.username
|
||||
}}<small class="user-record-id">ID {{ user.id }}</small>
|
||||
}}<small v-if="user.email" class="user-record-id">{{
|
||||
user.email
|
||||
}}</small>
|
||||
</td>
|
||||
<td>{{ user.scope }}</td>
|
||||
<td class="small">
|
||||
|
||||
Reference in new issue
Block a user