33 Commits

Author SHA1 Message Date
8653740ea9 2.3.0 Change Some little thing 2023-05-05 19:29:17 +02:00
fa38043a23 2.2.9 Change Some little thing 2023-05-05 19:16:19 +02:00
fe2688d6b6 2.2.8 Change Volume 2023-05-05 13:53:36 +02:00
738020b16f 2.2.7 Change Volume 2023-05-04 22:12:49 +02:00
3e89e43d6b 2.2.6 Rework Graphique 2023-05-04 22:04:06 +02:00
8f52c1549a 2.2.5 Final 2 Version 2023-05-04 17:46:02 +02:00
601cf636cb 2.2.4 Official Version 2023-05-03 20:47:04 +02:00
0d7a77a3bd 2.2.3 Official Version 2023-05-02 21:20:47 +02:00
d03014cd42 2.2.2 Official Version 2023-05-02 21:09:29 +02:00
d5d1226f8a 2.2.1 Official Version 2023-05-02 20:59:07 +02:00
5d601785fd 2.2.1 Official Version 2023-05-02 20:52:28 +02:00
152e4f8995 Stable Version 2.2.0 2023-05-02 20:43:06 +02:00
d47152c7c9 2.2.0 Official Version 2023-05-02 20:40:55 +02:00
634a6e2b7b 2.1.7 Offical Version 2023-05-02 12:22:33 +02:00
1bb292d1c2 2.1.6 Offical Version 2023-05-02 00:01:40 +02:00
b7b6846c0e 2.1.5 Offical Version 2023-05-01 23:55:21 +02:00
4af63ae4bd 2.1.4 Offical Version 2023-05-01 23:49:21 +02:00
411a2785bc 2.1.3 Offical Version 2023-05-01 23:44:41 +02:00
af6041af0c 2.1.2 Offical Version 2023-05-01 23:41:37 +02:00
e130e2c761 2.1.2 Offical Version 2023-05-01 23:39:49 +02:00
5523e94cff 2.1.1 PreRelease Version 2023-04-30 23:42:49 +02:00
93f793bd95 2.0.1 Official Version 2023-04-30 19:00:04 +02:00
bc37d7811f 2.0.9 PreRelease Version 2023-04-29 23:23:37 +02:00
733aa33b2a 2.0.8 PreRelease Version 2023-04-29 20:05:31 +02:00
ca6922c84a 2.0.7 PreRelease Version 2023-04-29 19:36:06 +02:00
832e81decf 2.0.6 PreRelease Version 2023-04-29 19:32:36 +02:00
856db533ad 2.0.5 PreRelease Version 2023-04-29 19:29:33 +02:00
df7d47d920 2.0.4 PreRelease Version 2023-04-29 19:21:36 +02:00
59eb33dc94 2.0.3 PreRelease Version 2023-04-29 19:07:38 +02:00
3d38fea6c5 2.0.2 PreRelease Version 2023-04-29 19:03:19 +02:00
8701ea5d4a First try implements AutoUpdate 2023-04-29 18:19:45 +02:00
aeb0ba6320 2.0.0 PreRelease 2023-04-29 14:43:58 +02:00
112c5bbf39 1.1.0 Official Version 2023-04-28 17:29:41 +02:00
21 changed files with 3032 additions and 239 deletions

193
README.md
View File

@ -1,2 +1,193 @@
# manager
<h1><u>Subsonics 2.2.7</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Volume : Possibilité d'aller à 200%</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.6</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Modification de certains textes</li>
<li><strong>[CHANGE]</strong> : Modification des tailles et du positionnement des éléments </li>
</ul>
<hr>
<h1><u>Subsonics 2.2.5</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Changement du titre pour toutes les fenêtres de l'application</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.4</u></h1>
<p>Sortie le : 03/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Changement du titre de l'application</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.3</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix Canal</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.2</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix import settings</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.1</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix import settings</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.0</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Update : Add Dev & Stable Canal for update.</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.7</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Settings : Favoris won't be deleted on new connection</li>
<li><strong>[FIX]</strong> : Logs : Logs goes on wrong folder</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.6</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Logs : Logs goes on wrong folder</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.5</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Second Tentative to fix Update Checker</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.4</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Settings : Settings wont't be deleted after signout</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.3</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Update Checker</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.2</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Favoris : Vous pouvez désormais sauvegarder plusieurs playlists de lecture.</li>
<li><strong>[FIX]</strong> : Profil : Augumentation de la taille de l'image</li>
<li><strong>[AJOUT]</strong> : Site : Création d'un site pour télécharger le logiciel. </li>
</ul>
<hr>
<h1><u>Subsonics 2.1.1</u></h1>
<p>Sortie le : 31/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Bug ou Suggestion Report : Se clear après utilisation</li>
<li><strong>[AJOUT]</strong> : Update : Ajout de l'Update forcée.</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.0</u></h1>
<p>Sortie le : 30/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Bug ou Suggestion Report : Disponible dans les paramètres. Nouvelle onglet qui permet de soit faire une suggestion ou de reporter un bug.</li>
<li><strong>[FIX]</strong> : UserState : Enième tentative qui a l'air de marcher pour fixer le bug du token et du user inconnu ce qui empechait d'afficher le pseudo de l'utilisateur</li>
<li><strong>[AJOUT]</strong> : Liste de lecture : Déplacement des chansons dans la liste de lecture.</li>
<li><strong>[FIX]</strong> : Tray : Fix de l'icone qui ne se chargait pas.</li>
<li><strong>[CHANGE]</strong> : Dev Version : Remise en forme de la banderole pour éviter le gros bandeau rouge abusif</li>
</ul>
<hr>
<h1><u>Subsonics 2.0.9</u></h1>
<p>Sortie le : 29/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Le fichier de MAJ compressé est désormais supprimé au début et à la fin de la MAJ afin d'éviter les SoftLock en cas de bugs</li>
<li><strong>[AJOUT]</strong> : Dev Version : Une banderole s'affiche lorsque la version est expérimentale.</li>
<li><strong>[AJOUT]</strong> : Logs : Disponible dans l'emplacement de l'application puis dans ./resources/app/logs/</li>
<li><strong>[AJOUT]</strong> : Patch Note : Ajout de la fonctionnalité de ce que vous lisez en ce moment.</li>
<li><strong>[CHANGE]</strong> : Graphique : Uniformisation des couleurs.</li>
</ul>
<hr>
<!--Info version Example
<hr>
<h1><u>Subsonics x.x.x</u></h1>
<p>Sortie le : --/--/----</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> </li>
<li><strong>[FIX]</strong> </li>
</ul>
<hr>
-->

230
infoupdate.html Normal file
View File

@ -0,0 +1,230 @@
<h1><u>Subsonics 2.3.0</u></h1>
<p>Sortie le : 05/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Modification des tailles et du positionnement des éléments </li>
</ul>
<hr>
<h1><u>Subsonics 2.2.9</u></h1>
<p>Sortie le : 05/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Modification des tailles et du positionnement des éléments </li>
<li><strong>[CHANGE]</strong> : Modification des couleurs pour préparer au rework graphique. </li>
</ul>
<hr>
<h1><u>Subsonics 2.2.8</u></h1>
<p>Sortie le : 05/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Modification des tailles et du positionnement des éléments </li>
<li><strong>[CHANGE]</strong> : Modification des couleurs pour préparer au rework graphique. </li>
<li><strong>[FIX]</strong> : Volume : Se reset après déconnexion</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.7</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Volume : Possibilité d'aller à 200%</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.6</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Modification de certains textes</li>
<li><strong>[CHANGE]</strong> : Modification des tailles et du positionnement des éléments </li>
</ul>
<hr>
<h1><u>Subsonics 2.2.5</u></h1>
<p>Sortie le : 04/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Changement du titre pour toutes les fenêtres de l'application</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.4</u></h1>
<p>Sortie le : 03/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[CHANGE]</strong> : Changement du titre de l'application</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.3</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix Canal</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.2</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix import settings</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.1</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Fix import settings</li>
</ul>
<hr>
<h1><u>Subsonics 2.2.0</u></h1>
<p>Sortie le : 02/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Update : Add Dev & Stable Canal for update.</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.7</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Settings : Favoris won't be deleted on new connection</li>
<li><strong>[FIX]</strong> : Logs : Logs goes on wrong folder</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.6</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Logs : Logs goes on wrong folder</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.5</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Second Tentative to fix Update Checker</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.4</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Settings : Settings wont't be deleted after signout</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.3</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Update Checker</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.2</u></h1>
<p>Sortie le : 01/05/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Favoris : Vous pouvez désormais sauvegarder plusieurs playlists de lecture.</li>
<li><strong>[FIX]</strong> : Profil : Augumentation de la taille de l'image</li>
<li><strong>[AJOUT]</strong> : Site : Création d'un site pour télécharger le logiciel. </li>
</ul>
<hr>
<h1><u>Subsonics 2.1.1</u></h1>
<p>Sortie le : 31/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Bug ou Suggestion Report : Se clear après utilisation</li>
<li><strong>[AJOUT]</strong> : Update : Ajout de l'Update forcée.</li>
</ul>
<hr>
<h1><u>Subsonics 2.1.0</u></h1>
<p>Sortie le : 30/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> : Bug ou Suggestion Report : Disponible dans les paramètres. Nouvelle onglet qui permet de soit faire une suggestion ou de reporter un bug.</li>
<li><strong>[FIX]</strong> : UserState : Enième tentative qui a l'air de marcher pour fixer le bug du token et du user inconnu ce qui empechait d'afficher le pseudo de l'utilisateur</li>
<li><strong>[AJOUT]</strong> : Liste de lecture : Déplacement des chansons dans la liste de lecture.</li>
<li><strong>[FIX]</strong> : Tray : Fix de l'icone qui ne se chargait pas.</li>
<li><strong>[CHANGE]</strong> : Dev Version : Remise en forme de la banderole pour éviter le gros bandeau rouge abusif</li>
</ul>
<hr>
<h1><u>Subsonics 2.0.9</u></h1>
<p>Sortie le : 29/04/2022</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[FIX]</strong> : Update : Le fichier de MAJ compressé est désormais supprimé au début et à la fin de la MAJ afin d'éviter les SoftLock en cas de bugs</li>
<li><strong>[AJOUT]</strong> : Dev Version : Une banderole s'affiche lorsque la version est expérimentale.</li>
<li><strong>[AJOUT]</strong> : Logs : Disponible dans l'emplacement de l'application puis dans ./resources/app/logs/</li>
<li><strong>[AJOUT]</strong> : Patch Note : Ajout de la fonctionnalité de ce que vous lisez en ce moment.</li>
<li><strong>[CHANGE]</strong> : Graphique : Uniformisation des couleurs.</li>
</ul>
<hr>
<!--Info version Example
<hr>
<h1><u>Subsonics x.x.x</u></h1>
<p>Sortie le : --/--/----</p>
<h2 style="font-size: 18px;">Ajouts & Fixes :</h2>
<ul>
<li><strong>[AJOUT]</strong> </li>
<li><strong>[FIX]</strong> </li>
</ul>
<hr>
-->

163
main.js
View File

@ -3,9 +3,8 @@ const path = require("path")
const fs = require("fs")
const ipc = ipcMain
const { io } = require("socket.io-client");
const log = require("./sublog");
const { platform } = require("os");
const log = require("./sub-log");
const updater = require("./updatetools")
// [Function] Main Window Function
// BUILDER "build": "
@ -31,7 +30,14 @@ async function createWindow() {
})
if(process.env.DEV != "true") {
updater.checkUpdate()
} else {
log.update("Desactivation des mises a jour -> DEV MOD ENABLE")
}
await win.loadFile("templates/login/login.html")
@ -53,8 +59,8 @@ async function createWindow() {
reconnection: false
})
}
@ -95,8 +101,10 @@ async function createWindow() {
} else {
fs.rmSync( __dirname + path.sep + "settings.json")
win.webContents.send("connectSuccess")
const settings = require( __dirname + path.sep + "settings.json")
settings["token"] = null;
fs.writeFile(__dirname + path.sep + "settings.json", JSON.stringify(settings, null, 2), () => {})
win.webContents.send("connectFailed")
}
})
@ -108,7 +116,35 @@ async function createWindow() {
ipc.on("retryLogin", () => {
log.client("Reconnexion au serveur ... Progressing !")
socket.close()
socket.connect()
})
ipc.on("stateOfConnection", () => {
if(socket.disconnected == true) {
socket.connect()
} else {
if(!fs.existsSync( __dirname + path.sep + "settings.json")) {
win.webContents.send("connectSuccess")
} else {
const settings = require( __dirname + path.sep + "settings.json")
if(settings.token) {
log.client("Auth : Connexion avec le Token Discord !")
socket.emit("authByToken", settings.token)
} else {
win.webContents.send("connectSuccess")
}
}
}
})
ipc.on("discordlogin", () => {
@ -126,6 +162,12 @@ async function createWindow() {
log.client("Discord Auth : Erreur lors de la connexion vers Discord !")
})
socket.on("checkFailed", () => {
win.webContents.send("discordCheckFailed")
win.restore()
log.client("Discord Auth : Erreur lors de la vérification de Discord !")
})
socket.on("authOpenLink", (link) => {
log.client("Discord Auth : Redirection vers le service Discord !")
shell.openExternal(link)
@ -133,15 +175,27 @@ async function createWindow() {
})
socket.on("successLogin", (token) => {
const settings = {}
if(!fs.existsSync(__dirname + path.sep + "settings.json")) {
fs.writeFileSync(__dirname + path.sep + "settings.json")
}
const settings = require(__dirname + path.sep + "settings.json")
settings["token"] = token
fs.writeFileSync( __dirname + path.sep + "settings.json", JSON.stringify(settings, null, 2))
log.client("Saving token in settings !")
log.client("Discord Auth : Redirection fait avec succes !")
win.loadFile("templates/app/app.html")
askUpdateState()
win.restore()
fs.writeFile(__dirname + path.sep + "settings.json", JSON.stringify(settings, null, 2), (err) => {
log.client("Saving token in settings !")
log.client("Discord Auth : Redirection fait avec succes !")
win.loadFile("templates/app/app.html")
askUpdateState()
win.restore()
})
})
socket.on("updateState", (data) => {
@ -174,6 +228,13 @@ async function createWindow() {
})
ipc.on("loop", () => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Loop Requested !")
socket.emit("loop", settings.token)
})
ipc.on("forward", () => {
const settings = require( __dirname + path.sep + "settings.json")
@ -204,6 +265,13 @@ async function createWindow() {
})
ipc.on("moveQueue", (ev, identifier) => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Move queue Bot Requsted !")
socket.emit("moveQueue", settings.token, identifier)
})
ipc.on("findReq", (ev, value) => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Find search Bot Requsted !")
@ -225,19 +293,69 @@ async function createWindow() {
socket.emit("listClear", settings.token)
})
ipc.on("restart", () => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Restart Bot Requsted !")
socket.emit("restart", settings.token)
})
ipc.on("seek", (ev, pos) => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Seek Bot Requsted !")
socket.emit("seek", settings.token, pos)
})
ipc.on("volume", (ev, pos) => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Control : Volume Bot Requsted !")
socket.emit("volume", settings.token, pos)
})
ipc.on("signout", () => {
if(fs.statSync(__dirname + path.sep + "settings.json")) {
fs.rmSync(__dirname + path.sep + "settings.json")
const settings = require( __dirname + path.sep + "settings.json")
settings["token"] = null;
fs.writeFile(__dirname + path.sep + "settings.json", JSON.stringify(settings, null, 2), () => {})
}
win.loadFile("template/login/login.html")
socket.disconnect()
})
ipc.on("report", (ev, report) => {
const settings = require( __dirname + path.sep + "settings.json")
log.client("Report : Envoi d'un rapport !")
report["version"] = require("./package.json").version
socket.emit("report", settings.token, report)
})
socket.on("reportAns", (ans) => {
win.webContents.send("reportForm", ans)
})
ipc.on("forceUpdate", () => {
if(process.env.DEV != "true") {
updater.update()
} else {
log.update("ABORT : MODE DEV ENABLE")
}
})
if (process.defaultApp) {
if (process.argv.length >= 2) {
@ -258,19 +376,20 @@ async function createWindow() {
ipc.on("askUpdateState", () => {
askUpdateState()
askUpdateState()
})
function askUpdateState() {
async function askUpdateState() {
const settings = require( __dirname + path.sep + "settings.json")
socket.emit("getState", settings.token)
console.log(settings.token)
await socket.emit("getState", settings.token)
}
socket.on("disconnect", async () => {
await win.loadFile("templates/login/login.html")
await win.webContents.send("connectFailed")
socket.connect()
});
}
@ -289,7 +408,7 @@ app.on("open-url", (ev, url) => {
app.whenReady().then(() => {
const icon = nativeImage.createFromPath('src/logo.png')
const icon = nativeImage.createFromPath(__dirname + path.sep + 'src' + path.sep + "logo.ico")
tray = new Tray(icon)
@ -302,8 +421,10 @@ app.whenReady().then(() => {
//[Operation] - Check settings
createWindow()
log.client("Submanager - Version : " + require("./package.json").version + " - Raphix")
log.client("Starting Application")
createWindow()
app.on('activate', () => {

961
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{
"name": "subsonics-manager",
"version": "1.0.2",
"version": "2.3.0",
"description": "Manager for subsonics",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-packager . submanager-app --platform='win32' --out='./dist/' --icon='./src/logo.ico' --overwrite --ignore='(settings.json)'",
"dev": "set DEV=true& electron ."
"dev": "set DEV=true& electron .",
"build": "electron-packager . submanager-app --platform='win32' --out='./dist/' --icon='./src/logo.ico' --overwrite --ignore='(settings.json)'"
},
"repository": {
"type": "git",
@ -16,13 +16,13 @@
"author": "Raphix",
"license": "ISC",
"dependencies": {
"decompress": "^4.2.1",
"fs-extra": "^11.1.1",
"socket.io-client": "^4.6.1"
},
"devDependencies": {
"electron": "^24.1.2",
"electron-packager": "^17.1.1"
}
},
"dev": true
}

BIN
src/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
src/title.png~ Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

88
sub-log.js Normal file
View File

@ -0,0 +1,88 @@
const fs = require("fs")
const path = require("path")
const { app } = require("electron")
if(!fs.existsSync(__dirname + path.sep + "logs" + path.sep)) {
fs.mkdirSync(__dirname + path.sep + "logs")
}
var logStream = fs.createWriteStream(__dirname + path.sep + "logs" + path.sep + getDate() + ".log", {
flags: 'a'
});
logStream.write("[" + require("./package.json").name + "@" + require("./package.json").version + "] - [" + getDate() + "]" + "\n")
logStream.write("Submanager by Raphix" + "\n")
logStream.write("----------------------------------------------------------------" + "\n")
module.exports.client = (message) => {
logStream.write("[Subsonics-Client] - " + getDate() + " - " + message + "\n")
console.log("[Subsonics-Client] - " + getDate() + " - " + message)
}
module.exports.client.error = (message) => {
logStream.write("[Subsonics-Client] - [ERROR] - " + getDate() + " - " + message + "\n")
console.error("[Subsonics-Client] - [ERROR] - " + getDate() + " - " + message)
}
module.exports.update = (message) => {
logStream.write("[Subsonics-Update] - " + getDate() + " - " + message + "\n")
console.error("[Subsonics-Update] - " + getDate() + " - " + message)
}
function getDate() {
var date = new Date()
// [Date Format] - Format de la date
var gmonth = date.getMonth()
var gday = date.getDate()
var gHour = date.getHours()
var gMinute = date.getMinutes()
var gSecondes = date.getSeconds()
if(date.getMonth() + 1 <= 9) {
gmonth = "0" + (date.getMonth() + 1)
}
if(date.getDate() + 1 <= 9) {
gday = "0" + date.getDate()
}
if(date.getHours() + 1 <= 9) {
gHour = "0" + date.getHours()
}
if(date.getMinutes() + 1 <= 9) {
gMinute = "0" + date.getMinutes()
}
if(date.getSeconds() + 1 <= 9) {
gSecondes = "0" + date.getSeconds()
}
return date.getFullYear() + "-" + gmonth + "-" + gday + "-" + gHour + "h" + "-" + gMinute + "m" + "-" + gSecondes + "s"
}
process.on('uncaughtException', (err) => {
logStream.write("[" + getDate() + "] - ["+ "FATAL" + "] - [ Subsonics-Manager ]" + " The programm has encountered an error ! Please Restart ! #E = " + err + "\n")
logStream.end( "["+ "UNCAUGHT_EXCEPTION" + "]" + " - [END OF LOGS] - [" + getDate() + ']')
logStream.close()
});
app.on("before-quit", () => {
logStream.end( "["+ "NORMAL_END" + "]" + " - [END OF LOGS] - [" + getDate() + ']')
logStream.close()
})

View File

@ -1,76 +0,0 @@
module.exports.client = (message) => {
var date = new Date()
// [Date Format] - Format de la date
var gmonth = date.getMonth()
var gday = date.getDate()
var gHour = date.getHours()
var gMinute = date.getMinutes()
var gSecondes = date.getSeconds()
if(date.getMonth() + 1 <= 9) {
gmonth = "0" + (date.getMonth() + 1)
}
if(date.getDate() + 1 <= 9) {
gday = "0" + date.getDate()
}
if(date.getHours() + 1 <= 9) {
gHour = "0" + date.getHours()
}
if(date.getMinutes() + 1 <= 9) {
gMinute = "0" + date.getMinutes()
}
if(date.getSeconds() + 1 <= 9) {
gSecondes = "0" + date.getSeconds()
}
var currentDate = date.getFullYear() + "-" + gmonth + "-" + gday + "-" + gHour + "h" + "-" + gMinute + "m" + "-" + gSecondes + "s"
console.log("[Subsonics-Client] - " + currentDate + " - " + message)
}
module.exports.client.error = (message) => {
var date = new Date()
// [Date Format] - Format de la date
var gmonth = date.getMonth()
var gday = date.getDate()
var gHour = date.getHours()
var gMinute = date.getMinutes()
var gSecondes = date.getSeconds()
if(date.getMonth() + 1 <= 9) {
gmonth = "0" + (date.getMonth() + 1)
}
if(date.getDate() + 1 <= 9) {
gday = "0" + date.getDate()
}
if(date.getHours() + 1 <= 9) {
gHour = "0" + date.getHours()
}
if(date.getMinutes() + 1 <= 9) {
gMinute = "0" + date.getMinutes()
}
if(date.getSeconds() + 1 <= 9) {
gSecondes = "0" + date.getSeconds()
}
var currentDate = date.getFullYear() + "-" + gmonth + "-" + gday + "-" + gHour + "h" + "-" + gMinute + "m" + "-" + gSecondes + "s"
console.error("[Subsonics-Client] - [ERROR] - " + currentDate + " - " + message)
}

View File

@ -1,6 +1,6 @@
.logo {
width: 15%;
width: 20%;
border-radius: 100%;
margin-right: 5px;
}
@ -11,7 +11,7 @@
padding: 5%;
color: white;
border-radius: 15px;
background-color: rgb(38, 37, 37);
background-color: #36374c;
font-size: 12px;
justify-content: space-between;
align-items: center;
@ -20,6 +20,51 @@
}
.titlebox {
display: flex;
color: white;
border-radius: 15px;
background-color: #36374c;
font-size: 12px;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 10px;
}
.exitNotShow {
display: none;
}
.number {
font-size: 11px;
color: black;
box-shadow: 1px 1px 5px white;
border: none;
border-radius: 100%;
text-align: center;
justify-content: center;
vertical-align: middle;
width: 14px;
height: 14px;
background-color: white;
margin: 0;
position: absolute; /* Position the badge within the relatively positioned button */
top: 0;
right: -2px;
}
.list {
display: inline-block;
position: relative;
}
.controller-box {
display: flex;
@ -27,13 +72,17 @@
padding: 5%;
color: white;
border-radius: 15px;
background-color: rgb(38, 37, 37);
background-color: #36374c;
font-size: 12px;
justify-content: space-between;
align-items: center;
margin-top: 5px;
}
.searchTitle {
margin: 0;
word-break: break-all;
}
.signout {
@ -60,15 +109,126 @@
color: red;
border: none;
transition: all 0.2s ease 0s;
width: 13%;
}
.act {
display: flex;
flex-direction: row;
}
.settings {
background-color: transparent;
color: white;
border: none;
transition: all 0.2s ease 0s;
height: 30px;
width: 30px;
margin-right: 5px;
}
.settings:hover {
border-radius: 100%;
background-color: rgb(46, 196, 255);
border-color: transparent;
color: black;
}
.settings:active {
background-color: transparent;
color: rgb(46, 196, 255);
border: none;
transition: all 0.2s ease 0s;
}
.restart {
font-family: 'Open Sans', sans-serif !important;
background-color: transparent;
border: solid;
border-radius: 15px;
padding: 2%;
border-color: rgb(46, 196, 255);
color: white;
transition: all 0.2s ease 0s;
}
.restart:hover {
color: black;
background-color: rgb(46, 196, 255);
box-shadow: 2px 2px 5px rgb(46, 196, 255);
}
.restart:active {
background-color: transparent;
color: white;
}
.bug {
font-family: 'Open Sans', sans-serif !important;
background-color: transparent;
border: solid;
border-radius: 15px;
padding: 2%;
border-color: rgb(255, 46, 46);
color: white;
transition: all 0.2s ease 0s;
}
.bug:hover {
background-color: rgb(255, 46, 46);
box-shadow: 2px 2px 5px rgb(255, 46, 46);
}
.bug:active {
background-color: transparent;
}
.stLine {
display: flex;
flex-direction: row;
justify-content: space-between;
text-align: start;
align-items: center;
margin-top: 10px;
}
.stPct {
text-align:end;
padding-left: 3%;
}
.stLine p {
margin: 0;
margin-right: 2%;
}
.online-light {
border-radius: 15%;
background-color: rgb(55, 255, 37);
background-color: #7a258d;
padding: 2%;
color: black;
color: white;
display: flex;
align-items: center;
vertical-align: center;
@ -77,6 +237,12 @@
}
.numtext {
display: inline-block;
padding-top: 2px !important;
padding-left: 1px;
}
.thumbnail {
width: 30px;
@ -84,10 +250,27 @@
margin-right: 10px;
}
.showPicture {
margin-bottom: 10px;
width: 140px;
height: 110px;
}
.title {
text-align: center;
}
word-break: keep-all;
.title p {
margin-bottom: 10px;
}
.grised {
filter : invert(50%);
}
@ -104,29 +287,94 @@
}
.bbar {
width: 100%;
padding: 10%;
padding: 2%;
padding-top: 10%;
display: flex;
display: flex;
text-align: center;
align-items: center;
justify-content: space-between;
padding-bottom: 0;
}
.sbar {
width: 100%;
padding: 1%;
display: flex;
text-align: center;
align-items: center;
justify-content: space-between;
}
.durationText {
margin: 0;
margin-left: 5px;
}
input[type=range] {
height: 26px;
-webkit-appearance: none;
margin: 10px 0;
width: 100%;
background-color: transparent;
-webkit-user-select: none;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
cursor: pointer;
transition: 0.2s;
box-shadow: 1px 1px 2px #000000;
background: #B8B8B8;
border-radius: 50px;
border: 0px solid #000000;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 1px 1px 1px #000000;
border: 1px solid #000000;
height: 13px;
width: 13px;
border-radius: 50px;
background: #FFFFFF;
cursor: pointer;
-webkit-appearance: none;
margin-top: -3px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #B8B8B8;
}
input[type=range]:focus::-webkit-sl {
}
.patchInfo {
padding: 5%;
margin: 0;
}
.secondary {
background-color: #171A21;
background-color: #7a258d;
color: white;
border: none;
border-radius: 100%;
font-size: 30px;
padding: 2%;
padding-right: 7%;
padding-left: 7%;
font-size: 20px;
padding: 1%;
padding-right: 4.5%;
padding-left: 4.5%;
transition: all 0.2s ease 0s;
border: solid;
border-width: 5px;
border-color: #171A21 ;
border-color: #7a258d ;
}
.secondary:active {
@ -137,13 +385,13 @@
.primary {
background-color: white ;
color: #171A21;
color: #7a258d;
border: none;
border-radius: 100%;
font-size: 35px;
padding: 5%;
padding-right: 10%;
padding-left: 10%;
font-size: 20px;
padding: 1%;
padding-right: 2%;
padding-left: 2%;
transition: all 0.2s ease 0s;
border: solid;
border-width: 5px;
@ -202,16 +450,13 @@
}
#listContent {
padding: 5%;
}
.infoVersion {
color: rgb(31, 30, 30);
color: rgb(255, 255, 255);
text-align: center;
font-size: 13px;
font-size: 10px;
}
@ -221,7 +466,22 @@
padding: 5%;
color: white;
border-radius: 15px;
background-color: rgb(61, 61, 61);
background-color: #464862;
font-size: 12px;
justify-content: space-between;
align-items: center;
width: 100%;
}
.favmenu {
border: none;
padding-top: 5%;
padding-bottom: 5%;
color: white;
border-radius: 15px;
background-color: #464862;
font-size: 12px;
justify-content: space-between;
align-items: center;
@ -281,9 +541,56 @@
margin: 0;
vertical-align: middle;
align-items: center;
width: 100%;
padding-left: 5%;
padding-right: 5%;
padding-top: 2%;
padding-bottom: 2%;
justify-content: space-between;
transition: 0.2s;
cursor: pointer;
-webkit-user-select: none;
}
.ressong {
display: flex;
flex-direction: row;
margin: 0;
margin-bottom: 5px;
vertical-align: middle;
align-items: center;
justify-content: space-between;
}
#listDialog {
padding: 0 !important;
padding-bottom: 5% !important;
}
#listDialog .menuheader {
padding: 5%;
}
#listContent {
padding-top: 5%;
padding-bottom: 5%;
}
.song:hover {
background-color: #7a258d ;
}
.titleSong {
width: 100%;
@ -311,4 +618,81 @@
.finder:hover {
box-shadow: 1px 1px 5px white;
}
.cp {
margin: 0;
}
.devversion {
height: 10px;
width: 100%;
background-color: rgb(99, 3, 3);
color: white;
font-size: 10px;
text-align: center;
position: absolute;
bottom: 0;
transition: 0.5s;
}
.devversion:hover {
position: absolute;
content: initial;
height: 40px;
}
.devversion .dp {
display: none;
}
.devversion:hover .dp {
display: initial;
position: absolute;
text-align: center;
bottom: -9px;
right: 25%;
}
.sendChos {
width: 100%;
margin-bottom: 5px;
margin-top: 5px;
border-color: #1c1c1c;
border-radius: 15px;
border-width: 2px;
background-color: transparent;
color: white;
padding: 2%;
}
.sendChos option {
background-color:rgb(61, 61, 61);
}
.sendText {
margin-top: 5px;
width: 100%;
height: 100px;
padding: 5%;
border-radius: 5px;
margin-bottom: 10px;
}
.send {
display: flex;
flex-direction: column;
align-items: center;
}

View File

@ -11,23 +11,18 @@
<body>
<header>
<div class="top-title">
<h1><img class="top-logo rounded" src="../../src/logo.png" alt="Logo"> Subsonics</h1>
<img class="top-logo rounded" src="../../src/logo.png" alt="Logo">
<img class="top-title-image rounded" src="../../src/title.png" alt="Logo">
</div>
<button id="minimizeBtn" class="buttonReduce"><i class="fas fa-window-minimize"></i></button>
<button id="closeBtn" class="buttonClose"><i class="fas fa-times"></i></button>
</header>
<div class="content">
<div class="box">
<span id="music_img"><img class="thumbnail" src="../common/Mediamodifier-Design.svg"></span>
<span id="music_title" class="title">Aucun titre joué</span>
<div class="online-light"><i style="margin-right: 2px;" class="fas fa-user-friends"></i> <span id="online">0</span></div>
</div>
<div class="controller-box">
<span id="music_img"><img class="showPicture" src="../common/Mediamodifier-Design.svg"></span>
<span id="music_title" class="title"><p>Aucun titre joué</p></span>
<div class="playbar">
<button id="backward" class="secondary"><i class="fas fa-step-backward"></i></button>
<button id="play" class="primary"><i class="fas fa-play"></i></button>
@ -35,8 +30,14 @@
</div>
<div class="bbar">
<button id="search" class="third"><i class="fa fa-search"></i></button>
<button id="loop" class="third"><i class="fa fa-retweet"></i></button>
<button id="fav" class="third"><i class="fa fa-star"></i></button>
<span id="exitSpan" class="exit"></span>
<button id="list" class="third"><i class="fa fa-list-ol"></i></button>
<button id="list" class="list third"><i class="fa fa-list-ol"><p class="number" id="listNumber"></p></i></button>
</div>
<div class="sbar">
<input id="duration" type="range" value="0" max="100">
<p id="durationText" class="durationText">0:00/0:00</p>
</div>
</div>
<div class="box">
@ -44,9 +45,27 @@
<span id="logo"><img class="logo" src="../../src/logo.png"></span>
<span id="username"></span>
</div>
<button id="signout" class="signout"><i class="fas fa-sign-out"></i></button>
<div class="act">
<button id="patchnote" class="settings"><i class="fas fa-sticky-note"></i></button>
<button id="settings" class="settings"><i class="fas fa-gear"></i></button>
<button id="signout" class="signout"><i class="fas fa-sign-out"></i></button>
</div>
</div>
</div>
<dialog id="favDialog" class="favmenu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fa fa-star"></i> Favoris</p>
<div>
<button class="buttonClose" id="favClear"><i class="fas fa-trash"></i></button>
<button class="buttonClose" id="favClose"><i class="fas fa-times"></i></button>
</div>
</div>
<div id="favContent">
</div>
</dialog>
<dialog id="listDialog" class="menu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fa fa-list-ol"></i> Liste de lecture</p>
@ -67,14 +86,95 @@
</div>
<input id="searchBar" class="finder" type="text" placeholder="Nom ou lien">
<div id="searchContent">
<div class="searchContent" id="searchContent">
</div>
</dialog>
<div class="infoVersion">
<p >Submanager - Version <span id="version"></span></p>
<p >Fait avec 💖 par Raphix</p>
</div>
<dialog id="stDialog" class="menu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fa fa-gear"></i> Paramètres</p>
<button class="buttonClose" id="stClose"><i class="fas fa-times"></i></button>
</div>
<div class="stLine">
<p>Volume</p>
<input type="range" id="volCursor">
<p class="stPct" id="volPct">0%</p>
</div>
<div class="stLine">
<p>Redémarrer le bot :</p>
<button id="restart" class="bug"><i class="fas fa-power-off"></i> Redémarrer</button>
</div>
<div class="stLine">
<p>Bug / Suggestion :</p>
<button id="bug" class="restart"><i class="fas fa-paper-plane"></i> Envoyer</button>
</div>
<div class="stLine">
<p>Forcer la mise à jour :</p>
<button id="upd" class="restart"><i class="fas fa-download"></i> Mettre à jour</button>
</div>
<div class="stLine">
<p>Canal de mise à jour :</p>
<div style="display: flex; flex-direction: row;">
<div style="display: flex; flex-direction: row;">
<input type="radio" id="cStable">
<p style="margin-right: 20px;">Stable</p>
</div>
<div style="display: flex; flex-direction: row; ">
<input type="radio" id="cDev">
<p>Dev</p>
</div>
</div>
</div>
<div style="display: flex; justify-content: space-between; margin-top: 50px;">
<div class="infoVersion">
<p class="cp">Version <span id="version"></span></p>
<p style="margin: 0;">Réalisé par Raphix</p>
</div>
<div class="online-light">
<i style="margin-right: 2px;" class="fas fa-user-friends"></i>
<span id="online">0</span>
</div>
</div>
</dialog>
<dialog id="updDialog" class="menu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fas fa-download"></i> Forcer la mise à jour</p>
<button class="buttonClose" id="updClose"><i class="fas fa-times"></i></button>
</div>
<div class="updContent">
<p style="color: yellow;"><i class="fas fa-warning"></i> Attention, forcer une mise à jour peut aider à réinstaller l'application. Avant de faire cela, demander à Raphix.</p>
<span id="updSpan"></span>
</div>
</dialog>
<dialog id="patchDialog" class="menu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fas fa-sticky-note"></i> Patch Note</p>
<button class="buttonClose" id="patchClose"><i class="fas fa-times"></i></button>
</div>
<span class="patchInfo" id="patchInfo">
</span>
</dialog>
<dialog id="sendDialog" class="menu">
<div class="menuheader">
<p class="listHeader"><i style="margin-right: 3px" class="fas fa-paper-plane"></i> Bug / Suggestion</p>
<button class="buttonClose" id="sendClose"><i class="fas fa-times"></i></button>
</div>
<span class="send" id="sendContent">
<select class="sendChos" id="sendChos">
<option>Bug</option>
<option>Suggestion</option>
</select>
<textarea class="sendText" id="sendText" placeholder="Descrpition"></textarea>
<span id="sendInfo" class="sendInfo"></span>
<button id="sendSend" class="restart"><i class="fas fa-paper-plane"></i> Envoyez</button>
</span>
</dialog>
<span class="devversion" id="devversion"></span>
<script src="../common/bundle.js"></script>

View File

@ -1,7 +1,7 @@
const {ipcRenderer} = require("electron");
const ipc = ipcRenderer;
const fs = require("fs")
const packageJson = require("../../package.json")
const packageJson = require(__dirname.replace("templates" + require("path").sep + "app", "") + "package.json")
const logo = document.getElementById("logo")
const username = document.getElementById("username")
@ -17,6 +17,7 @@ const listDialog = document.getElementById("listDialog")
const listClose = document.getElementById("listClose")
const listClear = document.getElementById("listClear")
const listcontent = document.getElementById("listContent")
const listNumber = document.getElementById("listNumber")
const search = document.getElementById("search")
const searchBar = document.getElementById("searchBar")
@ -24,6 +25,377 @@ const searchDialog = document.getElementById("searchDialog")
const searchClose = document.getElementById("searchClose")
const searchcontent = document.getElementById("searchContent")
const durationBar = document.getElementById("duration")
const durationText = document.getElementById("durationText")
const stDialog = document.getElementById("stDialog")
const settings = document.getElementById("settings")
const stClose = document.getElementById("stClose")
const patchDialog = document.getElementById("patchDialog")
const patchnote = document.getElementById("patchnote")
const patchClose = document.getElementById("patchClose")
const patchInfo = document.getElementById("patchInfo")
const sendDialog = document.getElementById("sendDialog")
const send = document.getElementById("bug")
const sendClose = document.getElementById("sendClose")
const sendContent = document.getElementById("sendContent")
const sendInfo = document.getElementById("sendInfo")
const sendSend = document.getElementById("sendSend")
const sendText = document.getElementById("sendText")
const sendChos = document.getElementById("sendChos")
const volCursor = document.getElementById("volCursor")
const volPct = document.getElementById("volPct")
const restart = document.getElementById("restart")
const updDialog = document.getElementById("updDialog")
const upd = document.getElementById("upd")
const updClose = document.getElementById("updClose")
const updSpan = document.getElementById("updSpan")
const favDialog = document.getElementById("favDialog")
const fav = document.getElementById("fav")
const favClose = document.getElementById("favClose")
const favClear = document.getElementById("favClear")
const favContent = document.getElementById("favContent")
const cStable = document.getElementById("cStable")
const cDev = document.getElementById("cDev")
cDev.addEventListener("change", () => {
const settings = getSettings()
settings["canaldev"] = true
saveSettings(settings)
cStable.checked = false
cDev.checked = true
})
cStable.addEventListener("change", () => {
const settings = getSettings()
settings["canaldev"] = false
saveSettings(settings)
cDev.checked = false
cStable.checked = true
})
fav.addEventListener("click", () => {
favDialog.showModal()
showFavoris()
})
favClear.addEventListener("click", () => {
const settings = getSettings()
settings.favoris = []
saveSettings(settings)
showFavoris()
})
function showFavoris() {
const settings = getSettings()
var contentToPush = new Array()
for(var title of settings.favoris) {
contentToPush.push('<div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button style="margin : 0;" id="' + settings.favoris.indexOf(title) + '_fadd" class="buttonReduce"><i class="fa fa-plus"></i></button> <button id="' + settings.favoris.indexOf(title) + '_fdelete" class="buttonClose"><i class="fa fa-trash"></i></button> </div></div>')
}
if(contentToPush.join("") == "") {
favContent.innerHTML = '<p class="error">Aucun morceau dans les favoris !</p>'
} else {
favContent.innerHTML = contentToPush.join("")
}
for(var title of settings.favoris) {
const titleBtn = document.getElementById(settings.favoris.indexOf(title) + "_fdelete")
const addBtn = document.getElementById(settings.favoris.indexOf(title) + "_fadd")
addBtn.addEventListener("click", () => {
ipc.send("addQueue", settings.favoris[addBtn.id.replace("_fadd", "")].uri)
favDialog.close()
})
titleBtn.addEventListener("click", () => {
settings.favoris.splice(titleBtn.id.replace("_fdelete", ""), 1)
saveSettings(settings)
showFavoris()
})
}
}
favClose.addEventListener("click", () => {
favDialog.close()
})
upd.addEventListener("click", () => {
updDialog.showModal()
updSpan.innerHTML = ""
setTimeout(() => {
updSpan.innerHTML = '<button style="margin-left: 25%;" id="updYes" class="bug"><i class="fas fa-warning"></i> Mettre à jour</button>'
const updYes = document.getElementById("updYes")
updYes.addEventListener("click", () => {
ipc.send("forceUpdate")
})
}, 2000)
})
updClose.addEventListener("click", () => {
updDialog.close()
})
restart.addEventListener("click", () => {
stDialog.close()
ipc.send("restart")
})
if(packageJson.dev == true) {
document.getElementById("devversion").innerHTML = "<p class='dp'>Cette version est expérimentale.<br> En cas de bug, <a style='cursor: pointer;text-decoration: underline;' id='bugD'>cliquez ici </a> </p>"
const sendB = document.getElementById("bugD")
sendB.addEventListener("click", () => {
sendInfo.innerHTML = ""
sendText.value = ""
sendChos.value = "Bug"
sendDialog.showModal()
})
} else {
document.getElementById("devversion").innerHTML = ""
document.getElementById("devversion").classList.remove("devversion")
}
var durationAll = 0
var durationProgress = 0
var isPlaying = false
patchnote.addEventListener("click", () => {
patchDialog.showModal()
const data = fs.readFileSync(__dirname + require("path").sep + "../../infoupdate.html")
patchInfo.innerHTML = data
})
patchClose.addEventListener("click", () => {
patchDialog.close()
})
settings.addEventListener("click", () => {
stDialog.showModal()
const Csettings = getSettings()
if(Csettings.canaldev == true) {
cStable.checked = false
cDev.checked = true
} else {
cDev.checked = false
cStable.checked = true
}
})
stClose.addEventListener("click", () => {
stDialog.close()
})
send.addEventListener("click", () => {
sendInfo.innerHTML = ""
sendText.value = ""
sendChos.value = "Bug"
sendDialog.showModal()
})
sendClose.addEventListener("click", () => {
sendDialog.close()
})
sendSend.addEventListener("click", () => {
sendInfo.innerHTML = ""
if(sendText.value == "") {
sendInfo.innerHTML = '<p style="text-align: center; color: red;">Le formulaire n\'a pas été rempli correctement !</p>'
} else {
const report = {
"type":sendChos.value,
"text": sendText.value
}
ipc.send("report", report)
}
})
ipc.on("reportForm", (ev, ans) => {
if(ans == true) {
sendInfo.innerHTML = '<p style="text-align: center;">Le formulaire a été envoyé !</p>'
} else {
sendInfo.innerHTML = '<p style="text-align: center; color: red;">Erreur lors de l\'envoi du formulaire !</p>'
}
})
durationBar.value = 0
listNumber.classList.add("exitNotShow")
function setTime() {
durationBar.max = durationAll
durationProgress += 1000
durationBar.value = durationProgress
const maxhours = Math.floor(durationAll / 3600000);
const nowhours = Math.floor(durationProgress / 3600000);
var maxmin = Math.trunc(durationAll / 60000) - (Math.floor(durationAll / 60000 / 60) * 60);
var maxsec = Math.floor(durationAll / 1000) - (Math.floor(durationAll / 1000 / 60) * 60);
var nowmin = Math.trunc(durationProgress / 60000) - (Math.floor(durationProgress / 60000 / 60) * 60);
var nowsec = Math.floor(durationProgress / 1000) - (Math.floor(durationProgress / 1000 / 60) * 60);
console.log(durationAll)
console.log(durationProgress)
console.log("---------------------")
var now = ""
var max = ""
if (maxmin < 10) {
maxmin = `0${maxmin}`;
}
if (nowmin < 10) {
nowmin = `0${nowmin}`;
}
if (maxsec < 10) {
maxsec = `0${maxsec}`;
}
if (nowsec < 10) {
nowsec = `0${nowsec}`;
}
if(maxhours != 0) {
max = maxhours + ":" + maxmin + ":" + maxsec
} else {
max = maxmin + ":" + maxsec
}
if(nowhours != 0) {
now = nowhours + ":" + nowmin + ":" + nowsec
} else {
now = nowmin + ":" + nowsec
}
durationText.innerHTML = now + "/" + max
}
setInterval(() => {
if(isPlaying == true) {
setTime()
}
}, 1000)
durationBar.addEventListener("change", () => {
ipc.send("seek", durationBar.value)
})
volCursor.addEventListener("change", () => {
ipc.send("volume", volCursor.value)
})
const loop = document.getElementById("loop")
loop.addEventListener("click", () => {
ipc.send("loop")
})
listClear.addEventListener("click", () => {
ipc.send("listClear")
@ -38,7 +410,6 @@ searchBar.addEventListener("change", () => {
})
ipc.on("findResult", (ev, list) => {
if(list.tracks != null) {
const data = list.tracks
@ -49,7 +420,7 @@ ipc.on("findResult", (ev, list) => {
for(var title of data) {
contentToPush.push(' <div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="searchTitle">' + title.title + '</p></div> <button id="' + data.indexOf(title) + '_add" class="buttonReduce"><i class="fa fa-plus"></i></button> </div>')
contentToPush.push(' <div class="ressong"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="searchTitle">' + title.title + '</p></div><button id="' + data.indexOf(title) + '_sfav" class="buttonFav"><i class="fa fa-star"></i></button> <button id="' + data.indexOf(title) + '_sadd" class="buttonReduce"><i class="fa fa-plus"></i></button></div>')
}
if(contentToPush.join("") == "") {
@ -65,13 +436,51 @@ ipc.on("findResult", (ev, list) => {
const titleBtn = document.getElementById(data.indexOf(title)+ "_add")
const titleBtn = document.getElementById(data.indexOf(title)+ "_sadd")
const favBtn = document.getElementById(data.indexOf(title)+ "_sfav")
titleBtn.addEventListener("click", () => {
searchDialog.close()
searchcontent.innerHTML = ""
searchBar.value = ""
ipc.send("addQueue", data[titleBtn.id.replace("_add", "")].uri)
ipc.send("addQueue", data[titleBtn.id.replace("_sadd", "")].uri)
})
favBtn.addEventListener("click", () => {
const settings = getSettings()
if(settings.favoris == null) {
settings["favoris"] = []
}
var check = false
for(var song of settings.favoris) {
if(song.uri == data[favBtn.id.replace("_sfav", "")].uri) {
check = true
}
}
if(check == false) {
settings.favoris.push(data[favBtn.id.replace("_sfav", "")])
} else {
console.log("ALREADY ADDED")
}
saveSettings(settings)
searchDialog.close()
})
}
@ -84,6 +493,22 @@ ipc.on("findResult", (ev, list) => {
})
const path = require("path");
const { off } = require("process");
const { copySync } = require("fs-extra");
function getSettings() {
return require("../../settings.json")
}
function saveSettings(doc) {
fs.writeFileSync(__dirname.replace("templates" + path.sep + "app", "settings.json"), JSON.stringify(doc, null, 2))
}
list.addEventListener("click", () => {
listDialog.showModal()
@ -99,6 +524,8 @@ listClose.addEventListener("click", () => {
search.addEventListener("click", () => {
searchDialog.showModal()
searchcontent.innerHTML = ""
searchBar.value = ""
})
@ -151,19 +578,39 @@ forward.addEventListener("click" ,() => {
})
ipc.on("actualize", (ev, data) => {
isPlaying = false
console.log(data)
onlineNumber.innerHTML = data.onlineNumber
if(data.playing == 1) {
play.innerHTML = '<i style="width: 25px; height: 25px" class="fas fa-pause"></i>'
if(data.loop == true) {
loop.innerHTML = '<i class="third-join fa fa-retweet"></i>'
} else {
play.innerHTML = '<i style="width: 25px; height: 25px" class="fas fa-play"></i>'
loop.innerHTML = '<i class="fa fa-retweet"></i>'
}
if(data.volume) {
volCursor.step = 1
volCursor.max = 200
volCursor.value = Math.trunc(data.volume / 10)
volPct.innerHTML = Math.trunc(data.volume / 10) + "%"
} else {
volCursor.disabled = true
volCursor.classList.add("grised")
volCursor.value = 0
volPct.innerHTML = "0%"
}
if(data.isOnline == true) {
exitSpan.classList.remove("exitNotShow")
loop.classList.remove("exitNotShow")
exitSpan.innerHTML = ' <button id="exit" class="third-leave"><i class="fa fa-phone-slash"></i></button>'
const exit = document.getElementById("exit")
@ -173,9 +620,24 @@ ipc.on("actualize", (ev, data) => {
ipc.send("exitBot")
})
} else {
volCursor.disabled = false
volCursor.classList.remove("grised")
durationBar.disabled = false
durationBar.classList.remove("grised")
} else {
exitSpan.classList.add("exitNotShow")
loop.classList.add("exitNotShow")
exitSpan.innerHTML = ""
durationBar.disabled = true
durationBar.classList.add("grised")
durationBar.value = 0
volCursor.disabled = true
volCursor.classList.add("grised")
volCursor.value = 0
}
@ -183,19 +645,23 @@ ipc.on("actualize", (ev, data) => {
if(data.queue != null) {
var contentToPush = new Array()
var queueNum = 0
for(var title of data.queue) {
queueNum += 1
console.log(queueNum)
console.log(data.queue.indexOf(title) + " - " + title.title)
contentToPush.push(' <div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button id="' + data.queue.indexOf(title) + '_delete" class="buttonClose"><i class="fa fa-trash"></i></button> </div>')
contentToPush.push(' <div class="song"> <img class="thumbnail" src="' + title.thumbnail + '"><div class="titleSong"> <p class="listTitle">' + title.title + '</p></div> <button id="' + data.queue.indexOf(title) + '_lmove" class="buttonReduce"><i class="fa fa-arrow-up"></i></button> <button id="' + data.queue.indexOf(title) + '_ldelete" class="buttonClose"><i class="fa fa-trash"></i></button> </div></div>')
}
if(contentToPush.join("") == "") {
listNumber.classList.add("exitNotShow")
listcontent.innerHTML = '<p class="error">Aucun morceau dans la liste de lecture !</p>'
} else {
listNumber.innerHTML = '<span class="numtext">' + queueNum + '</span>'
listNumber.classList.remove("exitNotShow")
listcontent.innerHTML = contentToPush.join("")
}
@ -203,11 +669,18 @@ ipc.on("actualize", (ev, data) => {
console.log(data.queue.indexOf(title) + " - " + title.title)
const titleBtn = document.getElementById(data.queue.indexOf(title)+ "_delete")
const titleBtn = document.getElementById(data.queue.indexOf(title)+ "_ldelete")
const moveBtn = document.getElementById(data.queue.indexOf(title)+ "_lmove")
titleBtn.addEventListener("click", () => {
ipc.send("deleteQueue", titleBtn.id.replace("_delete", ""))
ipc.send("deleteQueue", titleBtn.id.replace("_ldelete", ""))
})
moveBtn.addEventListener("click", () => {
ipc.send("moveQueue", moveBtn.id.replace("_lmove", ""))
})
}
@ -215,18 +688,72 @@ ipc.on("actualize", (ev, data) => {
} else {
listcontent.innerHTML = '<p class="error">Aucun morceau dans la liste de lecture !</p>'
listNumber.classList.add("exitNotShow")
}
if(data.current == null) {
musicURL.innerHTML = '<img class="thumbnail" src="../common/Mediamodifier-Design.svg">'
musicTitle.innerHTML = "Aucun titre joué"
musicURL.innerHTML = '<img class="showPicture" src="../common/Mediamodifier-Design.svg">'
musicTitle.innerHTML = "<p>Aucun titre joué</p>"
} else {
setTime()
musicURL.innerHTML = '<img class="showPicture" src="' + data.current.thumbnail + '">'
musicTitle.innerHTML = "<p>" + data.current.title + "</p>"
}
durationProgress = 0
durationAll = 0
durationBar.value = 0
durationText.innerHTML = "=:==/=:=="
if(data.durationAll) {
isPlaying = true
durationBar.disabled = false
durationBar.classList.remove("grised")
setTime()
durationAll = data.durationAll
durationProgress = data.durationNow
durationBar.value = durationProgress
} else {
musicURL.innerHTML = '<img class="thumbnail" src="' + data.current.thumbnail + '">'
musicTitle.innerHTML = data.current.title
isPlaying = false
durationAll = 0
durationProgress = 0
durationBar.disabled = true
durationBar.classList.add("grised")
durationBar.value = 0
durationText.innerHTML = "=:==/=:=="
}
if(data.playing == 1) {
play.innerHTML = '<i style="width: 25px; height: 25px" class="fas fa-pause"></i>'
isPlaying = true
setTime()
} else {
play.innerHTML = '<i style="width: 25px; height: 25px" class="fas fa-play"></i>'
isPlaying = false
}
if(data.current && data.playing == 0) {
setTime()
}
})
ipc.on("updateData", (ev, data) => {

View File

@ -3,7 +3,7 @@
body {
background-color: #92bcea !important;
background-color: #302144 !important;
font-family: 'Open Sans', sans-serif !important;
}
@ -18,18 +18,21 @@ body {
-webkit-app-region: drag;
width: 100%;
padding: 5% !important;
padding-bottom: 0% !important;
color: white;
margin-bottom: 5px;
}
.top-logo {
width: 15%;
margin-left: 20px;
}
.buttonClose {
background-color: transparent;
@ -49,6 +52,15 @@ body {
}
.top-title-image {
width: 80%;
margin-top: 6px;
margin-right: 20px;
margin-left: 4px;
}
.buttonClose:hover {
color: red;
@ -97,5 +109,36 @@ header {
.content {
padding: 5%;
padding-top: 0;
}
.buttonFav {
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: 13px;
color: white;
text-decoration: none;
-webkit-app-region: no-drag;
margin: 0;
outline: none;
}
.buttonFav:hover {
color: rgb(242, 255, 53);
}
.buttonFav:active {
color: rgb(255, 255, 255);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -5,15 +5,16 @@
border: solid;
border-radius: 15px;
padding: 2%;
border-color: #afb3f7;
border-color: rgb(46, 196, 255);
color: white;
transition: all 0.2s ease 0s;
}
.buttonTryAgain:hover {
background-color: #afb3f7;
box-shadow: 2px 2px 5px #afb3f7;
color: black;
background-color: rgb(46, 196, 255);
box-shadow: 2px 2px 5px rgb(46, 196, 255);
}
.buttonTryAgain:active {
@ -21,6 +22,10 @@
background-color: transparent;
}
.top-title {
padding: 5% !important;
}
.box {
@ -28,11 +33,11 @@
text-align: center;
display: flex;
flex-direction: column;
background-color: rgb(122, 147, 172);
background-color: #36374c;
padding: 10%;
color: white;
border-radius: 15px;
box-shadow: 2px 2px 5px rgb(122, 147, 172) ;
box-shadow: 2px 2px 5px #36374c ;
-webkit-user-select: none;
user-select: none;
@ -71,6 +76,6 @@
.infoSpan {
color: rgb(40, 40, 40);
color: white;
font-size: 12px;
}

View File

@ -11,7 +11,8 @@
<body>
<header>
<div class="top-title">
<h1><img class="top-logo rounded" src="../../src/logo.png" alt="Logo"> Subsonics</h1>
<img class="top-logo rounded" src="../../src/logo.png" alt="Logo">
<img class="top-title-image rounded" src="../../src/title.png" alt="Logo">
</div>
<button id="minimizeBtn" class="buttonReduce"><i class="fas fa-window-minimize"></i></button>
<button id="closeBtn" class="buttonClose"><i class="fas fa-times"></i></button>

View File

@ -12,8 +12,12 @@ const minimizeBtn = document.getElementById("minimizeBtn")
document.getElementById("version").innerHTML = packageJson.version
ipc.on("needRetry", () => {
ipc.send("retryLogin")
ipc.send("retryLogin")
})
ipc.send("stateOfConnection")
closeBtn.addEventListener("click", () => {
@ -30,9 +34,10 @@ minimizeBtn.addEventListener("click", () => {
ipc.on("connectSuccess", () => {
content.innerHTML = '<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 id="discord-span" class="actionsSpan"><button id="discord-connect" class="buttonTryAgain">Vérifier</button></span> </div> </div>'
content.innerHTML = '<div class="content"> <div class="box"> <p>Connexion vers Discord</p> <span id="discordLogoSpan" 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 id="discord-span" class="actionsSpan"><button id="discord-connect" class="buttonTryAgain">Vérifier</button></span> </div> </div>'
const discordconnect = document.getElementById("discord-connect")
const discorSpan = document.getElementById("discord-span")
const discordLogoSpan = document.getElementById("discordLogoSpan")
discordconnect.addEventListener("click", () => {
@ -45,7 +50,20 @@ ipc.on("connectSuccess", () => {
discorSpan.innerHTML = '<button id="discord-connect" class="buttonTryAgain">Vérifier</button>'
const reDiscord = document.getElementById("discord-connect")
reDiscord.addEventListener("click", () => {
discordLogoSpan.innerHTML = '<img class="discord-logo" src="../common/discord-icon-svgrepo-com.svg">'
discorSpan.innerHTML = '<img style="width: 5%; height: 5%;" class="loading" src="../common/spinner-third-svgrepo-com.svg">'
ipc.send("discordlogin")
})
}),
ipc.on("discordCheckFailed", () => {
discorSpan.innerHTML = '<button id="discord-connect" class="buttonTryAgain">Vérifier</button>'
discordLogoSpan.innerHTML = "<p style='font-size: 16px; color: red;'>Vérification échouée : Vous n'êtes pas sur le serveur de Code Luc Player ou vous n'avez pas le Code Scipio</p>"
const reDiscord = document.getElementById("discord-connect")
reDiscord.addEventListener("click", () => {
discordLogoSpan.innerHTML = '<img class="discord-logo" src="../common/discord-icon-svgrepo-com.svg">'
discorSpan.innerHTML = '<img style="width: 5%; height: 5%;" class="loading" src="../common/spinner-third-svgrepo-com.svg">'
ipc.send("discordlogin")
})

View File

@ -0,0 +1,87 @@
.top-title {
padding: 5% !important;
}
.box {
text-align: center;
display: flex;
flex-direction: column;
background-color: #36374c;
padding: 10%;
color: white;
border-radius: 15px;
box-shadow: 2px 2px 5px #36374c ;
-webkit-user-select: none;
user-select: none;
align-items: center
}
.loading {
width: 30%;
height: 30%;
filter: invert(1)
}
.loadingRot {
-webkit-animation: rotating 1s linear infinite;
animation: rotating 1s linear infinite;
text-align: center;
;
}
.loadingSpan {
font-size: 20vw;
}
.infoSpan {
color: white;
font-size: 12px;
}
@-webkit-keyframes rotating {
from{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to{
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.buttonTryAgain {
font-family: 'Open Sans', sans-serif !important;
background-color: transparent;
border: solid;
border-radius: 15px;
padding: 2%;
border-color: rgb(46, 196, 255);
color: white;
transition: all 0.2s ease 0s;
}
.buttonTryAgain:hover {
color: black;
background-color: rgb(46, 196, 255);
box-shadow: 2px 2px 5px rgb(46, 196, 255);
}
.buttonTryAgain:active {
background-color: transparent;
}

View File

@ -0,0 +1,36 @@
<!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/common.css">
<link rel="stylesheet" href="update.css">
</head>
<body>
<header>
<div class="top-title">
<img class="top-logo rounded" src="../../src/logo.png" alt="Logo">
<img class="top-title-image rounded" src="../../src/title.png" alt="Logo">
</div>
</header>
<div id="content">
<div class="content">
<div class="box">
<p>Mise à jour de l'application</p>
<span id="loadingSpan" class="loadingSpan"><img class="loading" src="../common/mettre-a-jour.png"></span>
<br>
<p id="infoSpan" class="infoSpan">Veuillez patienter pendant que l'application se met à jour !</p>
<span class="infoSpan"><p>Submanager - Version : <span id="version"></span></p></span>
<span id="load"><img style="width: 5%; height: 5%;" class="loadingRot" src="../common/spinner-third-svgrepo-com.svg"></span>
</div>
</div>
</div>
<script src="../common/bundle.js"></script>
<script src="update.js"></script>
</body>
</html>

View File

@ -0,0 +1,29 @@
const {ipcRenderer} = require("electron");
const packageJson = require("../../package.json")
const ipc = ipcRenderer;
const fs = require("fs")
const loadingSpan = document.getElementById("loadingSpan")
const infoSpan = document.getElementById("infoSpan")
const load = document.getElementById("load")
document.getElementById("version").innerHTML = packageJson.version
ipc.on("error", () => {
loadingSpan.innerHTML = "<i class='fa fa-times'></i>"
load.innerHTML = "<button style='padding: 10%;' class='buttonTryAgain' id='close'>Fermer</button>"
infoSpan.innerHTML = 'Une erreur est apparue lors de la mise à jour, fermez puis relancez !'
const close = document.getElementById("close")
close.addEventListener("click", () => {
ipc.send("close")
})
})

158
updatetools.js Normal file
View File

@ -0,0 +1,158 @@
const log = require("./sub-log")
const { BrowserWindow, app, ipcMain } = require("electron")
const https = require('https');
const fs = require('fs');
const fse = require('fs-extra');
const BWin = BrowserWindow
const path = require("path")
const decompress = require('decompress');
function getSettings() {
var settings = {}
settings.canaldev = null
if(fs.existsSync(__dirname + path.sep + "settings.json")){
settings = JSON.parse(fs.readFileSync(__dirname + path.sep + "settings.json"))
}
return settings
}
module.exports.checkUpdate = () => {
var settings = getSettings()
log.update("Verification des mises a jour ... Processing !")
if(settings.canaldev == true) {
fetch("https://git.raphix.fr/subsonics/manager/raw/branch/main/package.json").catch(err => catchError(err)).then(resp => resp.json()).then(resp => checkUpdateProcessing(resp))
} else {
fetch("https://git.raphix.fr/subsonics/manager/raw/branch/stable/package.json").catch(err => catchError(err)).then(resp => resp.json()).then(resp => checkUpdateProcessing(resp))
}
}
function checkUpdateProcessing(serverPackage) {
const clientPackage = require("./package")
if(serverPackage.version.replace(".", "") > clientPackage.version.replace(".", "")) {
log.update("Verification des mises a jour ... Finish !")
log.update("Mise a jour disponible ! Nouvelle version : " + serverPackage.version + " - Client : " + clientPackage.version + " - Git : " + serverPackage.version)
selfUpdate()
} else {
log.update("Verification des mises a jour ... Finish !")
log.update("Cette version est la derniere version ! - Client : " + clientPackage.version + " - Git : " + serverPackage.version)
}
}
function selfUpdate() {
var settings = getSettings()
const win = BWin.getFocusedWindow()
var link = "https://git.raphix.fr/subsonics/manager/archive/stable.tar.gz"
if(settings.canaldev == true) {
link = "https://git.raphix.fr/subsonics/manager/archive/main.tar.gz"
}
win.loadFile("templates/update/update.html")
ipcMain.on("close", () => {
app.quit()
})
log.update("Telechargement de la mise a jour ... Processing !")
if(fs.existsSync(__dirname + path.sep + "update.tar.gz")) {
fs.rmSync(__dirname + path.sep + "update.tar.gz")
}
const updatePack = fs.createWriteStream(__dirname + path.sep + "update.tar.gz");
const request = https.get(link, function(response) {
response.pipe(updatePack);
// after download completed close filestream
updatePack.on("finish", () => {
updatePack.close();
log.update("Telechargement de la mise a jour ... Finish !")
install(__dirname + path.sep + "update.tar.gz")
});
updatePack.on("error", (err) => {
log.update("Erreur lors du telechargement de la mise a jour !")
updatePack.close();
console.log(err)
})
});
}
module.exports.update = () => {
selfUpdate()
}
function install(filename) {
log.update("Extraction de la mise a jour ... Processing !")
decompress(filename, __dirname).then(files => {
log.update("Extraction de la mise a jour ... Finish !")
log.update("Installation de la mise a jour ... Processing !")
fse.copy(__dirname + path.sep + "manager", __dirname, { overwrite: true }, () => {
fs.rm(filename, () => {
fs.rm(__dirname + path.sep + "manager", { recursive: true, force: true }, (err) => {
if(err) {
console.log(err)
}
log.update("Installation de la mise a jour ... Finish !")
log.update("Redemarrage de l'application.")
app.relaunch()
app.exit()
})
})
})
}).catch(err => catchError(err, true));
}
function catchError(err, inUp) {
log.update("Erreur lors de la verification des mises a jour !")
log.update(err)
if(inUp == true) {
win.webContents.send("error")
}
}