admin/home: use get_config instead of get_vfs, as it's lighter
Massimo Melina committed
Nov 21, 2025 at 11:31 UTC
fecb4c9c046bdfbc26fde223082194f701df24c9
1 file changed
+4
-5
admin/src/HomePage.ts
+4
-5
@@ -9,12 +9,11 @@ import {
9
} from './misc'
10
import { Btn, Flex, InLink, LinkBtn, wikiLink, } from './mui'
11
import {
12
- BrowserUpdated as UpdateIcon, CheckCircle, Colorize, Error, Info, Launch, OpenInNew, Restore, Warning
12
+ BrowserUpdated as UpdateIcon, CheckCircle, Colorize, Error, Info, OpenInNew, Restore, Warning
13
} from '@mui/icons-material'
14
import { state, useSnapState } from './state'
15
import { alertDialog, confirmDialog, promptDialog, toast } from './dialog'
16
import { isCertError, isKeyError, suggestMakingCert } from './OptionsPage'
17
-import { VfsNode } from './VfsPage'
17
import { Account } from './AccountsPage'
18
import _ from 'lodash'
19
import { subscribeKey } from 'valtio/utils'
@@ -29,9 +28,8 @@ export default function HomePage() {
28
const SOLUTION_SEP = " — "
29
const { username } = useSnapState()
30
const { data: status, reload: reloadStatus, element: statusEl } = useApiEx<typeof adminApis.get_status>('get_status')
32
- const { data: vfs } = useApiEx<{ root?: VfsNode }>('get_vfs')
31
const { data: account } = useApiEx<Account>(username && 'get_account')
34
- const cfg = useApiEx('get_config', { only: ['https_port', 'cert', 'private_key', 'proxies', 'ignore_proxies'] })
32
+ const cfg = useApiEx('get_config', { only: ['https_port', 'cert', 'private_key', 'proxies', 'ignore_proxies', 'vfs'] })
33
const { list: plugins } = useApiList('get_plugins')
34
const [checkPlugins, setCheckPlugins] = useState(false)
35
const { list: pluginUpdates} = useApiList(checkPlugins && 'get_plugin_updates')
@@ -65,11 +63,12 @@ export default function HomePage() {
63
},
64
title: status.updatePossible && "Right-click if you want to install a zip",
65
}
66
+ const vfs = cfg.data?.vfs
67
return h(Box, {},
68
h(RandomPlugin),
69
h(Box, { display:'flex', gap: 2, flexDirection:'column', alignItems: 'flex-start', height: '100%' },
70
entry('', md("This is the *Admin-panel*, where you manage your server. Access your files on the [Front-end](../..).")),
72
- !vfs ? h(LinearProgress) : !vfs.root?.children?.length && !vfs.root?.source ? entry('warning', "You have no shared files", SOLUTION_SEP, fsLink("add some")) : null,
71
+ vfs && !vfs.children?.length && !vfs.source ? entry('warning', "You have no shared files", SOLUTION_SEP, fsLink("add some")) : null,
72
account?.adminActualAccess ? entry('', "Welcome, "+username)
73
: entry('', md("You're accessing the Admin-panel without an account because you are on localhost"),
74
SOLUTION_SEP, "to access from another computer, you must ", h(InLink, { to:'accounts' }, md("create an account with *admin* permission")) ),