2.0.8 PreRelease Version
This commit is contained in:
		
							
								
								
									
										2
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.js
									
									
									
									
									
								
							@@ -3,7 +3,7 @@ const path = require("path")
 | 
			
		||||
const fs = require("fs")
 | 
			
		||||
const ipc = ipcMain
 | 
			
		||||
const { io } = require("socket.io-client");
 | 
			
		||||
const log = require("./sublog");
 | 
			
		||||
const log = require("./sub-log");
 | 
			
		||||
const updater = require("./updatetools")
 | 
			
		||||
 | 
			
		||||
// [Function] Main Window Function
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "subsonics-manager",
 | 
			
		||||
  "version": "2.0.7",
 | 
			
		||||
  "version": "2.0.8",
 | 
			
		||||
  "description": "Manager for subsonics",
 | 
			
		||||
  "main": "main.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										86
									
								
								sub-log.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								sub-log.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
const fs = require("fs")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(!fs.existsSync("logs/")) {
 | 
			
		||||
    fs.mkdirSync("logs")
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
var logStream = fs.createWriteStream("logs/" + 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()
 | 
			
		||||
     
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
process.on('beforeExit', () => {
 | 
			
		||||
    logStream.end( "["+ "NORMAL_END" + "]" + " - [END OF LOGS] - [" + getDate() + ']')
 | 
			
		||||
    logStream.close()
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										114
									
								
								sublog.js
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								sublog.js
									
									
									
									
									
								
							@@ -1,114 +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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports.update = (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-Update] - " + currentDate + " - " + message)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
const log = require("./sublog")
 | 
			
		||||
const log = require("./sub-log")
 | 
			
		||||
const { BrowserWindow, app, ipcMain } = require("electron")
 | 
			
		||||
const https = require('https');
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
@@ -43,7 +43,7 @@ function update() {
 | 
			
		||||
        app.quit()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    log.update("Telechargement de la mise à jour ... Processing !")
 | 
			
		||||
    log.update("Telechargement de la mise a jour ... Processing !")
 | 
			
		||||
 | 
			
		||||
    if(fs.existsSync(__dirname + path.sep + "update.tar.gz")) {
 | 
			
		||||
        
 | 
			
		||||
@@ -57,14 +57,14 @@ function update() {
 | 
			
		||||
    // after download completed close filestream
 | 
			
		||||
        updatePack.on("finish", () => {
 | 
			
		||||
            updatePack.close();
 | 
			
		||||
            log.update("Telechargement de la mise à jour ... Finish !")
 | 
			
		||||
            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 à jour !")
 | 
			
		||||
            log.update("Erreur lors du telechargement de la mise a jour !")
 | 
			
		||||
            updatePack.close();
 | 
			
		||||
            console.log(err)
 | 
			
		||||
           
 | 
			
		||||
@@ -81,10 +81,10 @@ function update() {
 | 
			
		||||
 | 
			
		||||
function install(filename) {
 | 
			
		||||
 | 
			
		||||
    log.update("Extraction de la mise à jour ... Processing !")
 | 
			
		||||
    log.update("Extraction de la mise a jour ... Processing !")
 | 
			
		||||
    decompress(filename, __dirname).then(files => {
 | 
			
		||||
        log.update("Extraction de la mise à jour ... Finish !")
 | 
			
		||||
        log.update("Installation de la mise à jour ... Processing !")
 | 
			
		||||
        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) => {
 | 
			
		||||
@@ -94,8 +94,8 @@ function install(filename) {
 | 
			
		||||
                        console.log(err)
 | 
			
		||||
                    }
 | 
			
		||||
    
 | 
			
		||||
                    log.update("Installation de la mise à jour ... Finish !")
 | 
			
		||||
                    log.update("Rédémarrage de l'application.")
 | 
			
		||||
                    log.update("Installation de la mise a jour ... Finish !")
 | 
			
		||||
                    log.update("Redemarrage de l'application.")
 | 
			
		||||
                    app.relaunch()
 | 
			
		||||
                    app.exit()
 | 
			
		||||
                })
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user