Added Spotify credentials to settings tab
Reworked how spotify features work so now it doesn't require restart on config change
This commit is contained in:
parent
7824aef125
commit
d48dd43c94
@ -353,6 +353,16 @@ <h1>Settings</h1>
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="settings_spotify_tab">
|
||||||
|
<div class="input_group">
|
||||||
|
<p>Spotify clientID</p>
|
||||||
|
<input type="text" v-model="spotifyFeatures.clientId">
|
||||||
|
</div>
|
||||||
|
<div class="input_group">
|
||||||
|
<p>Spotify Client Secret</p>
|
||||||
|
<input type="password" v-model="spotifyFeatures.clientSecret">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<button onclick="saveSettings()">Save</button>
|
<button onclick="saveSettings()">Save</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -8,6 +8,7 @@ main_selected=""
|
|||||||
toastsWithId = {}
|
toastsWithId = {}
|
||||||
// settings
|
// settings
|
||||||
lastSettings = {}
|
lastSettings = {}
|
||||||
|
lastCredentials = {}
|
||||||
|
|
||||||
function toast(msg, icon=null, dismiss=true, id=null){
|
function toast(msg, icon=null, dismiss=true, id=null){
|
||||||
if (toastsWithId[id]){
|
if (toastsWithId[id]){
|
||||||
@ -23,7 +24,6 @@ function toast(msg, icon=null, dismiss=true, id=null){
|
|||||||
icon = `<i class="material-icons">${icon}</i>`
|
icon = `<i class="material-icons">${icon}</i>`
|
||||||
toastDOM.find(".toast-icon").html(icon)
|
toastDOM.find(".toast-icon").html(icon)
|
||||||
}
|
}
|
||||||
console.log(dismiss)
|
|
||||||
if (dismiss !== null && dismiss){
|
if (dismiss !== null && dismiss){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
toastObj.hideToast()
|
toastObj.hideToast()
|
||||||
@ -166,28 +166,33 @@ socket.on("logged_out", function(){
|
|||||||
var settingsTab = new Vue({
|
var settingsTab = new Vue({
|
||||||
el: '#settings_tab',
|
el: '#settings_tab',
|
||||||
data: {
|
data: {
|
||||||
settings: {}
|
settings: {},
|
||||||
|
spotifyFeatures: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on("init_settings", function(settings){
|
socket.on("init_settings", function(settings, credentials){
|
||||||
loadSettings(settings)
|
console.log(settings,credentials)
|
||||||
|
loadSettings(settings, credentials)
|
||||||
toast("Settings loaded!", 'settings')
|
toast("Settings loaded!", 'settings')
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on("updateSettings", function(settings){
|
socket.on("updateSettings", function(settings, credentials){
|
||||||
loadSettings(settings)
|
loadSettings(settings, credentials)
|
||||||
toast("Settings updated!", 'settings')
|
toast("Settings updated!", 'settings')
|
||||||
})
|
})
|
||||||
|
|
||||||
function loadSettings(settings){
|
function loadSettings(settings, spotifyCredentials){
|
||||||
lastSettings = {...settings}
|
lastSettings = {...settings}
|
||||||
|
lastCredentials = {...spotifyCredentials}
|
||||||
settingsTab.settings = settings
|
settingsTab.settings = settings
|
||||||
|
settingsTab.spotifyFeatures = spotifyCredentials
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSettings(){
|
function saveSettings(){
|
||||||
lastSettings = {...settingsTab.settings}
|
lastSettings = {...settingsTab.settings}
|
||||||
socket.emit("saveSettings", lastSettings)
|
lastCredentials = {...settingsTab.spotifyFeatures}
|
||||||
|
socket.emit("saveSettings", lastSettings, lastCredentials)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tabs stuff
|
// tabs stuff
|
||||||
|
Loading…
Reference in New Issue
Block a user