@samitouri / QOSami-HFS / commits / 27929f4e

removed legacy code

Massimo Melina committed Mar 10, 2024 at 14:05 UTC 27929f4e1315767750417e2365434ac5c3e2ce6b
3 files changed +7 -7
frontend/src/index.scss
+1 -1
@@ -481,7 +481,7 @@ button .icon + .label {
481 }
482 .nowrap { white-space: nowrap }
483
484 -.dialog-login {
484 +.login-dialog {
485 form {
486 display: flex;
487 flex-direction: column;
frontend/src/login.ts
+1 -1
@@ -48,7 +48,7 @@ export async function loginDialog(closable=false) {
48 let going = false
49 const { close } = newDialog({
50 closable,
51 - className: 'login-dialog dialog-login',
51 + className: 'login-dialog',
52 icon: () => hIcon('login'),
53 onClose(v) {
54 resolve(v)
src/serveGuiAndSharedFiles.ts
+5 -5
@@ -81,11 +81,11 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
81 if (node.default && path.endsWith('/') && !get) // final/ needed on browser to make resource urls correctly with html pages
82 node = await urlToNode(node.default, ctx, node) ?? node
83 if (!await nodeIsDirectory(node))
84 - return !node.source ? sendErrorPage(ctx, HTTP_METHOD_NOT_ALLOWED)
85 - : !statusCodeForMissingPerm(node, 'can_read', ctx) ? serveFileNode(ctx, node)
86 - : ctx.status !== HTTP_UNAUTHORIZED ? null
87 - : !path.endsWith('/') ? (ctx.set('WWW-Authenticate', 'Basic'), sendErrorPage(ctx)) // this is necessary to support standard urls with credentials. Final / means we are dealing with default file...
88 - : (ctx.state.serveApp = true) && serveFrontendFiles(ctx, next) // ...for which we still provide fancy login
84 + return !node.source ? sendErrorPage(ctx, HTTP_METHOD_NOT_ALLOWED) // !dir && !source is not supported at this moment
85 + : !statusCodeForMissingPerm(node, 'can_read', ctx) ? serveFileNode(ctx, node) // all good
86 + : ctx.status !== HTTP_UNAUTHORIZED ? null // all errors don't need extra handling, except unauthorized
87 + : path.endsWith('/') ? (ctx.state.serveApp = true) && serveFrontendFiles(ctx, next) // since this is no dir, final / means we are dealing with default file, for which we still provide fancy login
88 + : (ctx.set('WWW-Authenticate', 'Basic'), sendErrorPage(ctx)) // this is necessary to support standard urls with credentials
89 if (!path.endsWith('/'))
90 return ctx.redirect(ctx.state.revProxyPath + ctx.originalUrl.replace(/(\?|$)/, '/$1')) // keep query-string, if any
91 if (statusCodeForMissingPerm(node, 'can_list', ctx)) {