@samitouri / QOSami-HFS / commits / a71bc1fa

fix: admin/internet: status not refreshed after creating self-signed cert

Massimo Melina committed Nov 29, 2025 at 18:40 UTC a71bc1faba1e19b9290456ed52739a0e3d1e7b0c
2 files changed +9 -3
admin/src/InternetPage.ts
+7 -1
@@ -181,7 +181,7 @@ export default function InternetPage({ setTitleSide }: PageProps) {
181 return status.element || h(TitleCard, { title: "HTTPS", icon: Lock, color: https?.listening && !error ? 'success' : 'warning' },
182 error ? h(Alert, { severity: 'warning' }, error) :
183 (disabled && h(LinkBtn, { onClick: notEnabled }, "Not enabled")),
184 - cert.element || with_(cert.data, c => c.none ? h(LinkBtn, { onClick: () => suggestMakingCert().then(cert.reload) }, "No certificate configured") : h(Box, {},
184 + cert.element || with_(cert.data, c => c.none ? h(LinkBtn, { onClick: noCertClick }, "No certificate configured") : h(Box, {},
185 h(CardMembership, { fontSize: 'small', sx: { mr: 1, verticalAlign: 'middle' } }), "Current certificate",
186 h('ul', {},
187 h('li', {}, "Domain: ", c.altNames?.join(' + ') ||'-'),
@@ -245,6 +245,12 @@ export default function InternetPage({ setTitleSide }: PageProps) {
245 },
246 })
247 )
248 +
249 + async function noCertClick() {
250 + await suggestMakingCert()
251 + cert.reload()
252 + status.reload()
253 + }
254 }
255
256 async function notEnabled() {
admin/src/OptionsPage.ts
+2 -2
@@ -413,14 +413,14 @@ export async function suggestMakingCert() {
413 async function makeCertAndSave() {
414 if (!window.crypto.subtle)
415 return alertDialog("Retry this procedure on localhost", 'warning')
416 - close()
416 const saved = await apiCall('make_self_signed_cert', { fileName: 'self' })
417 if (loaded) // when undefined we are not in this page
418 Object.assign(loaded, saved)
419 setTimeout(exposedReloadStatus!, 1000) // give some time for backend to apply
420 setTimeout(exposedReloadStatus!, 2000) // try again in case it's very slow
421 Object.assign(state.config, saved)
423 - alertDialog("Certificate saved", 'success')
422 + await alertDialog("Certificate saved", 'success')
423 + close()
424 }
425 })
426 }
\ No newline at end of file