Added easy login in the GUI

- UI freezes after opening the login window, don't know why
- After logging in sending another request to the server will crash it, 
don't know why either
- Need to make a check for the qt renderer
This commit is contained in:
RemixDev 2020-05-17 16:43:17 +02:00
parent 9f6de9ec64
commit f4d01e2067
5 changed files with 31 additions and 2 deletions

View File

@ -585,6 +585,7 @@ <h2 class="page_heading">Settings</h2>
<h3 class="settings-group__header settings-group__header--with-icon">
<i class="material-icons">person</i>Login
</h3>
<button id="settings_btn_appLogin" @click="applogin" style="width:100%;" disabled>Login with Deezer</button>
<div class="inline-flex">
<input autocomplete="off" type="password" id="login_input_arl" ref="loginInput" placeholder="ARL" />
<button id="settings_btn_copyArl" @click="copyARLtoClipboard">
@ -1206,4 +1207,4 @@ <h2 class="inline-flex"><span v-if="metadata">{{ metadata }}</span><span class="
<script src="/public/js/bundle.js"></script>
</html>
</html>

View File

@ -41596,6 +41596,9 @@ const SettingsTab = new Vue({
logout() {
socket.emit('logout');
},
applogin() {
if (window.clientMode) socket.emit('applogin');
},
initSettings(settings, credentials, defaults) {
this.loadSettings(settings, credentials, defaults);
toast('Settings loaded!', 'settings');
@ -42099,6 +42102,13 @@ function startApp() {
TrackPreview.init();
}
function initClient(){
console.log("ClientMode");
document.getElementById("settings_btn_appLogin").removeAttribute("disabled");
window.clientMode = true;
}
window.addEventListener('pywebviewready', initClient);
document.addEventListener('DOMContentLoaded', startApp);
/* ===== General functions ===== */
@ -42155,6 +42165,7 @@ socket.on('logged_in', function (data) {
document.getElementById('logged_in_info').classList.remove('hide');
}
document.getElementById('home_not_logged_in').classList.add('hide');
document.getElementById('settings_btn_appLogin').classList.add('hide');
break
case 2:
toast('Already logged in', 'done', true, 'login-toast');
@ -42168,6 +42179,7 @@ socket.on('logged_in', function (data) {
document.getElementById('logged_in_info').classList.remove('hide');
}
document.getElementById('home_not_logged_in').classList.add('hide');
document.getElementById('settings_btn_appLogin').classList.add('hide');
break
case 0:
toast("Couldn't log in", 'close', true, 'login-toast');
@ -42179,6 +42191,7 @@ socket.on('logged_in', function (data) {
jquery('#settings_username').text('Not Logged');
jquery('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`);
document.getElementById('home_not_logged_in').classList.remove('hide');
document.getElementById('settings_btn_appLogin').classList.remove('hide');
break
}
});
@ -42192,5 +42205,6 @@ socket.on('logged_out', function () {
jquery('#settings_username').text('Not Logged');
jquery('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`);
document.getElementById('home_not_logged_in').classList.remove('hide');
document.getElementById('settings_btn_appLogin').classList.remove('hide');
});
//# sourceMappingURL=bundle.js.map

File diff suppressed because one or more lines are too long

View File

@ -20,6 +20,13 @@ function startApp() {
TrackPreview.init()
}
function initClient(){
console.log("ClientMode")
document.getElementById("settings_btn_appLogin").removeAttribute("disabled")
window.clientMode = true;
}
window.addEventListener('pywebviewready', initClient)
document.addEventListener('DOMContentLoaded', startApp)
/* ===== General functions ===== */
@ -76,6 +83,7 @@ socket.on('logged_in', function (data) {
document.getElementById('logged_in_info').classList.remove('hide')
}
document.getElementById('home_not_logged_in').classList.add('hide')
document.getElementById('settings_btn_appLogin').classList.add('hide')
break
case 2:
toast('Already logged in', 'done', true, 'login-toast')
@ -89,6 +97,7 @@ socket.on('logged_in', function (data) {
document.getElementById('logged_in_info').classList.remove('hide')
}
document.getElementById('home_not_logged_in').classList.add('hide')
document.getElementById('settings_btn_appLogin').classList.add('hide')
break
case 0:
toast("Couldn't log in", 'close', true, 'login-toast')
@ -100,6 +109,7 @@ socket.on('logged_in', function (data) {
$('#settings_username').text('Not Logged')
$('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`)
document.getElementById('home_not_logged_in').classList.remove('hide')
document.getElementById('settings_btn_appLogin').classList.remove('hide')
break
}
})
@ -113,4 +123,5 @@ socket.on('logged_out', function () {
$('#settings_username').text('Not Logged')
$('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`)
document.getElementById('home_not_logged_in').classList.remove('hide')
document.getElementById('settings_btn_appLogin').classList.remove('hide')
})

View File

@ -69,6 +69,9 @@ const SettingsTab = new Vue({
logout() {
socket.emit('logout')
},
applogin() {
if (window.clientMode) socket.emit('applogin')
},
initSettings(settings, credentials, defaults) {
this.loadSettings(settings, credentials, defaults)
toast('Settings loaded!', 'settings')