Fixed Deprecation errors
authorRemixDev <DeezloaderRemix@gmail.com>
Fri, 21 Sep 2018 13:29:06 +0000 (15:29 +0200)
committerRemixDev <DeezloaderRemix@gmail.com>
Fri, 21 Sep 2018 13:29:06 +0000 (15:29 +0200)
app/app.js
app/deezer-api.js
app/main.js
app/package.json
package.json

index a9926c1b4877b9664ca6aef572ed961a5a6958ab..c6c7c51de966607077e91d484d7a0829c620ec33 100644 (file)
@@ -71,21 +71,21 @@ var ekey = "62I9smDurjvfOdn2JhUdi99yeoAhxikw";
 
 function alencrypt(input) {
        let iv = crypto.randomBytes(16);
-       let data = new Buffer(input).toString('binary');
-       key = new Buffer(ekey, "utf8");
+       let data = Buffer.from(input).toString('binary');
+       key = Buffer.from(ekey, "utf8");
        let cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
        let encrypted;
        encrypted =  cipher.update(data, 'utf8', 'binary') +  cipher.final('binary');
-       let encoded = new Buffer(iv, 'binary').toString('hex') + new Buffer(encrypted, 'binary').toString('hex');
+       let encoded = Buffer.from(iv, 'binary').toString('hex') + Buffer.from(encrypted, 'binary').toString('hex');
 
        return encoded;
 }
 
 function aldecrypt(encoded) {
-       let combined = new Buffer(encoded, 'hex');
-       key = new Buffer(ekey, "utf8");
+       let combined = Buffer.from(encoded, 'hex');
+       key = Buffer.from(ekey, "utf8");
        // Create iv
-       let iv = new Buffer(16);
+       let iv = Buffer.alloc(16);
        combined.copy(iv, 0, 0, 16);
        edata = combined.slice(16).toString('binary');
        // Decipher encrypted data
index e66ddfb072d888b02ddc07cc373c5dcc96fde328..299efcdc8fdb1a769ef8e65562b253d3d487a487 100644 (file)
@@ -472,10 +472,10 @@ Deezer.prototype.hasTrackAlternative = function(id, callback) {
 Deezer.prototype.getDownloadUrl = function(md5Origin, id, format, mediaVersion) {
        var urlPart = md5Origin + "¤" + format + "¤" + id + "¤" + mediaVersion;
        var md5sum = crypto.createHash('md5');
-       md5sum.update(new Buffer(urlPart, 'binary'));
+       md5sum.update(Buffer.from(urlPart, 'binary'));
        md5val = md5sum.digest('hex');
        urlPart = md5val + "¤" + urlPart + "¤";
-       var cipher = crypto.createCipheriv("aes-128-ecb", new Buffer("jo6aey6haid2Teih"), new Buffer(""));
+       var cipher = crypto.createCipheriv("aes-128-ecb", Buffer.from("jo6aey6haid2Teih"), Buffer.from(""));
        var buffer = Buffer.concat([cipher.update(urlPart, 'binary'), cipher.final()]);
        return "https://e-cdns-proxy-" + md5Origin.substring(0, 1) + ".dzcdn.net/mobile/1/" + buffer.toString("hex").toLowerCase();
 }
@@ -488,7 +488,7 @@ Deezer.prototype.decryptTrack = function(writePath, track, queueId, callback) {
                self.reqStream[queueId].push(
                        request.get({url: track.downloadUrl,strictSSL: false, headers: self.httpHeaders, encoding: 'binary'}, function(err, res, body) {
                                if(!err && res.statusCode == 200) {
-                                       var decryptedSource = decryptDownload(new Buffer(body, 'binary'), track);
+                                       var decryptedSource = decryptDownload(Buffer.from(body, 'binary'), track);
                                        fs.outputFile(writePath,decryptedSource,function(err){
                                                if(err){callback(err);return;}
                                                callback();
@@ -521,7 +521,7 @@ function decryptDownload(source, track) {
        var i = 0;
        var position = 0;
 
-       var destBuffer = new Buffer(source.length);
+       var destBuffer = Buffer.alloc(source.length);
        destBuffer.fill(0);
 
        while(position < source.length) {
@@ -531,14 +531,14 @@ function decryptDownload(source, track) {
                } else {
                        chunk_size = source.length - position;
                }
-               chunk = new Buffer(chunk_size);
+               chunk = Buffer.alloc(chunk_size);
                let chunkString
                chunk.fill(0);
                source.copy(chunk, 0, position, position + chunk_size);
                if(i % 3 > 0 || chunk_size < 2048){
                                chunkString = chunk.toString('binary')
                }else{
-                       var cipher = crypto.createDecipheriv('bf-cbc', blowFishKey, new Buffer([0, 1, 2, 3, 4, 5, 6, 7]));
+                       var cipher = crypto.createDecipheriv('bf-cbc', blowFishKey, Buffer.from([0, 1, 2, 3, 4, 5, 6, 7]));
                        cipher.setAutoPadding(false);
                        chunkString = cipher.update(chunk, 'binary', 'binary') + cipher.final();
                }
index 5e727bc4aa98e31b08cd44835d6e6ba8e4360951..7b1eb255a4adc7c8219e81c2b4f2aab76ed0a52d 100644 (file)
@@ -20,14 +20,14 @@ const mainWindowState = new WindowStateManager('mainWindow', {
        defaultHeight: 800
 });
 
-var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
-  // Someone tried to run a second instance, we should focus our window.
-  if (mainWindow) {
+var shouldQuit = !app.requestSingleInstanceLock()
+app.on('second-instance', function (argv, cwd) {
+       if (mainWindow) {
     if (mainWindow.isMinimized()) mainWindow.restore();
                if (!mainWindow.isVisible()) mainWindow.show();
     mainWindow.focus();
   }
-});
+})
 
 if (shouldQuit) {
   app.quit();
index c5d2ccf2f24bbce07f0d20c765503c0ad0005775..384295836fb5c752334187bdf9971d7034cddb37 100644 (file)
@@ -15,9 +15,9 @@
                "fs-extra": "latest",
                "package.json": "latest",
                "queue": "latest",
-               "request": "2.87.0",
+               "request": "latest",
                "requestretry": "latest",
                "socket.io": "latest",
-               "spotify-web-api-node": "4.0.0"
+               "spotify-web-api-node": "latest"
        }
 }
index 857d54c2d077db080141fcfb5d9220b44b2fc872..ddeb26eed498b2203883a5536084bf142579ce0b 100644 (file)
@@ -8,7 +8,7 @@
                "url": "https://notabug.org/RemixDevs/DeezloaderRemix.git"
        },
        "devDependencies": {
-               "cross-env": "^5.1.6",
+               "cross-env": "latest",
                "electron": "latest",
                "electron-builder": "latest"
        },