diff --git a/public/js/bundle.js b/public/js/bundle.js index 9b552a2..532dffa 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -3053,7 +3053,7 @@ a { `)])])],1)}),0)])])])},__vue_staticRenderFns__$g=[];const __vue_inject_styles__$g=void 0,__vue_scope_id__$g=void 0,__vue_is_functional_template__$g=!1;function __vue_normalize__$g(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Charts.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var Charts=__vue_normalize__$g({render:__vue_render__$g,staticRenderFns:__vue_staticRenderFns__$g},__vue_inject_styles__$g,__vue_script__$g,__vue_scope_id__$g,__vue_is_functional_template__$g),script$f={computed:{...mapGetters(["getErrors"]),title(){return`${this.getErrors.artist} - ${this.getErrors.title}`},errors(){return this.getErrors.errors}}};const __vue_script__$f=script$f;var __vue_render__$f=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("errors.title",{name:e.title})))]),e._v(" "),n("table",{staticClass:"table table--tracklist"},[n("tr",[n("th",[e._v("ID")]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.error",1)))])]),e._v(" "),e._l(e.errors,function(i){return n("tr",{key:i.data.id},[n("td",[e._v(e._s(i.data.id))]),e._v(" "),n("td",[e._v(e._s(i.data.artist))]),e._v(" "),n("td",[e._v(e._s(i.data.title))]),e._v(" "),n("td",[e._v(e._s(i.errid?e.$t("errors.ids."+i.errid):i.message))])])})],2)])},__vue_staticRenderFns__$f=[];const __vue_inject_styles__$f=void 0,__vue_scope_id__$f=void 0,__vue_is_functional_template__$f=!1;function __vue_normalize__$f(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Errors.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var Errors=__vue_normalize__$f({render:__vue_render__$f,staticRenderFns:__vue_staticRenderFns__$f},__vue_inject_styles__$f,__vue_script__$f,__vue_scope_id__$f,__vue_is_functional_template__$f),script$e={inheritAttrs:!1,props:{cover:{type:String,reqired:!0},isRounded:{type:Boolean,required:!1},isCircle:{type:Boolean,required:!1},link:{type:String,reqired:!0}}};const __vue_script__$e=script$e;var __vue_render__$e=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"relative cover-container group"},[n("img",{staticClass:"block w-full opacity-100 coverart",class:{rounded:e.isRounded,"rounded-full":e.isCircle},attrs:{"aria-hidden":"true",src:e.cover}}),e._v(" "),n("button",e._g({staticClass:"absolute p-0 text-center bg-black border-0 rounded-full opacity-0 download_overlay hover:bg-primary",attrs:{role:"button","aria-label":"download","data-link":e.link,tabindex:"0"}},e.$listeners),[n("i",{staticClass:"text-white cursor-pointer material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])])},__vue_staticRenderFns__$e=[];const __vue_inject_styles__$e=function(e){!e||e("data-v-c6343cfa_0",{source:".cover-container[data-v-c6343cfa]{width:156px;height:156px;margin-bottom:10px}.cover-container .coverart[data-v-c6343cfa]{backface-visibility:hidden;transition:.5s ease;height:auto}.cover-container .download_overlay[data-v-c6343cfa]{top:50%;left:50%;transform:translate(-50%,-50%);transition:.5s ease;opacity:0;min-width:2rem;height:2.75rem;text-align:center}.cover-container .download_overlay i[data-v-c6343cfa]{padding:.625rem}.cover-container .download_overlay[data-v-c6343cfa]:focus{opacity:1}.cover-container:hover .coverart[data-v-c6343cfa]{opacity:.75}.cover-container:hover .download_overlay[data-v-c6343cfa]{opacity:1;border:0}",map:void 0,media:void 0})},__vue_scope_id__$e="data-v-c6343cfa",__vue_module_identifier__$2=void 0,__vue_is_functional_template__$e=!1;function __vue_normalize__$e(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="CoverContainer.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$2(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$2.styles||(__vue_create_injector__$2.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const d=c.element=document.createElement("style");d.type="text/css",s.media&&d.setAttribute("media",s.media),n&&(d.setAttribute("data-group",l),d.setAttribute("data-next-index","0")),e.appendChild(d)}if(n&&(u=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",u+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` -`);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var CoverContainer=__vue_normalize__$e({render:__vue_render__$e,staticRenderFns:__vue_staticRenderFns__$e},__vue_inject_styles__$e,__vue_script__$e,__vue_scope_id__$e,__vue_is_functional_template__$e,__vue_module_identifier__$2,__vue_create_injector__$2);let settingsData={},defaultSettingsData={},spotifyCredentials={};async function getSettingsData(){{const e=await fetchData("getSettings"),{settings:a,defaultSettings:n,spotifySettings:i}=e;settingsData=a,defaultSettingsData=n,spotifyCredentials=i||{}}return{settingsData,defaultSettingsData,spotifyCredentials}}function getInitialPreviewVolume(){let e=parseInt(localStorage.getItem("previewVolume"));return isNaN(e)&&(e=80,localStorage.setItem("previewVolume",e.toString())),e}function checkInitialSlimDownloads(){return localStorage.getItem("slimDownloads")==="true"}function checkInitialSlimSidebar(){return localStorage.getItem("slimSidebar")==="true"}const state$2=()=>({currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null,previewVolume:getInitialPreviewVolume(),hasSlimDownloads:checkInitialSlimDownloads(),hasSlimSidebar:checkInitialSlimSidebar()}),actions$2={setAppInfo({commit:e},a){e("SET_CURRENT_COMMIT",a.currentCommit),e("SET_LATEST_COMMIT",a.latestCommit),e("SET_UPDATE_AVAILABLE",a.updateAvailable),e("SET_DEEMIX_VERSION",a.deemixVersion)},setPreviewVolume({commit:e},a){e("SET_PREVIEW_VOLUME",a),localStorage.setItem("previewVolume",a.toString())},setSlimDownloads({commit:e},a){e("SET_SLIM_DOWNLOADS",a),localStorage.setItem("slimDownloads",a.toString())},setSlimSidebar({commit:e},a){e("SET_SLIM_SIDEBAR",a),localStorage.setItem("slimSidebar",a.toString()),Array.from(document.getElementsByClassName("toastify")).forEach(n=>{n.style.transform=`translate(${a?"3rem":"14rem"}, 0)`})}},getters$2={getAppInfo:e=>e,getPreviewVolume:e=>e.previewVolume,getSlimDownloads:e=>e.hasSlimDownloads,getSlimSidebar:e=>e.hasSlimSidebar},mutations$2={SET_CURRENT_COMMIT(e,a){e.currentCommit=a},SET_LATEST_COMMIT(e,a){e.latestCommit=a},SET_UPDATE_AVAILABLE(e,a){e.updateAvailable=a},SET_DEEMIX_VERSION(e,a){e.deemixVersion=a},SET_PREVIEW_VOLUME(e,a){e.previewVolume=a},SET_SLIM_DOWNLOADS(e,a){e.hasSlimDownloads=a},SET_SLIM_SIDEBAR(e,a){e.hasSlimSidebar=a}};var appInfo={state:state$2,getters:getters$2,actions:actions$2,mutations:mutations$2};const getDefaultState=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""},spotifyUser:{id:localStorage.getItem("spotifyUser"),name:null,picture:null},clientMode:!1}),state$1=()=>getDefaultState(),actions$1={login({commit:e,dispatch:a},n){const{arl:i,user:r,status:s}=n;a("setARL",{arl:i}),e("SET_USER",r),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:i}=a;i=typeof i=="undefined"?!0:i,e("SET_ARL",n),i&&localStorage.setItem("arl",n)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:e},a){e("SET_USER",a)},setClientMode({commit:e},a){e("SET_CLIENT_MODE",a)}},getters$1={getARL:e=>e.arl,getUser:e=>e.user,getSpotifyUser:e=>e.spotifyUser,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl,isLoggedWithSpotify:e=>!!e.spotifyUser.id},mutations$1={SET_ARL(e,a){e.arl=a},SET_STATUS(e,a){e.status=a},SET_USER(e,a){e.user=a},SET_CLIENT_MODE(e,a){e.clientMode=a},RESET_LOGIN(e){const a=e.clientMode;Object.assign(e,getDefaultState()),e.clientMode=a}};var login={state:state$1,getters:getters$1,actions:actions$1,mutations:mutations$1};const state=()=>({artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""}),actions={setErrors({commit:e},a){e("SET_ERRORS",a)}},getters={getErrors:e=>e},mutations={SET_ERRORS(e,a){for(const n in e)if(e.hasOwnProperty(n)){const i=a[n];e[n]=i}}};var errors={state,getters,actions,mutations};Vue$2.use(index);var store=new index.Store({modules:{appInfo,login,errors},strict:!1});const favoriteArtists=ref([]),favoriteAlbums=ref([]),favoriteSpotifyPlaylists=ref([]),favoritePlaylists=ref([]),favoriteTracks=ref([]),isRefreshingFavorites=ref(!1);function refreshFavorites({isInitial:e=!1}){e||(isRefreshingFavorites.value=!0),fetchData("getUserFavorites").then(setAllFavorites).catch(console.error),store.getters.isLoggedWithSpotify&&fetchData("getUserSpotifyPlaylists",{spotifyUser:store.getters.getSpotifyUser.id}).then(({data:a})=>{favoriteSpotifyPlaylists.value=a}).catch(console.error)}function setAllFavorites(e){const{tracks:a,albums:n,artists:i,playlists:r}=e;isRefreshingFavorites.value=!1,favoriteArtists.value=i,favoriteAlbums.value=n,favoritePlaylists.value=r,favoriteTracks.value=a}function useFavorites(){return{favoriteArtists,favoriteAlbums,favoriteSpotifyPlaylists,favoritePlaylists,favoriteTracks,isRefreshingFavorites,refreshFavorites}}var script$d=defineComponent({components:{PreviewControls,CoverContainer,BaseTabs,BaseTab},setup(e,a){const n=reactive({activeTab:"playlist",tabs:["playlist","album","artist","track"]}),{favoriteArtists:i,favoriteAlbums:r,favoriteSpotifyPlaylists:s,favoritePlaylists:l,favoriteTracks:c,isRefreshingFavorites:o,refreshFavorites:u}=useFavorites();return u({isInitial:!0}),watch(o,(d,f)=>{!(f&&!d)||toast(a.root.$t("toasts.refreshFavs"),"done",!0)}),{...toRefs(n),tracks:c,albums:r,artists:i,playlists:l,spotifyPlaylists:s,refreshFavorites:u,isRefreshingFavorites:o}},computed:{activeTabEmpty(){return this.getActiveRelease()?.length===0}},methods:{playPausePreview,convertDuration,downloadAllOfType(){try{const e=this.getActiveRelease();if(this.activeTab==="track"){const a=this.getLovedTracksPlaylist();sendAddToQueue(a.link)}else sendAddToQueue(aggregateDownloadLinks(e))}catch(e){console.error(e.message)}},addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getActiveRelease(e=this.activeTab){let a;switch(e){case"playlist":a=this.playlists;break;case"album":a=this.albums;break;case"artist":a=this.artists;break;case"track":a=this.tracks;break}return a},getTabLength(e=this.activeTab){return this[`${e}s`]?.length||0},getLovedTracksPlaylist(){const e=this.playlists.filter(a=>a.is_loved_track);if(e.length!==0)return e[0];throw new Error("No loved tracks playlist!")}}});const __vue_script__$d=script$d;var __vue_render__$d=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(` +`);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var CoverContainer=__vue_normalize__$e({render:__vue_render__$e,staticRenderFns:__vue_staticRenderFns__$e},__vue_inject_styles__$e,__vue_script__$e,__vue_scope_id__$e,__vue_is_functional_template__$e,__vue_module_identifier__$2,__vue_create_injector__$2);let settingsData={},defaultSettingsData={},spotifyCredentials={};async function getSettingsData(){{const e=await fetchData("getSettings"),{settings:a,defaultSettings:n,spotifySettings:i}=e;settingsData=a,defaultSettingsData=n,spotifyCredentials=i||{}}return{settingsData,defaultSettingsData,spotifyCredentials}}function getInitialPreviewVolume(){let e=parseInt(localStorage.getItem("previewVolume"));return isNaN(e)&&(e=80,localStorage.setItem("previewVolume",e.toString())),e}function checkInitialSlimDownloads(){return localStorage.getItem("slimDownloads")==="true"}function checkInitialSlimSidebar(){return localStorage.getItem("slimSidebar")==="true"}const state$2=()=>({currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null,previewVolume:getInitialPreviewVolume(),hasSlimDownloads:checkInitialSlimDownloads(),hasSlimSidebar:checkInitialSlimSidebar()}),actions$2={setAppInfo({commit:e},a){e("SET_CURRENT_COMMIT",a.currentCommit),e("SET_LATEST_COMMIT",a.latestCommit),e("SET_UPDATE_AVAILABLE",a.updateAvailable),e("SET_DEEMIX_VERSION",a.deemixVersion)},setPreviewVolume({commit:e},a){e("SET_PREVIEW_VOLUME",a),localStorage.setItem("previewVolume",a.toString())},setSlimDownloads({commit:e},a){e("SET_SLIM_DOWNLOADS",a),localStorage.setItem("slimDownloads",a.toString())},setSlimSidebar({commit:e},a){e("SET_SLIM_SIDEBAR",a),localStorage.setItem("slimSidebar",a.toString()),Array.from(document.getElementsByClassName("toastify")).forEach(n=>{n.style.transform=`translate(${a?"3rem":"14rem"}, 0)`})}},getters$2={getAppInfo:e=>e,getPreviewVolume:e=>e.previewVolume,getSlimDownloads:e=>e.hasSlimDownloads,getSlimSidebar:e=>e.hasSlimSidebar},mutations$2={SET_CURRENT_COMMIT(e,a){e.currentCommit=a},SET_LATEST_COMMIT(e,a){e.latestCommit=a},SET_UPDATE_AVAILABLE(e,a){e.updateAvailable=a},SET_DEEMIX_VERSION(e,a){e.deemixVersion=a},SET_PREVIEW_VOLUME(e,a){e.previewVolume=a},SET_SLIM_DOWNLOADS(e,a){e.hasSlimDownloads=a},SET_SLIM_SIDEBAR(e,a){e.hasSlimSidebar=a}};var appInfo={state:state$2,getters:getters$2,actions:actions$2,mutations:mutations$2};const getDefaultState=()=>({arl:localStorage.getItem("arl")||"",accessToken:localStorage.getItem("accessToken")||"",status:null,user:{id:null,name:"",picture:""},spotifyUser:{id:localStorage.getItem("spotifyUser"),name:null,picture:null},clientMode:!1}),state$1=()=>getDefaultState(),actions$1={login({commit:e,dispatch:a},n){const{arl:i,user:r,status:s}=n;a("setARL",{arl:i}),e("SET_USER",r),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),localStorage.removeItem("accessToken"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:i}=a;i=typeof i=="undefined"?!0:i,e("SET_ARL",n),i&&localStorage.setItem("arl",n)},setAccessToken({commit:e},a){let{accessToken:n,saveOnLocalStorage:i}=a;i=typeof i=="undefined"?!0:i,e("SET_ACCESS_TOKEN",n),i&&localStorage.setItem("accessToken",n)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},removeAccessToken({commit:e}){e("SET_ACCESS_TOKEN",""),localStorage.removeItem("accessToken")},setUser({commit:e},a){e("SET_USER",a)},setClientMode({commit:e},a){e("SET_CLIENT_MODE",a)}},getters$1={getARL:e=>e.arl,getAccessToken:e=>e.accessToken,getUser:e=>e.user,getSpotifyUser:e=>e.spotifyUser,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl,isLoggedWithSpotify:e=>!!e.spotifyUser.id},mutations$1={SET_ARL(e,a){e.arl=a},SET_ACCESS_TOKEN(e,a){e.accessToken=a},SET_STATUS(e,a){e.status=a},SET_USER(e,a){e.user=a},SET_CLIENT_MODE(e,a){e.clientMode=a},RESET_LOGIN(e){const a=e.clientMode;Object.assign(e,getDefaultState()),e.clientMode=a}};var login={state:state$1,getters:getters$1,actions:actions$1,mutations:mutations$1};const state=()=>({artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""}),actions={setErrors({commit:e},a){e("SET_ERRORS",a)}},getters={getErrors:e=>e},mutations={SET_ERRORS(e,a){for(const n in e)if(e.hasOwnProperty(n)){const i=a[n];e[n]=i}}};var errors={state,getters,actions,mutations};Vue$2.use(index);var store=new index.Store({modules:{appInfo,login,errors},strict:!1});const favoriteArtists=ref([]),favoriteAlbums=ref([]),favoriteSpotifyPlaylists=ref([]),favoritePlaylists=ref([]),favoriteTracks=ref([]),isRefreshingFavorites=ref(!1);function refreshFavorites({isInitial:e=!1}){e||(isRefreshingFavorites.value=!0),fetchData("getUserFavorites").then(setAllFavorites).catch(console.error),store.getters.isLoggedWithSpotify&&fetchData("getUserSpotifyPlaylists",{spotifyUser:store.getters.getSpotifyUser.id}).then(({data:a})=>{favoriteSpotifyPlaylists.value=a}).catch(console.error)}function setAllFavorites(e){const{tracks:a,albums:n,artists:i,playlists:r}=e;isRefreshingFavorites.value=!1,favoriteArtists.value=i,favoriteAlbums.value=n,favoritePlaylists.value=r,favoriteTracks.value=a}function useFavorites(){return{favoriteArtists,favoriteAlbums,favoriteSpotifyPlaylists,favoritePlaylists,favoriteTracks,isRefreshingFavorites,refreshFavorites}}var script$d=defineComponent({components:{PreviewControls,CoverContainer,BaseTabs,BaseTab},setup(e,a){const n=reactive({activeTab:"playlist",tabs:["playlist","album","artist","track"]}),{favoriteArtists:i,favoriteAlbums:r,favoriteSpotifyPlaylists:s,favoritePlaylists:l,favoriteTracks:c,isRefreshingFavorites:o,refreshFavorites:u}=useFavorites();return u({isInitial:!0}),watch(o,(d,f)=>{!(f&&!d)||toast(a.root.$t("toasts.refreshFavs"),"done",!0)}),{...toRefs(n),tracks:c,albums:r,artists:i,playlists:l,spotifyPlaylists:s,refreshFavorites:u,isRefreshingFavorites:o}},computed:{activeTabEmpty(){return this.getActiveRelease()?.length===0}},methods:{playPausePreview,convertDuration,downloadAllOfType(){try{const e=this.getActiveRelease();if(this.activeTab==="track"){const a=this.getLovedTracksPlaylist();sendAddToQueue(a.link)}else sendAddToQueue(aggregateDownloadLinks(e))}catch(e){console.error(e.message)}},addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getActiveRelease(e=this.activeTab){let a;switch(e){case"playlist":a=this.playlists;break;case"album":a=this.albums;break;case"artist":a=this.artists;break;case"track":a=this.tracks;break}return a},getTabLength(e=this.activeTab){return this[`${e}s`]?.length||0},getLovedTracksPlaylist(){const e=this.playlists.filter(a=>a.is_loved_track);if(e.length!==0)return e[0];throw new Error("No loved tracks playlist!")}}});const __vue_script__$d=script$d;var __vue_render__$d=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(` `+e._s(e.$t("favorites.title"))+` `),n("div",{ref:"reloadButton",staticClass:"inline-block clickable",attrs:{"aria-label":"reload",role:"button"},on:{click:e.refreshFavorites}},[n("i",{staticClass:"material-icons",class:{spin:e.isRefreshingFavorites}},[e._v("sync")])])]),e._v(" "),n("BaseTabs",e._l(e.tabs,function(i){return n("BaseTab",{key:i,class:{active:e.activeTab===i},on:{click:function(r){e.activeTab=i}}},[e._v(` `+e._s(e.$tc("globals.listTabs."+i,2))+` @@ -4845,7 +4845,7 @@ a { /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const d=c.element=document.createElement("style");d.type="text/css",s.media&&d.setAttribute("media",s.media),n&&(d.setAttribute("data-group",l),d.setAttribute("data-next-index","0")),e.appendChild(d)}if(n&&(u=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",u+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` `);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var BaseAccordion=__vue_normalize__$3({render:__vue_render__$3,staticRenderFns:__vue_staticRenderFns__$3},__vue_inject_styles__$3,__vue_script__$3,__vue_scope_id__$3,__vue_is_functional_template__$3,__vue_module_identifier__$1,__vue_create_injector__$1),script$2={components:{BaseAccordion},props:{templateVariables:{type:Array,required:!0}}};const __vue_script__$2=script$2;var __vue_render__$2=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("BaseAccordion",{staticStyle:{"--arrow-v-align":"baseline","margin-bottom":"3rem"},scopedSlots:e._u([{key:"title",fn:function(){return[e._t("title")]},proxy:!0}],null,!0)},[e._v(" "),n("div",{staticClass:"flex flex-wrap p-4 space-x-2 rounded-2xl bg-background-secondary"},e._l(e.templateVariables,function(i){return n("span",{staticClass:"inline-block p-2 mt-2 tracking-wider rounded cursor-pointer bg-panels-bg first:ml-2 hover:shadow-outline",on:{click:function(r){return e.$emit("variable-click",i)}}},[e._v(` `+e._s(i)+` - `)])}),0)])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=void 0,__vue_scope_id__$2=void 0,__vue_is_functional_template__$2=!1;function __vue_normalize__$2(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="TemplateVariablesList.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var TemplateVariablesList=__vue_normalize__$2({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$2,__vue_scope_id__$2,__vue_is_functional_template__$2);const getFormItem=e=>a=>{const n=e.elements.namedItem(a);return{[a]:n.value}};var script$1={components:{BaseAccordion,TemplateVariablesList},data(){return{flags,currentLocale:this.$i18n.locale,locales:this.$i18n.availableLocales,settings:{tags:{}},lastSettings:{},spotifyFeatures:{},lastCredentials:{},defaultSettings:{},lastUser:"",spotifyUser:"",accountNum:0,accounts:[],trackTemplateVariables}},computed:{...mapGetters({arl:"getARL",user:"getUser",isLoggedIn:"isLoggedIn",clientMode:"getClientMode",previewVolume:"getPreviewVolume",hasSlimDownloads:"getSlimDownloads",hasSlimSidebar:"getSlimSidebar"}),needToWait(){return Object.keys(this.getSettings).length===0},modelVolume:{get(){return this.previewVolume},set:debounce(function(e){this.setPreviewVolume(e)},20)},modelSlimDownloads:{get(){return this.hasSlimDownloads},set(e){this.setSlimDownloads(e)}},modelSlimSidebar:{get(){return this.hasSlimSidebar},set(e){this.setSlimSidebar(e)}},pictureHref(){return`https://e-cdns-images.dzcdn.net/images/user/${this.user.picture}/125x125-000000-80-0-0.jpg`}},async mounted(){const{settingsData:e,defaultSettingsData:a,spotifyCredentials:n}=await getSettingsData();this.defaultSettings=a,this.initSettings(e,n);const i=localStorage.getItem("accountNum");i&&(this.accountNum=i);const r=localStorage.getItem("spotifyUser");r&&(this.lastUser=r,this.spotifyUser=r,socket.emit("update_userSpotifyPlaylists",r)),socket.on("updateSettings",this.updateSettings),socket.on("accountChanged",this.accountChanged),socket.on("familyAccounts",this.initAccounts),window.api.receive("downloadFolderSelected",this.downloadFolderSelected),window.api.receive("applogin_arl",this.loggedInViaDeezer),this.$on("hook:destroyed",()=>{socket.off("updateSettings"),socket.off("accountChanged"),socket.off("familyAccounts"),socket.off("applogin_arl")})},methods:{...mapActions({dispatchARL:"setARL",setPreviewVolume:"setPreviewVolume",setSlimDownloads:"setSlimDownloads",setSlimSidebar:"setSlimSidebar"}),onTemplateVariableClick(e){copyToClipboard(e),toast(`Copied ${e} to clipboard!`)},revertSettings(){this.settings=JSON.parse(JSON.stringify(this.lastSettings))},revertCredentials(){this.spotifyCredentials=JSON.parse(JSON.stringify(this.lastCredentials)),this.spotifyUser=(" "+this.lastUser).slice(1)},copyARLtoClipboard(){const e=this.$refs.loginInput;e.setAttribute("type","text"),e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.setAttribute("type","password"),toast(this.$t("settings.toasts.ARLcopied"),"assignment")},changeLocale(e){this.$i18n.locale=e,this.currentLocale=e,localStorage.setItem("locale",e)},saveSettings(){this.lastSettings=JSON.parse(JSON.stringify(this.settings)),this.lastCredentials=JSON.parse(JSON.stringify(this.spotifyFeatures));let e=!1;this.lastUser!=this.spotifyUser&&(this.lastUser=(" "+this.spotifyUser).slice(1),localStorage.setItem("spotifyUser",this.lastUser),e=!0),socket.emit("saveSettings",{settings:this.lastSettings,spotifySettings:this.lastCredentials,spotifyUser:e?this.lastUser:!1})},selectDownloadFolder(){window.api.send("selectDownloadFolder",this.settings.downloadLocation)},downloadFolderSelected(e){this.$set(this.settings,"downloadLocation",e)},loadSettings(e){this.lastSettings=JSON.parse(JSON.stringify(e)),this.settings=JSON.parse(JSON.stringify(e))},loadCredentials(e){this.lastCredentials=JSON.parse(JSON.stringify(e)),this.spotifyFeatures=JSON.parse(JSON.stringify(e))},async loggedInViaDeezer(e){this.dispatchARL({arl:e})},async login(){const e=this.$refs.loginInput.value.trim();if(e&&e!==this.arl){const a=await fetchData("login-arl",{arl:e,force:!0,child:this.accountNum},"POST");this.loggedInViaDeezer(a.arl)}},async loginWithCredentials(){const e=getFormItem(this.$refs.loginWithCredentialsForm),{username:a}=e("username"),{password:n}=e("password"),i=await postToServer("loginWithCredentials",{username:a,password:n});console.log({response:i})},appLogin(){window.api.send("applogin")},changeAccount(){socket.emit("changeAccount",this.accountNum)},accountChanged(e,a){this.$refs.username.innerText=e.name,this.$refs.userpicture.src=`https://e-cdns-images.dzcdn.net/images/user/${e.picture}/125x125-000000-80-0-0.jpg`,this.accountNum=a,localStorage.setItem("accountNum",this.accountNum)},initAccounts(e){this.accounts=e},logout(){socket.emit("logout")},initSettings(e,a){this.loadSettings(e),this.loadCredentials(a),toast(this.$t("settings.toasts.init"),"settings")},updateSettings(e){const{settings:a,spotifySettings:n}=e;this.loadSettings(a),this.loadCredentials(n),toast(this.$t("settings.toasts.update"),"settings")},resetToDefault(){!confirm(this.$t("settings.resetMessage"))||(this.settings=JSON.parse(JSON.stringify(this.defaultSettings)),toast(this.$t("settings.toasts.reset"),"settings"))}}};const __vue_script__$1=script$1;var __vue_render__$1=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"fixed-footer"},[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("settings.title")))]),e._v(" "),e.isLoggedIn?n("div",{ref:"loggedInInfo",attrs:{id:"logged_in_info"}},[n("img",{ref:"userpicture",staticClass:"w-32 h-32 rounded-full",attrs:{id:"settings_picture",src:e.pictureHref,alt:"Profile Picture"}}),e._v(" "),n("i18n",{attrs:{path:"settings.login.loggedIn",tag:"p"},scopedSlots:e._u([{key:"username",fn:function(){return[n("strong",{ref:"username",attrs:{id:"settings_username"}},[e._v(e._s(e.user.name||"not logged"))])]},proxy:!0}],null,!1,2821744753)}),e._v(" "),n("button",{staticClass:"btn btn-primary",on:{click:e.logout}},[e._v(` + `)])}),0)])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=void 0,__vue_scope_id__$2=void 0,__vue_is_functional_template__$2=!1;function __vue_normalize__$2(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="TemplateVariablesList.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var TemplateVariablesList=__vue_normalize__$2({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$2,__vue_scope_id__$2,__vue_is_functional_template__$2);const getFormItem=e=>a=>{const n=e.elements.namedItem(a);return{[a]:n.value}};var script$1={components:{BaseAccordion,TemplateVariablesList},data(){return{flags,currentLocale:this.$i18n.locale,locales:this.$i18n.availableLocales,settings:{tags:{}},lastSettings:{},spotifyFeatures:{},lastCredentials:{},defaultSettings:{},lastUser:"",spotifyUser:"",accountNum:0,accounts:[],trackTemplateVariables}},computed:{...mapGetters({arl:"getARL",accessToken:"getAccessToken",user:"getUser",isLoggedIn:"isLoggedIn",clientMode:"getClientMode",previewVolume:"getPreviewVolume",hasSlimDownloads:"getSlimDownloads",hasSlimSidebar:"getSlimSidebar"}),needToWait(){return Object.keys(this.getSettings).length===0},modelVolume:{get(){return this.previewVolume},set:debounce(function(e){this.setPreviewVolume(e)},20)},modelSlimDownloads:{get(){return this.hasSlimDownloads},set(e){this.setSlimDownloads(e)}},modelSlimSidebar:{get(){return this.hasSlimSidebar},set(e){this.setSlimSidebar(e)}},pictureHref(){return`https://e-cdns-images.dzcdn.net/images/user/${this.user.picture}/125x125-000000-80-0-0.jpg`}},async mounted(){const{settingsData:e,defaultSettingsData:a,spotifyCredentials:n}=await getSettingsData();this.defaultSettings=a,this.initSettings(e,n);const i=localStorage.getItem("accountNum");i&&(this.accountNum=i);const r=localStorage.getItem("spotifyUser");r&&(this.lastUser=r,this.spotifyUser=r,socket.emit("update_userSpotifyPlaylists",r)),socket.on("updateSettings",this.updateSettings),socket.on("accountChanged",this.accountChanged),socket.on("familyAccounts",this.initAccounts),this.clientMode&&(window.api.receive("downloadFolderSelected",this.downloadFolderSelected),window.api.receive("applogin_arl",this.loggedInViaDeezer)),this.$on("hook:destroyed",()=>{socket.off("updateSettings"),socket.off("accountChanged"),socket.off("familyAccounts")})},methods:{...mapActions({dispatchARL:"setARL",dispatchAccessTocken:"setAccessToken",dispatchUser:"setUser",removeARL:"removeARL",setPreviewVolume:"setPreviewVolume",setSlimDownloads:"setSlimDownloads",setSlimSidebar:"setSlimSidebar",dispatchLogout:"logout",dispatchLogin:"login"}),onTemplateVariableClick(e){copyToClipboard(e),toast(`Copied ${e} to clipboard!`)},revertSettings(){this.settings=JSON.parse(JSON.stringify(this.lastSettings))},revertCredentials(){this.spotifyCredentials=JSON.parse(JSON.stringify(this.lastCredentials)),this.spotifyUser=(" "+this.lastUser).slice(1)},copyARLtoClipboard(){const e=this.$refs.loginInput;e.setAttribute("type","text"),e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.setAttribute("type","password"),toast(this.$t("settings.toasts.ARLcopied"),"assignment")},changeLocale(e){this.$i18n.locale=e,this.currentLocale=e,localStorage.setItem("locale",e)},saveSettings(){this.lastSettings=JSON.parse(JSON.stringify(this.settings)),this.lastCredentials=JSON.parse(JSON.stringify(this.spotifyFeatures));let e=!1;this.lastUser!=this.spotifyUser&&(this.lastUser=(" "+this.spotifyUser).slice(1),localStorage.setItem("spotifyUser",this.lastUser),e=!0),socket.emit("saveSettings",{settings:this.lastSettings,spotifySettings:this.lastCredentials,spotifyUser:e?this.lastUser:!1})},selectDownloadFolder(){window.api.send("selectDownloadFolder",this.settings.downloadLocation)},downloadFolderSelected(e){this.$set(this.settings,"downloadLocation",e)},loadSettings(e){this.lastSettings=JSON.parse(JSON.stringify(e)),this.settings=JSON.parse(JSON.stringify(e))},loadCredentials(e){this.lastCredentials=JSON.parse(JSON.stringify(e)),this.spotifyFeatures=JSON.parse(JSON.stringify(e))},async loggedInViaDeezer(e){this.dispatchARL({arl:e})},async login(e,a=!1){toast(this.$t("toasts.loggingIn"),"loading",!1,"login-toast");const n=await fetchData("login-arl",{arl:e,force:a,child:this.accountNum},"POST"),{status:i,user:r}=n;switch(i){case 1:case 3:toast(this.$t("toasts.loggedIn"),"done",!0,"login-toast"),this.dispatchLogin(n);break;case 2:toast(this.$t("toasts.alreadyLogged"),"done",!0,"login-toast"),this.dispatchUser(r);break;case 0:toast(this.$t("toasts.loginFailed"),"close",!0,"login-toast"),this.removeARL();break;case-1:toast(this.$t("toasts.deezerNotAvailable"),"close",!0,"login-toast")}},async loginButton(){const e=this.$refs.loginInput.value.trim();e&&e!==this.arl&&this.login(e,!0)},async loginWithCredentials(){const e=getFormItem(this.$refs.loginWithCredentialsForm),{email:a}=e("email"),{password:n}=e("password"),{accessToken:i,arl:r}=await postToServer("loginWithCredentials",{email:a,password:n,accessToken:this.accessToken});i!==this.accessToken&&this.dispatchAccessTocken({accessToken:i}),r&&this.login(r)},appLogin(){window.api.send("applogin")},changeAccount(){socket.emit("changeAccount",this.accountNum)},accountChanged(e,a){this.$refs.username.innerText=e.name,this.$refs.userpicture.src=`https://e-cdns-images.dzcdn.net/images/user/${e.picture}/125x125-000000-80-0-0.jpg`,this.accountNum=a,localStorage.setItem("accountNum",this.accountNum)},initAccounts(e){this.accounts=e},async logout(){const e=await postToServer("logout");console.log(e),e.logged_out&&(toast(this.$t("toasts.loggedOut"),"done",!0,"login-toast"),this.dispatchLogout())},initSettings(e,a){this.loadSettings(e),this.loadCredentials(a),toast(this.$t("settings.toasts.init"),"settings")},updateSettings(e){const{settings:a,spotifySettings:n}=e;this.loadSettings(a),this.loadCredentials(n),toast(this.$t("settings.toasts.update"),"settings")},resetToDefault(){!confirm(this.$t("settings.resetMessage"))||(this.settings=JSON.parse(JSON.stringify(this.defaultSettings)),toast(this.$t("settings.toasts.reset"),"settings"))}}};const __vue_script__$1=script$1;var __vue_render__$1=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"fixed-footer"},[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("settings.title")))]),e._v(" "),e.isLoggedIn?n("div",{ref:"loggedInInfo",attrs:{id:"logged_in_info"}},[n("img",{ref:"userpicture",staticClass:"w-32 h-32 rounded-full",attrs:{id:"settings_picture",src:e.pictureHref,alt:"Profile Picture"}}),e._v(" "),n("i18n",{attrs:{path:"settings.login.loggedIn",tag:"p"},scopedSlots:e._u([{key:"username",fn:function(){return[n("strong",{ref:"username",attrs:{id:"settings_username"}},[e._v(e._s(e.user.name||"not logged"))])]},proxy:!0}],null,!1,2821744753)}),e._v(" "),n("button",{staticClass:"btn btn-primary",on:{click:e.logout}},[e._v(` `+e._s(e.$t("settings.login.logout"))+` `)]),e._v(" "),e.accounts.length>1?n("select",{directives:[{name:"model",rawName:"v-model",value:e.accountNum,expression:"accountNum"}],attrs:{id:"family_account"},on:{change:[function(i){var r=Array.prototype.filter.call(i.target.options,function(s){return s.selected}).map(function(s){var l="_value"in s?s._value:s.value;return l});e.accountNum=i.target.multiple?r:r[0]},e.changeAccount]}},e._l(e.accounts,function(i,r){return n("option",{key:i,domProps:{value:r.toString()}},[e._v(` `+e._s(i.name)+` @@ -4853,9 +4853,9 @@ a { `+e._s(e.$t("settings.login.arl.question"))+` `)]),e._v(" "),e.clientMode?n("a",{staticClass:"block",attrs:{href:"#"},on:{click:e.appLogin}},[e._v(` `+e._s(e.$t("settings.login.login"))+` - `)]):e._e(),e._v(" "),n("button",{staticClass:"btn btn-primary",staticStyle:{width:"100%"},on:{click:e.login}},[e._v(` + `)]):e._e(),e._v(" "),n("button",{staticClass:"btn btn-primary",staticStyle:{width:"100%"},on:{click:e.loginButton}},[e._v(` `+e._s(e.$t("settings.login.arl.update"))+` - `)])],1)]),e._v(" "),n("div",{staticClass:"settings-group"},[n("h3",{staticClass:"settings-group__header"},[n("i",{staticClass:"material-icons"},[e._v("person")]),e._v(e._s(e.$t("settings.loginWithCredentials.title"))+` + `)])],1)]),e._v(" "),e.isLoggedIn?e._e():n("div",{staticClass:"settings-group"},[n("h3",{staticClass:"settings-group__header"},[n("i",{staticClass:"material-icons"},[e._v("person")]),e._v(e._s(e.$t("settings.loginWithCredentials.title"))+` `)]),e._v(" "),n("form",{ref:"loginWithCredentialsForm",staticClass:"my-5 space-y-5",on:{submit:function(i){return i.preventDefault(),e.loginWithCredentials(i)}}},[e._m(0),e._v(" "),e._m(1),e._v(" "),n("button",{staticClass:"btn btn-primary",attrs:{type:"submit"}},[e._v(e._s(e.$t("settings.loginWithCredentials.login")))])])]),e._v(" "),n("div",{staticClass:"settings-group"},[n("h3",{staticClass:"settings-group__header"},[n("i",{staticClass:"material-icons"},[e._v("language")]),e._v(e._s(e.$t("settings.languages")))]),e._v(" "),n("ul",{staticClass:"my-5"},e._l(e.locales,function(i){return n("li",{key:i,staticClass:"inline-flex items-center locale-flag",class:{"locale-flag--current":e.currentLocale===i},attrs:{title:i},domProps:{innerHTML:e._s(e.flags[i])},on:{click:function(r){return e.changeLocale(i)}}})}),0)]),e._v(" "),n("BaseAccordion",{staticClass:"settings-group",scopedSlots:e._u([{key:"title",fn:function(){return[n("h3",{staticClass:"settings-group__header"},[n("i",{staticClass:"material-icons"},[e._v("web")]),e._v(` `+e._s(e.$t("settings.appearance.title"))+` `)])]},proxy:!0}])},[e._v(" "),n("label",{staticClass:"with-checkbox"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.modelSlimDownloads,expression:"modelSlimDownloads"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.modelSlimDownloads)?e._i(e.modelSlimDownloads,null)>-1:e.modelSlimDownloads},on:{change:function(i){var r=e.modelSlimDownloads,s=i.target,l=!!s.checked;if(Array.isArray(r)){var c=null,o=e._i(r,c);s.checked?o<0&&(e.modelSlimDownloads=r.concat([c])):o>-1&&(e.modelSlimDownloads=r.slice(0,o).concat(r.slice(o+1)))}else e.modelSlimDownloads=l}}}),e._v(" "),n("span",{staticClass:"checkbox-text"},[e._v(e._s(e.$t("settings.appearance.slimDownloadTab")))])]),e._v(" "),n("label",{staticClass:"mb-4 with-checkbox"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.modelSlimSidebar,expression:"modelSlimSidebar"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.modelSlimSidebar)?e._i(e.modelSlimSidebar,null)>-1:e.modelSlimSidebar},on:{change:function(i){var r=e.modelSlimSidebar,s=i.target,l=!!s.checked;if(Array.isArray(r)){var c=null,o=e._i(r,c);s.checked?o<0&&(e.modelSlimSidebar=r.concat([c])):o>-1&&(e.modelSlimSidebar=r.slice(0,o).concat(r.slice(o+1)))}else e.modelSlimSidebar=l}}}),e._v(" "),n("span",{staticClass:"checkbox-text"},[e._v(e._s(e.$t("settings.appearance.slimSidebar")))])])]),e._v(" "),n("BaseAccordion",{staticClass:"settings-group",scopedSlots:e._u([{key:"title",fn:function(){return[n("h3",{staticClass:"settings-group__header"},[n("i",{staticClass:"material-icons"},[e._v("folder")]),e._v(e._s(e.$t("settings.downloadPath.title"))+` @@ -4888,7 +4888,7 @@ a { `+e._s(e.$t("settings.spotify.title"))+` `)])]},proxy:!0}])},[e._v(" "),n("RouterLink",{attrs:{to:{name:"Spotify Features"}}},[e._v(` `+e._s(e.$t("settings.spotify.question"))+` - `)]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.clientID")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyFeatures.clientId,expression:"spotifyFeatures.clientId"}],attrs:{type:"text"},domProps:{value:e.spotifyFeatures.clientId},on:{input:function(i){i.target.composing||e.$set(e.spotifyFeatures,"clientId",i.target.value)}}})]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.clientSecret")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyFeatures.clientSecret,expression:"spotifyFeatures.clientSecret"}],attrs:{type:"password"},domProps:{value:e.spotifyFeatures.clientSecret},on:{input:function(i){i.target.composing||e.$set(e.spotifyFeatures,"clientSecret",i.target.value)}}})]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.username")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyUser,expression:"spotifyUser"}],attrs:{type:"text"},domProps:{value:e.spotifyUser},on:{input:function(i){i.target.composing||(e.spotifyUser=i.target.value)}}})])],1),e._v(" "),n("footer",{staticClass:"bg-background-main"},[n("button",{staticClass:"mr-2 btn btn-primary",on:{click:e.resetToDefault}},[e._v(e._s(e.$t("settings.reset")))]),e._v(" "),n("button",{staticClass:"btn btn-primary",on:{click:e.saveSettings}},[e._v(e._s(e.$t("settings.save")))])])],1)},__vue_staticRenderFns__$1=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("label",[n("span",[e._v("Username")]),e._v(" "),n("input",{attrs:{type:"text",name:"username"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("label",[n("span",[e._v("Password")]),e._v(" "),n("input",{attrs:{type:"password",name:"password"}})])}];const __vue_inject_styles__$1=function(e){!e||e("data-v-23060f25_0",{source:"#logged_in_info[data-v-23060f25]{display:flex;align-items:center;flex-direction:column;justify-content:space-evenly;height:250px}.locale-flag[data-v-23060f25]{justify-content:center;cursor:pointer;width:60px}.locale-flag[data-v-23060f25]:not(:last-child){margin-right:10px}.locale-flag.locale-flag--current[data-v-23060f25] svg{filter:brightness(1)!important}.locale-flag[data-v-23060f25] svg{width:40px!important;height:40px!important;filter:brightness(.5)}.settings-group[data-v-23060f25]{border-top-width:1px;border-color:gray}.settings-group__header[data-v-23060f25]{display:inline-flex;align-items:center;padding-top:2rem;padding-bottom:2rem;font-size:1.5rem}.settings-group__header i.material-icons[data-v-23060f25]{margin-right:1rem}.settings-container[data-v-23060f25]{display:flex}.settings-container__half[data-v-23060f25]{width:50%}.settings-container__third[data-v-23060f25]{width:33%}.settings-container__third--only-checkbox[data-v-23060f25]{display:flex;align-items:start;flex-direction:column;justify-content:center}.settings-container__half>*[data-v-23060f25],.settings-container__third>*[data-v-23060f25]{margin-bottom:1rem}.with-checkbox[data-v-23060f25]{display:flex;align-items:center}.with-checkbox [type=checkbox][data-v-23060f25]{cursor:pointer}.with-checkbox .checkbox-text[data-v-23060f25]{margin-left:10px;cursor:pointer;user-select:none}.input-group .input-group-text[data-v-23060f25]{margin-bottom:.5rem}",map:void 0,media:void 0})},__vue_scope_id__$1="data-v-23060f25",__vue_module_identifier__=void 0,__vue_is_functional_template__$1=!1;function __vue_normalize__$1(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="Settings.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__.styles||(__vue_create_injector__.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` + `)]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.clientID")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyFeatures.clientId,expression:"spotifyFeatures.clientId"}],attrs:{type:"text"},domProps:{value:e.spotifyFeatures.clientId},on:{input:function(i){i.target.composing||e.$set(e.spotifyFeatures,"clientId",i.target.value)}}})]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.clientSecret")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyFeatures.clientSecret,expression:"spotifyFeatures.clientSecret"}],attrs:{type:"password"},domProps:{value:e.spotifyFeatures.clientSecret},on:{input:function(i){i.target.composing||e.$set(e.spotifyFeatures,"clientSecret",i.target.value)}}})]),e._v(" "),n("div",{staticClass:"input-group"},[n("p",{staticClass:"input-group-text"},[e._v(e._s(e.$t("settings.spotify.username")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.spotifyUser,expression:"spotifyUser"}],attrs:{type:"text"},domProps:{value:e.spotifyUser},on:{input:function(i){i.target.composing||(e.spotifyUser=i.target.value)}}})])],1),e._v(" "),n("footer",{staticClass:"bg-background-main"},[n("button",{staticClass:"mr-2 btn btn-primary",on:{click:e.resetToDefault}},[e._v(e._s(e.$t("settings.reset")))]),e._v(" "),n("button",{staticClass:"btn btn-primary",on:{click:e.saveSettings}},[e._v(e._s(e.$t("settings.save")))])])],1)},__vue_staticRenderFns__$1=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("label",[n("span",[e._v("E-mail")]),e._v(" "),n("input",{attrs:{type:"text",name:"email"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("label",[n("span",[e._v("Password")]),e._v(" "),n("input",{attrs:{type:"password",name:"password"}})])}];const __vue_inject_styles__$1=function(e){!e||e("data-v-df326c26_0",{source:"#logged_in_info[data-v-df326c26]{display:flex;align-items:center;flex-direction:column;justify-content:space-evenly;height:250px}.locale-flag[data-v-df326c26]{justify-content:center;cursor:pointer;width:60px}.locale-flag[data-v-df326c26]:not(:last-child){margin-right:10px}.locale-flag.locale-flag--current[data-v-df326c26] svg{filter:brightness(1)!important}.locale-flag[data-v-df326c26] svg{width:40px!important;height:40px!important;filter:brightness(.5)}.settings-group[data-v-df326c26]{border-top-width:1px;border-color:gray}.settings-group__header[data-v-df326c26]{display:inline-flex;align-items:center;padding-top:2rem;padding-bottom:2rem;font-size:1.5rem}.settings-group__header i.material-icons[data-v-df326c26]{margin-right:1rem}.settings-container[data-v-df326c26]{display:flex}.settings-container__half[data-v-df326c26]{width:50%}.settings-container__third[data-v-df326c26]{width:33%}.settings-container__third--only-checkbox[data-v-df326c26]{display:flex;align-items:start;flex-direction:column;justify-content:center}.settings-container__half>*[data-v-df326c26],.settings-container__third>*[data-v-df326c26]{margin-bottom:1rem}.with-checkbox[data-v-df326c26]{display:flex;align-items:center}.with-checkbox [type=checkbox][data-v-df326c26]{cursor:pointer}.with-checkbox .checkbox-text[data-v-df326c26]{margin-left:10px;cursor:pointer;user-select:none}.input-group .input-group-text[data-v-df326c26]{margin-bottom:.5rem}",map:void 0,media:void 0})},__vue_scope_id__$1="data-v-df326c26",__vue_module_identifier__=void 0,__vue_is_functional_template__$1=!1;function __vue_normalize__$1(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="Settings.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i;{let u;if(a&&(u=function(d){a.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(h,m){return u.call(m),d(h,m)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__.styles||(__vue_create_injector__.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(r,s){if(document.querySelector('style[data-vue-ssr-id~="'+r+'"]'))return;const l=n?s.media||"default":r,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(r)){let o=s.source,u=c.ids.length;if(c.ids.push(r),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const d=c.element=document.createElement("style");d.type="text/css",s.media&&d.setAttribute("media",s.media),n&&(d.setAttribute("data-group",l),d.setAttribute("data-next-index","0")),e.appendChild(d)}if(n&&(u=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",u+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` `);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var Settings=__vue_normalize__$1({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__$1,__vue_scope_id__$1,__vue_is_functional_template__$1,__vue_module_identifier__,__vue_create_injector__),script={data(){return{title:"",metadata:"",release_date:"",label:"",explicit:!1,image:"",type:"empty",link:"",body:[]}},mounted(){EventBus.$on("showAlbum",this.showAlbum),EventBus.$on("showPlaylist",this.showPlaylist),EventBus.$on("showSpotifyPlaylist",this.showSpotifyPlaylist)},methods:{playPausePreview,reset(){this.title="Loading...",this.image="",this.metadata="",this.label="",this.release_date="",this.explicit=!1,this.type="empty",this.body=[]},addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},toggleAll(e){this.body.forEach(a=>{a.type==="track"&&(a.selected=e.currentTarget.checked)})},selectedLinks(){const e=[];return this.body&&this.body.forEach(a=>{a.type==="track"&&a.selected&&e.push(this.type==="spotifyPlaylist"?a.uri:a.link)}),e.join(";")},convertDuration:Utils.convertDuration,showAlbum(e){this.reset();const{id:a,title:n,explicit_lyrics:i,label:r,artist:{name:s},tracks:l,tracks:{length:c},release_date:o,cover_xl:u}=e;this.type="album",this.link=`https://www.deezer.com/album/${a}`,this.title=n,this.explicit=i,this.label=r,this.metadata=`${s} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,this.release_date=o.substring(0,10),this.image=u,isEmpty(l)?this.body=null:this.body=l},showPlaylist(e){this.reset();const{id:a,title:n,picture_xl:i,creation_date:r,creator:{name:s},tracks:l,tracks:{length:c}}=e;this.type="playlist",this.link=`https://www.deezer.com/playlist/${a}`,this.title=n,this.image=i,this.release_date=r.substring(0,10),this.metadata=`${this.$t("globals.by",{artist:s})} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,isEmpty(l)?this.body=null:this.body=l},showSpotifyPlaylist(e){this.reset();const{uri:a,name:n,images:i,images:{length:r},owner:{display_name:s},tracks:l,tracks:{length:c}}=e;this.type="spotifyPlaylist",this.link=a,this.title=n,this.image=r?i[0].url:"https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg",this.release_date="",this.metadata=`${this.$t("globals.by",{artist:s})} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,isEmpty(l)?this.body=null:this.body=l},selectRow(e,a){a.selected=!a.selected}}};const __vue_script__=script;var __vue_render__=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{ref:"root",staticClass:"relative fixed-footer bg-background-main image-header"},[n("header",{style:{"background-image":"linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url('"+e.image+"')"}},[n("h1",{staticClass:"flex items-center m-0 text-5xl"},[e._v(` @@ -4913,5 +4913,5 @@ a { `)]),e._v(" "),n("td",[e._v(e._s(i.artists[0].name))]),e._v(" "),n("td",[e._v(e._s(i.album.name))]),e._v(" "),n("td",[e._v(e._s(e.convertDuration(Math.floor(i.duration_ms/1e3))))]),e._v(" "),n("td",[n("input",{directives:[{name:"model",rawName:"v-model",value:i.selected,expression:"track.selected"}],staticClass:"clickable",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(i.selected)?e._i(i.selected,null)>-1:i.selected},on:{change:function(s){var l=i.selected,c=s.target,o=!!c.checked;if(Array.isArray(l)){var u=null,d=e._i(l,u);c.checked?d<0&&e.$set(i,"selected",l.concat([u])):d>-1&&e.$set(i,"selected",l.slice(0,d).concat(l.slice(d+1)))}else e.$set(i,"selected",o)}}})])])})],2)]),e._v(" "),e.label?n("span",{staticStyle:{opacity:"0.4","margin-top":"8px",display:"inline-block","font-size":"13px"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),n("footer",{staticClass:"bg-background-main"},[n("button",{staticClass:"mr-2 btn btn-primary",attrs:{"data-link":e.link},on:{click:function(i){return i.stopPropagation(),e.addToQueue(i)}}},[e._v(` `+e._s(""+e.$t("globals.download",{thing:e.$tc("globals.listTabs."+e.type,1)}))+` `)]),e._v(" "),n("button",{staticClass:"flex items-center btn btn-primary",attrs:{"data-link":e.selectedLinks()},on:{click:function(i){return i.stopPropagation(),e.addToQueue(i)}}},[e._v(` - `+e._s(e.$t("tracklist.downloadSelection"))),n("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("td",[n("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[n("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__=void 0,__vue_scope_id__=void 0,__vue_is_functional_template__=!1;function __vue_normalize__(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Tracklist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var Tracklist=__vue_normalize__({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__);Vue$2.use(VueRouter);const routes=[{path:window.location.pathname,name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist,meta:{notKeepAlive:!0}},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/about",name:"About",component:About},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search,meta:{notKeepAlive:!0}},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,a,n){return{x:0,y:0}}});router.beforeEach((e,a,n)=>{switch(e.name){case"Tracklist":{console.warn("This should never happen.");break}case"Album":{const i={type:"album",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showAlbum",r)});break}case"Playlist":{const i={type:"playlist",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showPlaylist",r)});break}case"Spotify Playlist":{const i={type:"spotifyplaylist",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showSpotifyPlaylist",r)});break}}n()});async function startApp(){new Vue$2({store,router,i18n,render:n=>n(App)}).$mount("#app");const e=await(await fetch("connect")).json();store.dispatch("setAppInfo",e.update).catch(console.error);let a=localStorage.getItem("arl");if(e.autologin){console.info("Autologin");const n=localStorage.getItem("accountNum");if(a){a=a.trim();let i;n!==0?i=await fetchData("login-arl",{arl:a,force:!0,child:n||0},"POST"):i=await fetchData("login-arl",{arl:a},"POST"),loggedIn(i)}}else loggedIn({status:3,user:e.currentUser,arl:a})}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.api&&initClient(),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let a=e.clipboardData.getData("Text");if(isValidURL(a))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",a):(a.includes(` -`)&&(a=a.replace(/\n/g,";")),sendAddToQueue(a));else{const n=document.querySelector("#searchbar");n.select(),n.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)});function loggedIn(e){const{status:a,user:n}=e;switch(a){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",n);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast")}}socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(e){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); + `+e._s(e.$t("tracklist.downloadSelection"))),n("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("td",[n("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[n("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__=void 0,__vue_scope_id__=void 0,__vue_is_functional_template__=!1;function __vue_normalize__(e,a,n,i,r,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Tracklist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,r&&(o.functional=!0)),o._scopeId=i,o}var Tracklist=__vue_normalize__({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__);Vue$2.use(VueRouter);const routes=[{path:window.location.pathname,name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist,meta:{notKeepAlive:!0}},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/about",name:"About",component:About},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search,meta:{notKeepAlive:!0}},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,a,n){return{x:0,y:0}}});router.beforeEach((e,a,n)=>{switch(e.name){case"Tracklist":{console.warn("This should never happen.");break}case"Album":{const i={type:"album",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showAlbum",r)});break}case"Playlist":{const i={type:"playlist",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showPlaylist",r)});break}case"Spotify Playlist":{const i={type:"spotifyplaylist",id:e.params.id};fetchData("getTracklist",i).then(r=>{EventBus.$emit("showSpotifyPlaylist",r)});break}}n()});async function startApp(){new Vue$2({store,router,i18n,render:i=>i(App)}).$mount("#app");const e=await(await fetch("connect")).json();store.dispatch("setAppInfo",e.update).catch(console.error);let a=localStorage.getItem("arl");const n=localStorage.getItem("accessToken");if(e.autologin){console.info("Autologin");const i=localStorage.getItem("accountNum");async function r(s,l){toast(i18n.t("toasts.loggingIn"),"loading",!1,"login-toast"),s=s.trim();let c;return l!==0?c=await fetchData("login-arl",{arl:s,force:!0,child:l||0},"POST"):c=await fetchData("login-arl",{arl:s},"POST"),c}if(a){let s=await r(a,i);if(s.status===0&&n){const{arl:l}=await postToServer("loginWithCredentials",{accessToken:n});l&&l!==a&&(a=l,store.dispatch("setARL",{arl:a})),s=await r(l,i)}loggedIn(s)}}else loggedIn({status:3,user:e.currentUser,arl:a})}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.api&&initClient(),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let a=e.clipboardData.getData("Text");if(isValidURL(a))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",a):(a.includes(` +`)&&(a=a.replace(/\n/g,";")),sendAddToQueue(a));else{const n=document.querySelector("#searchbar");n.select(),n.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)});function loggedIn(e){const{status:a,user:n}=e;switch(a){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",n);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast")}}socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); diff --git a/src/app.js b/src/app.js index 11bf3d9..fad02c1 100644 --- a/src/app.js +++ b/src/app.js @@ -21,7 +21,7 @@ import router from '@/router' import store from '@/store' import { socket } from '@/utils/socket' -import { fetchData } from '@/utils/api' +import { fetchData, postToServer } from '@/utils/api' import { toast } from '@/utils/toasts' import { isValidURL } from '@/utils/utils' import { sendAddToQueue } from '@/utils/downloads' @@ -40,12 +40,14 @@ async function startApp() { store.dispatch('setAppInfo', connectResponse.update).catch(console.error) let arl = localStorage.getItem('arl') + const accessToken = localStorage.getItem('accessToken') if (connectResponse.autologin) { console.info('Autologin') const accountNum = localStorage.getItem('accountNum') - if (arl) { + async function login(arl, accountNum) { + toast(i18n.t('toasts.loggingIn'), 'loading', false, 'login-toast') arl = arl.trim() let result @@ -55,6 +57,19 @@ async function startApp() { result = await fetchData('login-arl', { arl }, 'POST') } + return result + } + + if (arl) { + let result = await login(arl, accountNum) + if (result.status === 0 && accessToken) { + const { arl: newArl } = await postToServer('loginWithCredentials', { accessToken }) + if (newArl && newArl !== arl) { + arl = newArl + store.dispatch('setARL', { arl }) + } + result = await login(newArl, accountNum) + } loggedIn(result) } } else { @@ -68,7 +83,7 @@ function initClient() { } document.addEventListener('DOMContentLoaded', startApp) -if (window.api){ +if (window.api) { initClient() } @@ -152,22 +167,6 @@ function loggedIn(data) { } } -/* -socket.on('logging_in', function() { - toast(i18n.t('toasts.loggingIn'), 'loading', false, 'login-toast') -}) - -socket.on('logged_in', function(data) { - -}) - -socket.on('logged_out', function() { - toast(i18n.t('toasts.loggedOut'), 'done', true, 'login-toast') - - store.dispatch('logout') -}) -*/ - socket.on('restoringQueue', function () { toast(i18n.t('toasts.restoringQueue'), 'loading', false, 'restoring_queue') }) @@ -212,7 +211,7 @@ socket.on('alreadyInQueue', function (data) { toast(i18n.t('toasts.alreadyInQueue', { item: data.title }), 'playlist_add_check') }) -socket.on('loginNeededToDownload', function (data) { +socket.on('loginNeededToDownload', function () { toast(i18n.t('toasts.loginNeededToDownload'), 'report') }) diff --git a/src/components/pages/Settings.vue b/src/components/pages/Settings.vue index a407ce0..a35ae74 100644 --- a/src/components/pages/Settings.vue +++ b/src/components/pages/Settings.vue @@ -54,21 +54,21 @@ {{ $t('settings.login.login') }} - -
+

person{{ $t('settings.loginWithCredentials.title') }}