Merge branch 'master' into captcha-login
authorRemixDev <deezloaderremix@gmail.com>
Wed, 10 Apr 2019 17:03:20 +0000 (19:03 +0200)
committerRemixDev <deezloaderremix@gmail.com>
Wed, 10 Apr 2019 17:03:20 +0000 (19:03 +0200)
1  2 
app/app.js
app/public/index.html
app/public/js/frontend.js

diff --combined app/app.js
index 32ddf4ad5fc9f74e95b933ef7a88629f3544e813,2987dff8b9407452ecbfc41a8b05728f03e945c8..e2cd1c408d7ed027f4d1d309edf6fac1307977de
@@@ -109,7 -109,9 +109,9 @@@ io.sockets.on('connection', function (s
                        lastVersion_MAJOR==currentVersion_MAJOR && lastVersion_MINOR==currentVersion_MINOR && lastVersion_PATCH>currentVersion_PATCH
                ){
                        logger.info("Update Available")
-                       s.emit("message", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog})
+                       s.emit("messageUpdate", {title: `Version ${lastVersion_MAJOR}.${lastVersion_MINOR}.${lastVersion_PATCH} is available!`, msg: body.changelog, lastVersion: body.version})
+               }else{
+                       logger.info("Running the latest version!")
                }
        })
        .catch(error=>{
        s.emit("getDefaultSettings", defaultSettings, defaultDownloadFolder)
        s.emit("populateDownloadQueue", downloadQueue)
  
 +      const captcha = require('./public/js/captcha');
 +      captcha.callbackResponse = function (data) {
 +              s.emit("getCaptcha", data)
 +      };
 +
        // Function for logging in
 -      s.on("login", async function (username, password, autologin) {
 +      s.on("login", async function (username, password, captchaResponse, autologin) {
                try{
                        logger.info("Logging in");
 -                      await s.Deezer.login(username, password)
 +                      await s.Deezer.login(username, password, captchaResponse)
                        s.emit("login", {user: s.Deezer.user})
                        logger.info("Logged in successfully")
                        if (autologin){
                        // Acquiring bpm (only if necessary)
                        if (settings.tags.bpm){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting BPM`);
+                               track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
                                try{
-                                       var bpm = await s.Deezer.legacyGetTrack(track.id)
-                                       track.bpm = bpm.bpm
+                                       track.bpm = track.legacyTrack.bpm
                                }catch(err){
                                        track.bpm = 0
                                }
                        // Acquiring ReplayGain value (only if necessary)
                        if (settings.tags.replayGain){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting track gain`);
+                               if (!track.legacyTrack) track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
                                try{
-                                       var gain = await s.Deezer.legacyGetTrack(track.id)
                                        track.replayGain = gain.gain
                                }catch(err){
                                        track.replayGain = 0
                                track.replayGain = 0
                        }
  
+                       // Acquiring discNumber value (only if necessary)
                        if (settings.tags.discNumber && !track.discNumber){
                                logger.info(`[${track.artist.name} - ${track.title}] Getting disc number`);
-                               var discNumber = await s.Deezer.legacyGetTrack(track.id)
-                               track.discNumber = discNumber.disk_number
+                               if (!track.legacyTrack) track.legacyTrack = await s.Deezer.legacyGetTrack(track.id)
+                               track.discNumber = track.legacyTrack.disk_number
                        }
  
                        let separator = settings.multitagSeparator
                                if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16)))) track.artistsString = track.artistsString.join(separator)
                        }
                        if (track.genre){
-                               if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16)))) track.genreString = track.genre.join(separator)
+                               if (!(track.selectedFormat == 9 && separator==String.fromCharCode(parseInt("\u0000",16))))
+                                       track.genreString = track.genre.join(separator)
+                               else
+                                       track.genreString = track.genre
                        }
  
                        if (track.date){
diff --combined app/public/index.html
index ca1990184593743fb3bdd1e990132d6e5f539822,4778a3e6d4e2997026b9977a6ce50a41cd8ac580..d692a310b326bd14a2a7e38e6a1156dde98405cd
        <div class="modal-content container" id="login-page">
                <div class="card">
                        <div class="card-content">
 -                              <span class="card-title">Please paste here your userToken</span>
 +                              <span class="card-title">Please login to your deezer account.</span>
                                <h6 class="red-text" id="login-res-text"></h6>
                                <div class="input-field col s12">
 -                                      <input autocomplete="off" type="password" id="modal_login_input_userToken"/>
 -                                      <label for="modal_login_input_userToken">userToken</label>
 +                                      <input autocomplete="off" type="text" id="modal_login_input_username"/>
 +                                      <label for="modal_login_input_username">Email</label>
                                </div>
 -        <p><a href="https://notabug.org/RemixDevs/DeezloaderRemix/wiki/Login+via+userToken" target="_blank">How do I get my userToken?</a></p>
 +                              <div class="input-field col s12">
 +                                      <input autocomplete="off" type="password" id="modal_login_input_password"/>
 +                                      <label for="modal_login_input_password">Password</label>
 +                              </div>
 +                              <input id="modal_login_input_captchaResponse" type="hidden" value=""/>
 +                              <iframe id="modal_login_iframe_captcha" src="cap://deezer.com/"></iframe>
                        </div>
                        <div class="card-action row">
 +                              <div class="col s12 m2 right center" id="modal_login_autologin">
 +                                      <label>
 +                                              <input type="checkbox" class="filled-in" id="modal_login_input_autologin"/>
 +                                              <span>Remember me</span>
 +                                      </label>
 +                              </div>
                                <a href="#" class="deezloader-primary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_login">Log in</a>
                                <a href="#" class="deezloader-secondary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_signup">Sign up</a>
                        </div>
                                        <div class="collapsible-header waves-effect"><i class="material-icons">history</i>Changelog</div>
                                        <div class="collapsible-body">
                                                <p>
+               <b>Version 4.2.1</b><br/>
+               - Downloads are binded to the server on server mode<br/>
+               - Downloading playlists wont create artist and album folders if options are selected<br/>
+               - Date tag is now enabled by default on new installations<br/>
+               - Now users without propic will have a default one in the settings<br/>
+               - Update message only nags once per client<br/>
+               - Added space after %explicit% if there is text after the tag<br/>
+               - Added label at the end of album viewin the modal<br/>
+               - Fixed forEach error when downloading tracks<br/>
+               - Fixed problem where %type% could be empty<br/>
+               - Fixed macOS copy-paste problem<br/>
+               - Fixed duplicate detection when downloading tracks<br/>
+               - Fixed null separator for multitags on FLACs<br/>
+               - Fixed problem where m3u file on multidisc albums was wrong<br/>
+               <br/>
                <b>Version 4.2.0</b><br/>
                - New login workflow<br/>
                - Improved UI<br/>
index 677099c4e4639744c91db11d77da6e3aa0d455ad,ab0a3828e53c49e9c66763c6d3263ea4dee56120..11aa9d0c1cbf947a0c400439716e6e7183deebdc
@@@ -19,6 -19,13 +19,13 @@@ socket.on("message", function(desc)
        message(desc.title, desc.msg)
  })
  
+ socket.on("messageUpdate", function(desc){
+       if (localStorage.getItem('updateModal') != desc.lastVersion){
+               message(desc.title, desc.msg)
+               localStorage.setItem('updateModal', desc.lastVersion)
+       }
+ })
  // Prints object obj into console
  // For Debug purposes
  socket.on("printObj", function(obj){
@@@ -34,6 -41,7 +41,6 @@@ socket.on("getDefaultSettings", functio
  $('#modal_login_btn_login').click(function () {
        $('#modal_login_btn_login').attr("disabled", true)
        $('#modal_login_btn_login').html("Logging in...")
 -      /*
        var username = $('#modal_login_input_username').val()
        var password = $('#modal_login_input_password').val()
        var autologin = $('#modal_login_input_autologin').prop("checked")
                localStorage.setItem('autologin_email', username)
        }
        //Send to the software
 -      socket.emit('login', username, password, autologin)
 -      */
 -      var userToken = $('#modal_login_input_userToken').val()
 -      localStorage.setItem('userToken', userToken)
 -      socket.emit('loginViaUserToken', userToken)
 +      var captchaResponse = $('#modal_login_input_captchaResponse').val()
 +      localStorage.setItem('captchaResponse', captchaResponse)
 +    socket.emit('login', username, password, captchaResponse, autologin)
 +})
 +
 +// Get captcha response
 +socket.on('getCaptcha', function (data) {
 +      $('#modal_login_input_captchaResponse').val(data)
 +      console.log('captcha token received')
  })
  
  // New login system (uses cookies)
@@@ -64,7 -68,7 +71,7 @@@ socket.on("login", function (data) 
                $("#modal_settings_picture").attr("src",data.user.picture)
                $("#side_user").text(data.user.name)
                $("#side_avatar").attr("src",data.user.picture)
 -              $("#side_email").text("id:"+data.user.id)
 +              $("#side_email").text(data.user.email)
                $('#initializing').addClass('animated fadeOut').on('webkitAnimationEnd', function () {
                        $(this).css('display', 'none')
                        $(this).removeClass('animated fadeOut')
@@@ -103,12 -107,12 +110,12 @@@ socket.on('checkAutologin', function()
        socket.emit("getUserSettings")
        if (localStorage.getItem('autologin')){
                socket.emit('autologin', localStorage.getItem('autologin'), localStorage.getItem('autologin_email'))
 -              //$('#modal_login_input_autologin').prop('checked', true)
 +              $('#modal_login_input_autologin').prop('checked', true)
                $('#modal_login_btn_login').attr("disabled", true)
                $('#modal_login_btn_login').html("Logging in...")
 -              //$('#modal_login_input_username').val(localStorage.getItem('autologin_email'))
 -              //$('#modal_login_input_password').val("password")
 -              $('#modal_login_input_userToken').val(localStorage.getItem('userToken'))
 +              $('#modal_login_input_username').val(localStorage.getItem('autologin_email'))
 +              $('#modal_login_input_password').val("password")
 +              $('#modal_login_input_captchaResponse').val(localStorage.getItem('captchaResponse'))
                M.updateTextFields()
        }
  })
@@@ -357,17 -361,17 +364,17 @@@ $('#modal_login_btn_signup').click(func
  
  // Logout Button
  $('#modal_settings_btn_logout').click(function () {
 -      //$('#modal_login_input_username').val("")
 -      //$('#modal_login_input_password').val("")
 -      //$('#modal_login_input_autologin').prop("checked",false)
 -      $('#modal_login_input_userToken').val("")
 +      $('#modal_login_input_username').val("")
 +      $('#modal_login_input_password').val("")
 +      $('#modal_login_input_autologin').prop("checked",false)
 +      $('#modal_login_input_captchaResponse').val("")
        $('#initializing').css('display', '')
        $('#initializing').addClass('animated fadeIn').on('webkitAnimationEnd', function () {
                $(this).removeClass('animated fadeIn')
                $(this).css('display', '')
        })
        localStorage.removeItem("autologin")
 -      localStorage.removeItem("userToken")
 +      localStorage.removeItem("captchaResponse")
        localStorage.removeItem("autologin_email")
        socket.emit('logout')
  })