A tiny bit of styling for the login modal

This commit is contained in:
X3F200C 2024-11-09 00:59:16 -05:00
parent fcee377fb4
commit a1aa7e67e4
7 changed files with 73 additions and 11 deletions

View File

@ -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);
}

View File

@ -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 !");
}

View File

@ -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;
}

7
src/styles/games.css Normal file
View File

@ -0,0 +1,7 @@
article {
background-color: var(--background-secondary);
display: flex;
flex-direction: column;
padding: 16px;
border-radius: 16px;
}

View File

@ -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);
}

15
src/views/game.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Open Plutonium Launcher</title>
<link rel="stylesheet" href="../styles/common.css" />
<link rel="stylesheet" href="../styles/games.css" />
<script src="../scripts/games.js" charset="utf-8" type="text/javascript"></script>
</head>
<body>
<main>
</main>
</body>
</html>

View File

@ -9,9 +9,9 @@
</head>
<body>
<main>
<div id="login-container">
<div id="login-modal">
<form id="login-form">
<h2>Plutonium login</h2>
<h2 class="centered">Plutonium login</h2>
<p id="hint" style="visibility: hidden;"></p>
<label for="username">Username :</label>
<input type="text" name="username" id="username-field" placeholder="Your Plutonium username" minLength="3" maxLength="16">