Add Application Electron

This commit is contained in:
CICD - Pipeline 2023-04-24 17:51:18 +02:00
parent 511ee259e7
commit cfcfcc8184
20 changed files with 2157 additions and 0 deletions

70
main.js Normal file
View File

@ -0,0 +1,70 @@
const {app, BrowserWindow, ipcMain, Notification, nativeImage, Tray, Menu} = require("electron")
const path = require("path")
const fs = require("fs")
const ipc = ipcMain
// [Function] Main Window Function
function createWindow() {
const win = new BrowserWindow({
width: 300,
height: 500,
minWidth: 300,
minHeight: 500,
resizable: false,
movable: true,
closable: true,
frame: false,
icon: path.join(__dirname, './src/logo.ico'),
title: "Submanager",
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
devTools: true
}
})
win.loadFile("templates/login/login.html")
ipc.on("close", () => {
app.quit()
})
}
app.whenReady().then(() => {
const icon = nativeImage.createFromPath('src/logo.png')
tray = new Tray(icon)
const contextMenu = Menu.buildFromTemplate([
{ label:"Quitter", click() { app.quit()}}
])
tray.setToolTip("Submanager")
tray.setContextMenu(contextMenu)
//[Operation] - Check settings
createWindow()
app.on('activate', () => {
if(BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})

1843
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "manager",
"version": "1.0",
"description": "Manager for subsonics",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"repository": {
"type": "git",
"url": "https://git.raphix.fr/subsonics/manager.git"
},
"keywords": [],
"author": "Raphix",
"license": "ISC",
"dependencies": {
"electron": "^24.1.2",
"nodemon": "^2.0.22"
}
}

BIN
src/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

BIN
src/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

72
templates/common/app.css Normal file
View File

@ -0,0 +1,72 @@
@import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');
body {
background-color: #92bcea !important;
font-family: 'Open Sans', sans-serif !important;
}
.top-title {
display: flex;
font-size: medium;
vertical-align: center;
justify-content: center;
-webkit-user-select: none;
-webkit-app-region: drag;
width: 100%;
padding: 5% !important;
}
.top-logo {
width: 15%;
}
.buttonClose {
background-color: transparent;
border: none;
border-radius: 15px;
cursor: pointer;
transition: all 0.3s ease 0s;
font-family: 'noto Sans', sans-serif;
font-weight: 500;
font-size: 30px;
color: white;
text-decoration: none;
-webkit-app-region: no-drag;
margin: 5px;
outline: none;
}
.buttonClose:hover {
color: red;
}
.buttonClose:active {
color: rgb(255, 255, 255);
}
header {
display: flex;
}
.content {
padding: 5%;
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 -28.5 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z" fill="#5865F2" fill-rule="nonzero">
</path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path fill="#ffffff" d="M12.9 3.1c1.3 1.2 2.1 3 2.1 4.9 0 3.9-3.1 7-7 7s-7-3.1-7-7c0-1.9 0.8-3.7 2.1-4.9l-0.8-0.8c-1.4 1.5-2.3 3.5-2.3 5.7 0 4.4 3.6 8 8 8s8-3.6 8-8c0-2.2-0.9-4.2-2.3-5.7l-0.8 0.8z"></path>
</svg>

After

Width:  |  Height:  |  Size: 579 B

76
templates/login/login.css Normal file
View File

@ -0,0 +1,76 @@
.buttonTryAgain {
font-family: 'Open Sans', sans-serif !important;
background-color: transparent;
border: solid;
border-radius: 15px;
padding: 2%;
border-color: #afb3f7;
color: white;
transition: all 0.2s ease 0s;
}
.buttonTryAgain:hover {
background-color: #afb3f7;
box-shadow: 2px 2px 5px #afb3f7;
}
.buttonTryAgain:active {
background-color: transparent;
}
.box {
text-align: center;
display: flex;
flex-direction: column;
background-color: rgb(122, 147, 172);
padding: 10%;
color: white;
border-radius: 15px;
box-shadow: 2px 2px 5px rgb(122, 147, 172) ;
-webkit-user-select: none;
user-select: none;
}
.loading {
-webkit-animation: rotating 1s linear infinite;
animation: rotating 1s linear infinite;
width: 30%;
height: 30%;
}
.discord-logo {
width: 30%;
height: 30%;
}
.loadingSpan {
font-size: 20vw;
}
@-webkit-keyframes rotating {
from{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to{
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.infoSpan {
color: rgb(40, 40, 40);
font-size: 12px;
}

View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Submanager - Login</title>
<link rel="stylesheet" href="../common/app.css">
<link rel="stylesheet" href="login.css">
</head>
<body>
<header>
<div class="top-title">
<h1><img class="top-logo rounded" src="../../src/logo.png" alt="Logo"> Subsonics</h1>
</div>
<button id="closeBtn" class="buttonClose"><i class="fas fa-times-circle"></i></button>
</header>
<!--
<div class="content">
<div class="box">
<p>Connexion vers le serveur</p>
<span class="loadingSpan"><img class="loading" src="../common/spinner-third-svgrepo-com.svg"></span>
<br>
<span class="infoSpan"><p>Submanager - Version : 1.0</p></span>
<br>
<span class="actionsSpan"><button class="buttonTryAgain">Réessayer</button></span>
</div>
</div>-->
<div class="content">
<div class="box">
<p>Connexion vers Discord</p>
<span class="loadingSpan"><img class="discord-logo" src="../common/discord-icon-svgrepo-com.svg"></span>
<br>
<span class="infoSpan"><p>Pour contrôler le bot, vérifie ton compte Discord !</p></span>
<br>
<span class="actionsSpan"><button class="buttonTryAgain">Vérifier</button></span>
</div>
</div>
<script src="../common/bundle.js"></script>
<script src="login.js"></script>
</body>
</html>

12
templates/login/login.js Normal file
View File

@ -0,0 +1,12 @@
const {ipcRenderer} = require("electron");
const ipc = ipcRenderer;
const fs = require("fs")
const closeBtn = document.getElementById("closeBtn");
closeBtn.addEventListener("click", () => {
ipc.send("close");
});