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,37 +100,40 @@ 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)
|
||||||
}
|
}
|
||||||
$(listEl).append(
|
let queueDOM = document.getElementById("download_"+queueItem.uuid)
|
||||||
`<div class="download_object" id="download_${queueItem.uuid}" data-deezerid="${queueItem.id}">
|
if (typeof(queueDOM) == 'undefined' || queueDOM == null){
|
||||||
<div class="download_info">
|
$(listEl).append(
|
||||||
<img width="75px" class="rounded coverart" src="${queueItem.cover}" alt="Cover ${queueItem.title}"/>
|
`<div class="download_object" id="download_${queueItem.uuid}" data-deezerid="${queueItem.id}">
|
||||||
<div class="download_info_data">
|
<div class="download_info">
|
||||||
<span class="download_line">${queueItem.title}</span> <span class="download_slim_separator"> - </span>
|
<img width="75px" class="rounded coverart" src="${queueItem.cover}" alt="Cover ${queueItem.title}"/>
|
||||||
<span class="secondary-text">${queueItem.artist}</span>
|
<div class="download_info_data">
|
||||||
|
<span class="download_line">${queueItem.title}</span> <span class="download_slim_separator"> - </span>
|
||||||
|
<span class="secondary-text">${queueItem.artist}</span>
|
||||||
|
</div>
|
||||||
|
<div class="download_info_status">
|
||||||
|
<span class="download_line"><span class="queue_downloaded">${queueItem.downloaded + queueItem.failed}</span>/${
|
||||||
|
queueItem.size
|
||||||
|
}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="download_info_status">
|
<div class="download_bar">
|
||||||
<span class="download_line"><span class="queue_downloaded">${queueItem.downloaded + queueItem.failed}</span>/${
|
<div class="progress"><div id="bar_${queueItem.uuid}" class="indeterminate"></div></div>
|
||||||
queueItem.size
|
<i class="material-icons queue_icon" data-uuid="${queueItem.uuid}">remove</i>
|
||||||
}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>`
|
||||||
<div class="download_bar">
|
)
|
||||||
<div class="progress"><div id="bar_${queueItem.uuid}" class="indeterminate"></div></div>
|
}
|
||||||
<i class="material-icons queue_icon" data-uuid="${queueItem.uuid}">remove</i>
|
|
||||||
</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