From a1aa7e67e4efbc58dadcdb4775e340fb4da2b1c9 Mon Sep 17 00:00:00 2001 From: X3F200C Date: Sat, 9 Nov 2024 00:59:16 -0500 Subject: [PATCH] A tiny bit of styling for the login modal --- src/main.js | 13 +++++++++++++ src/scripts/login.js | 12 +++++++++++- src/styles/common.css | 8 +++++++- src/styles/games.css | 7 +++++++ src/styles/login.css | 25 ++++++++++++++++++------- src/views/game.html | 15 +++++++++++++++ src/views/login.html | 4 ++-- 7 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 src/styles/games.css create mode 100644 src/views/game.html diff --git a/src/main.js b/src/main.js index b438ba2..e6f6d30 100644 --- a/src/main.js +++ b/src/main.js @@ -23,6 +23,12 @@ switch (os.platform()) { } let mainWindow; +let plutoniumManifest = { + "product": "plutonium-core-prod", + "revision": -1, + "baseUrl": "https://cdn.plutonium.pw/updater/prod/files/", + "files": [] +}; function createMainWindow() { mainWindow = new electron.BrowserWindow({ @@ -81,6 +87,11 @@ function fetchPlutoniumManifest() { electron.app.once("ready", function () { createMainWindow(); + fetchPlutoniumManifest().then(function (manifest) { + plutoniumManifest = manifest; + }).catch(function (error) { + electron.dialog.showErrorBox("Error", "The Plutonium launcher manifest could not be fetched, auto-updating might not be possible.\n" + error.message); + }); }); electron.app.on("window-all-closed", function () { @@ -130,6 +141,8 @@ electron.ipcMain.handle("login", function (event, username, password) { "successful": true, ...data }); + + mainWindow.loadFile(path.join(__dirname, "src", "views", "games.html")); } catch (error) { reject(error); } diff --git a/src/scripts/login.js b/src/scripts/login.js index ee519a4..6ff5471 100644 --- a/src/scripts/login.js +++ b/src/scripts/login.js @@ -17,7 +17,17 @@ function hintError(message) { } function tryAuth() { - window.login(usernameField.value, passwordField.value).then(function (response) { + let username = usernameField.value; + let password = passwordField.value; + + if (username.length < 3 || username.length > 16) { + return hintError("The username must be between 3 and 16 characters !"); + } + if (password.length < 6) { + return hintError("The password must not be under 6 characters !"); + } + + window.login(username, password).then(function (response) { if (!response.successful) { return hintError("Login failed, invalid credentials !"); } diff --git a/src/styles/common.css b/src/styles/common.css index 86f9297..b32bc4c 100644 --- a/src/styles/common.css +++ b/src/styles/common.css @@ -1,5 +1,7 @@ :root { - background-color: #181820; + --background-primary: #181820; + --background-secondary: #0C0C10; + background-color: var(--background-primary); color: #F8F8FC; width: 100%; height: 100%; @@ -10,3 +12,7 @@ body, main { width: 100%; height: 100%; } + +.centered { + text-align: center; +} diff --git a/src/styles/games.css b/src/styles/games.css new file mode 100644 index 0000000..b9ef5a3 --- /dev/null +++ b/src/styles/games.css @@ -0,0 +1,7 @@ +article { + background-color: var(--background-secondary); + display: flex; + flex-direction: column; + padding: 16px; + border-radius: 16px; +} diff --git a/src/styles/login.css b/src/styles/login.css index 37677d6..7441112 100644 --- a/src/styles/login.css +++ b/src/styles/login.css @@ -1,7 +1,22 @@ -#login-container { - width: 256px; - height: 384px; +input { + height: 40px; +} + +input[type="text"], input[type="password"] { + border: 2px solid var(--hint); +} + +a { + color: unset; +} + +#login-modal { + background-color: var(--background-secondary); + width: 320px; + height: 440px; margin: auto; + padding: 16px; + border-radius: 16px; } #login-form { @@ -12,7 +27,3 @@ #hint { color: var(--hint); } - -input[type="text"], input[type="password"] { - border: 2px solid var(--hint); -} diff --git a/src/views/game.html b/src/views/game.html new file mode 100644 index 0000000..c72189c --- /dev/null +++ b/src/views/game.html @@ -0,0 +1,15 @@ + + + + + Open Plutonium Launcher + + + + + +
+ +
+ + diff --git a/src/views/login.html b/src/views/login.html index 4999037..0686303 100644 --- a/src/views/login.html +++ b/src/views/login.html @@ -9,9 +9,9 @@
-
+
-

Plutonium login

+

Plutonium login