From a182efb4437a31376b570a66e0f6ffdf921380a5 Mon Sep 17 00:00:00 2001 From: pheiduck <47042125+pheiduck@users.noreply.github.com> Date: Fri, 19 Jan 2024 09:35:35 +0100 Subject: [PATCH 1/2] load language before session --- src/lib/Server.js | 7 ++++--- src/www/js/api.js | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lib/Server.js b/src/lib/Server.js index fbefef91..1f00a6b4 100644 --- a/src/lib/Server.js +++ b/src/lib/Server.js @@ -41,6 +41,10 @@ module.exports = class Server { return RELEASE; }))) + .get('/api/lang', (Util.promisify(async () => { + return LANG; + }))) + // Authentication .get('/api/session', Util.promisify(async (req) => { const requiresPassword = !!process.env.PASSWORD; @@ -162,9 +166,6 @@ module.exports = class Server { const { address } = req.body; return WireGuard.updateClientAddress({ clientId, address }); })) - .get('/api/lang', (Util.promisify(async () => { - return LANG; - }))) .listen(PORT, WEBUI_HOST, () => { debug(`Listening on http://${WEBUI_HOST}:${PORT}`); diff --git a/src/www/js/api.js b/src/www/js/api.js index b9b30260..278a3590 100644 --- a/src/www/js/api.js +++ b/src/www/js/api.js @@ -36,6 +36,13 @@ class API { }); } + async getLang() { + return this.call({ + method: 'get', + path: '/lang', + }); + } + async getSession() { return this.call({ method: 'get', @@ -117,11 +124,4 @@ class API { }); } - async getLang() { - return this.call({ - method: 'get', - path: '/lang', - }); - } - } From 9346dda2e594234a8969097e4f49b75a10b76834 Mon Sep 17 00:00:00 2001 From: "Philip H." <47042125+pheiduck@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:44:28 +0000 Subject: [PATCH 2/2] fixup: lint error --- src/www/js/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/www/js/api.js b/src/www/js/api.js index 278a3590..366aeaa1 100644 --- a/src/www/js/api.js +++ b/src/www/js/api.js @@ -42,7 +42,7 @@ class API { path: '/lang', }); } - + async getSession() { return this.call({ method: 'get',