Correctly handle customized server name in admin settings dialog.

This commit is contained in:
2026-02-04 20:15:56 +00:00
parent cc351bb992
commit 41686d1dd1
3 changed files with 34 additions and 10 deletions
+9
View File
@@ -163,6 +163,15 @@ def subscribe(uuid, ws):
) )
@bp.get("config")
async def get_config(request):
await auth.verify(request, privileged=True)
return json({
"name": config.config.name,
"public": config.config.public,
})
@bp.put("config/public") @bp.put("config/public")
async def update_public(request): async def update_public(request):
await auth.verify(request, privileged=True) await auth.verify(request, privileged=True)
+20 -10
View File
@@ -75,7 +75,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, watch } from 'vue' import { ref, reactive, onMounted, watch } from 'vue'
import { listUsers, createUser, updateUser, deleteUser, updatePublic, updateServerName } from '@/repositories/User' import { listUsers, createUser, updateUser, deleteUser, updatePublic, updateServerName, getServerConfig } from '@/repositories/User'
import type { ISimpleError } from '@/repositories/Client' import type { ISimpleError } from '@/repositories/Client'
import { useMainStore } from '@/stores/main' import { useMainStore } from '@/stores/main'
@@ -238,22 +238,32 @@ const debouncedUpdateServerName = () => {
nameDebounceTimer = setTimeout(updateServerNameSetting, 400) nameDebounceTimer = setTimeout(updateServerNameSetting, 400)
} }
// Initialize server settings // Load server config from admin API
const initServerSettings = () => { const loadServerConfig = async () => {
serverSettings.public = store.server.public || false try {
// Start with empty name field - placeholder shows current effective name const config = await getServerConfig()
serverSettings.name = '' serverSettings.name = config.name
serverSettings.public = config.public
} catch (e) {
// Fallback to store values if API fails
serverSettings.public = store.server.public || false
serverSettings.name = ''
}
} }
onMounted(() => { onMounted(() => {
initServerSettings() serverSettings.public = store.server.public || false
serverSettings.name = ''
loading.value = false loading.value = false
}) })
// Load users when dialog opens (only in built-in auth mode) // Load users and config when dialog opens
watch(() => store.dialog, (newVal) => { watch(() => store.dialog, (newVal) => {
if (newVal === 'usermgmt' && !store.server.paskia) { if (newVal === 'usermgmt') {
loadUsers() loadServerConfig()
if (!store.server.paskia) {
loadUsers()
}
} }
}) })
+5
View File
@@ -60,3 +60,8 @@ export async function updateServerName(name: string) {
const data = await Client.put('/api/config/name', { name }) const data = await Client.put('/api/config/name', { name })
return data return data
} }
export async function getServerConfig() {
const data = await Client.get('/api/config')
return data as { name: string, public: boolean }
}