Moved autologin on server connection
Fixed download entries duplication on desync
This commit is contained in:
parent
812f018896
commit
62b3bb77c2
42157
public/js/bundle.js
42157
public/js/bundle.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -18,6 +18,11 @@ socket.on('logging_in', function () {
|
|||||||
toast('Logging in', 'loading', false, 'login-toast')
|
toast('Logging in', 'loading', false, 'login-toast')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
socket.on('init_autologin', function() {
|
||||||
|
let arl = localStorage.getItem('arl')
|
||||||
|
if (arl) socket.emit('login', arl)
|
||||||
|
})
|
||||||
|
|
||||||
socket.on('logged_in', function (data) {
|
socket.on('logged_in', function (data) {
|
||||||
switch (data.status) {
|
switch (data.status) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -96,7 +101,6 @@ function startApp() {
|
|||||||
if (localStorage.getItem('arl')) {
|
if (localStorage.getItem('arl')) {
|
||||||
let arl = localStorage.getItem('arl')
|
let arl = localStorage.getItem('arl')
|
||||||
|
|
||||||
socket.emit('login', arl)
|
|
||||||
$('#login_input_arl').val(arl)
|
$('#login_input_arl').val(arl)
|
||||||
document.getElementById('home_not_logged_in').classList.add('hide')
|
document.getElementById('home_not_logged_in').classList.add('hide')
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,12 @@ function sendAddToQueue(url, bitrate = null) {
|
|||||||
function addToQueue(queueItem, current = false) {
|
function addToQueue(queueItem, current = false) {
|
||||||
queueList[queueItem.uuid] = queueItem
|
queueList[queueItem.uuid] = queueItem
|
||||||
if (queueItem.downloaded + queueItem.failed == queueItem.size) {
|
if (queueItem.downloaded + queueItem.failed == queueItem.size) {
|
||||||
queueComplete.push(queueItem.uuid)
|
if (queueComplete.indexOf(queueItem.uuid) == -1) queueComplete.push(queueItem.uuid)
|
||||||
} else {
|
} else {
|
||||||
queue.push(queueItem.uuid)
|
if (queue.indexOf(queueItem.uuid) == -1) queue.push(queueItem.uuid)
|
||||||
}
|
}
|
||||||
|
let queueDOM = document.getElementById("download_"+queueItem.uuid)
|
||||||
|
if (typeof(queueDOM) == 'undefined' || queueDOM == null){
|
||||||
$(listEl).append(
|
$(listEl).append(
|
||||||
`<div class="download_object" id="download_${queueItem.uuid}" data-deezerid="${queueItem.id}">
|
`<div class="download_object" id="download_${queueItem.uuid}" data-deezerid="${queueItem.id}">
|
||||||
<div class="download_info">
|
<div class="download_info">
|
||||||
@ -124,13 +126,14 @@ function addToQueue(queueItem, current = false) {
|
|||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
)
|
)
|
||||||
|
}
|
||||||
if (queueItem.progress > 0 || current) {
|
if (queueItem.progress > 0 || current) {
|
||||||
$('#bar_' + queueItem.uuid)
|
$('#bar_' + queueItem.uuid)
|
||||||
.removeClass('indeterminate')
|
.removeClass('indeterminate')
|
||||||
.addClass('determinate')
|
.addClass('determinate')
|
||||||
}
|
}
|
||||||
$('#bar_' + queueItem.uuid).css('width', queueItem.progress + '%')
|
$('#bar_' + queueItem.uuid).css('width', queueItem.progress + '%')
|
||||||
if (queueItem.failed >= 1) {
|
if (queueItem.failed >= 1 && $('#download_' + update.uuid + ' .queue_failed').length == 0) {
|
||||||
$('#download_' + queueItem.uuid + ' .download_info_status').append(
|
$('#download_' + queueItem.uuid + ' .download_info_status').append(
|
||||||
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed">${queueItem.failed}</span><i class="material-icons">error_outline</i><span class="download_slim_separator">)</span></span>`
|
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed">${queueItem.failed}</span><i class="material-icons">error_outline</i><span class="download_slim_separator">)</span></span>`
|
||||||
)
|
)
|
||||||
@ -283,7 +286,7 @@ function updateQueue(update) {
|
|||||||
$('#download_' + update.uuid + ' .queue_downloaded').text(
|
$('#download_' + update.uuid + ' .queue_downloaded').text(
|
||||||
queueList[update.uuid].downloaded + queueList[update.uuid].failed
|
queueList[update.uuid].downloaded + queueList[update.uuid].failed
|
||||||
)
|
)
|
||||||
if (queueList[update.uuid].failed == 1) {
|
if (queueList[update.uuid].failed == 1 && $('#download_' + update.uuid + ' .queue_failed').length == 0) {
|
||||||
$('#download_' + update.uuid + ' .download_info_status').append(
|
$('#download_' + update.uuid + ' .download_info_status').append(
|
||||||
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed">1</span> <i class="material-icons">error_outline</i><span class="download_slim_separator">)</span></span>`
|
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed">1</span> <i class="material-icons">error_outline</i><span class="download_slim_separator">)</span></span>`
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user