admin/home: warning in case of incompatible plugins
Massimo Melina committed
May 14, 2022 at 16:04 UTC
c92793bb1ca9a6d5bccefb118a17a3ff86cbcab5
1 file changed
+4
-1
admin/src/HomePage.ts
+4
-1
@@ -2,7 +2,7 @@
2
3
import { createElement as h, isValidElement } from 'react'
4
import { Box, Button, Link } from '@mui/material'
5
-import { apiCall, useApi, useApiComp } from './api'
5
+import { apiCall, useApi, useApiComp, useApiList } from './api'
6
import { Dict, dontBotherWithKeys, InLink, objSameKeys, onlyTruthy } from './misc'
7
import { CheckCircle, Error, Info, Launch, Warning } from '@mui/icons-material'
8
import md from './md'
@@ -21,6 +21,7 @@ export default function HomePage() {
21
const [vfs] = useApiComp<{ root?: VfsNode }>('get_vfs')
22
const [account] = useApi<Account>(username && 'get_account')
23
const [cfg, reloadCfg] = useApiComp('get_config', { only: ['https_port', 'cert', 'private_key', 'proxies', 'ignore_proxies'] })
24
+ const { list: plugins } = useApiList('get_plugins')
25
if (!status || isValidElement(status))
26
return status
27
const { http, https } = status
@@ -37,6 +38,7 @@ export default function HomePage() {
38
" or ",
39
SOLUTION_SEP, cfgLink("provide adequate files")
40
]]))
41
+ console.log(plugins)
42
return h(Box, { display:'flex', gap: 2, flexDirection:'column' },
43
username && entry('', "Welcome "+username),
44
errors.length ? dontBotherWithKeys(errors.map(msg => entry('error', dontBotherWithKeys(msg))))
@@ -49,6 +51,7 @@ export default function HomePage() {
51
['http','https'].map(k => k + " " + (errorMap[k] ? "is in error" : "is off")).join(', '),
52
!errors.length && [ SOLUTION_SEP, cfgLink("switch http or https on") ]
53
),
54
+ plugins.find(x => x.badApi) && entry('warning', "Some plugins may be incompatible"),
55
!account?.adminActualAccess && entry('', md("You are accessing on _localhost_ where permission is not required"),
56
SOLUTION_SEP, h(InLink, { to:'accounts' }, "give admin access to an account to be able to access from other computers") ),
57
proxyWarning(cfg, status) && entry('warning', "A proxy was detected but none is configured",