From f9d9525d4cc07110d529e5ee8a0523f26b3d6b09 Mon Sep 17 00:00:00 2001 From: tabarra Date: Thu, 9 Nov 2023 19:58:25 -0300 Subject: [PATCH] wip: bunch of small changes --- core/components/WebServer/getReactIndex.ts | 8 +- core/components/WebServer/index.ts | 3 + .../WebServer/middlewares/authMws.ts | 2 +- .../WebServer/middlewares/sessionMws.ts | 1 - docs/dev_notes.md | 9 +- panel/src/components/MainPageLink.tsx | 21 +- panel/src/layout/DesktopNavbar.tsx | 2 +- panel/src/layout/ServerSidebar.tsx | 3 + panel/src/main.tsx | 4 +- panel/src/pages/auth/Login.tsx | 4 +- web/standalone/404.ejs | 43 -- web/standalone/login.ejs | 419 ------------------ 12 files changed, 36 insertions(+), 483 deletions(-) delete mode 100644 web/standalone/404.ejs delete mode 100644 web/standalone/login.ejs diff --git a/core/components/WebServer/getReactIndex.ts b/core/components/WebServer/getReactIndex.ts index ff1743985..0776367b3 100644 --- a/core/components/WebServer/getReactIndex.ts +++ b/core/components/WebServer/getReactIndex.ts @@ -22,8 +22,7 @@ let htmlFile: string; // NOTE: https://vitejs.dev/guide/backend-integration.html const viteOrigin = process.env.TXADMIN_DEV_VITE_URL!; -const devModulesScript = ` - `; + replacers.txConstsInjection = ``; replacers.devModules = convars.isDevMode ? devModulesScript : ''; //Prepare custom themes style tag diff --git a/core/components/WebServer/index.ts b/core/components/WebServer/index.ts index a3e907ead..4b1eecdbb 100644 --- a/core/components/WebServer/index.ts +++ b/core/components/WebServer/index.ts @@ -119,6 +119,9 @@ export default class WebServer { ctx.status = 404; console.verbose.warn(`Request 404 error: ${ctx.path}`); return ctx.utils.render('standalone/404'); + }else if (ctx.path.endsWith('.map')){ + ctx.status = 404; + return ctx.send('Not found'); } else { return ctx.utils.serveReactIndex(); } diff --git a/core/components/WebServer/middlewares/authMws.ts b/core/components/WebServer/middlewares/authMws.ts index c816e2315..64bfadaf9 100644 --- a/core/components/WebServer/middlewares/authMws.ts +++ b/core/components/WebServer/middlewares/authMws.ts @@ -28,7 +28,7 @@ const webLogoutPage = ` - <% if (isMatrix) { %> - - <% } %> - - - - - - - - - - - - - - - - - - - -
- - - <% if (isWebInterface) { %> - <% if (isMatrix) { %> -
<%= ascii %>
- <% } else { %> -
- txAdmin Logo -
- <% } %> - <% } %> - - -
-
-
-
- <% if (template === 'justMessage') { %> -

<%= errorTitle %>

-

<%= errorMessage %>

- Back - <% } %> - <% if (template === 'noMaster') { %> -

No Cfx.re Account Linked

-
-
Type the PIN from your terminal and click "Link Account".
-
-

Autofilled

-
- -
- -
-
- - <% } %> - <% if (template === 'callback') { %> - avatar -
<%= addMaster_name %>
- -
Create backup password:
- You will be able to login using this password in case the connection with Cfx.re's auth provider fails. -
-
-
- - - -
- -
-
-
- - - -
- -
- - Must be between 6 and 24 characters. - - -
-
- - -
-
- - -
- - <% } %> - <% if (template === 'normal') { %> -

Login

- <% if (isWebInterface) { %> - - - - <% } else { %> -
- Automatic login failed, re-open the menu or login using your username/password below. -
- <% } %> - -
OR
- -
-
-
- - - -
- -
-
-
- - - -
- -
-
- -
-
- - - <% } %> -
- <% if (message && template !== 'justMessage') { %> - - <% } %> -
-
-
- - -
-
- - - - <% if (isWebInterface) { %> -
- - - - - - -
- <% } %> -
-
- <% if (isMatrix) { %> -
-
-

The Matrix has you...

-
-
- <% } %> -
- - - - - - - - -