fix: (regression 0.38.0) frontend plugins not working #138

Massimo Melina committed Mar 7, 2023 at 13:10 UTC cbe92c61abc7d14c4ea13d57f20ca89011921799
3 files changed +2 -4
admin/index.html
-1
@@ -6,7 +6,6 @@
6 <script async src='https://unpkg.com/node-forge@1.3.1/dist/forge.min.js'></script>
7 <title>HFS Admin</title>
8 <script type="module" src="/src/index.ts"></script>
9 - <HFS/>
9 <link rel="icon" type="image/svg+xml" href="/hfs-logo-icon.svg" />
10 </head>
11 <body>
frontend/index.html
-1
@@ -5,7 +5,6 @@
5 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
6 <link href="/fontello.css" rel="stylesheet" />
7 <script type="module" src="/src/index.ts"></script>
8 - <HFS/>
8 </head>
9 <body>
10 <noscript>You need to enable JavaScript to run this app.</noscript>
src/serveGuiFiles.ts
+2 -2
@@ -87,7 +87,7 @@ async function treatIndex(ctx: Koa.Context, body: string, filesUri: string) {
87 })))
88 let ret = body
89 .replace(/((?:src|href) *= *['"])\/?(?![a-z]+:\/\/)/g, '$1' + filesUri)
90 - .replace('<HFS/>', () => `
90 + .replace('</head>', () => `
91 ${!isFrontend ? '' : `
92 <title>${title.get()}</title>
93 <link rel="icon" href="${favicon.get() ? '/favicon.ico' : 'data:;'}" />
@@ -111,7 +111,7 @@ async function treatIndex(ctx: Koa.Context, body: string, filesUri: string) {
111 </style>
112 ${css.map(uri => `<link rel='stylesheet' type='text/css' href='${uri}'/>`).join('\n')}
113 ${js.map(uri => `<script defer src='${uri}'></script>`).join('\n')}
114 - `)
114 + </head>`)
115 if (isFrontend)
116 ret = ret
117 .replace('<body>', '<body>' + getSection('top'))