fix: admin/options/config: "copy without password" was not removing password from URLs

Massimo Melina committed Mar 11, 2025 at 17:19 UTC 1b75b25892a6b8b7e2d887ebac163bf69ae4a82f
3 files changed +5 -3
admin/src/App.ts
+1 -1
@@ -118,7 +118,7 @@ function Routed() {
118 mainMenu.map((it,idx) =>
119 // @ts-ignore
120 h(Route, { key: idx, path: it.path, element: h(it.comp, { setTitleSide: set }) })),
121 - h(Route, { path: 'edit', element: h(ConfigFilePage) })
121 + h(Route, { path: 'config', element: h(ConfigFilePage) })
122 )
123 ),
124 )
admin/src/ConfigFilePage.ts
+3 -1
@@ -61,7 +61,9 @@ export default function ConfigFilePage() {
61 }
62
63 function copy() {
64 - const s = (text || '').replace(/^(\s*(\w*password(?!_change)\w*|srp):\s*).+\n/gm, '$1removed\n')
64 + const s = (text || '')
65 + .replace(/^(\s*(\w*password(?!_change)\w*|srp):\s*).+\n/gm, '$1removed\n')
66 + .replace(/(:\/\/)[^/@\s]+@/g, '$1removed@')
67 + 'custom_html: | # this is currently ignored by hfs, just here for reference\n' + data.customHtml.replace(/^/gm, ' ')
68 if (!s) return
69 copyTextToClipboard(s)
admin/src/OptionsPage.ts
+1 -1
@@ -101,7 +101,7 @@ export default function OptionsPage() {
101 }, "Reload"),
102 h(Button, { // @ts-ignore
103 component: RouterLink,
104 - to: "/edit",
104 + to: "/config",
105 startIcon: h(EditNote),
106 }, sm ? "Config file" : "File"),
107 ],