From db1a0a5ec34ba715d140ea634faaf81b73b14af6 Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Wed, 23 Sep 2020 18:36:10 +0200 Subject: [PATCH] fix: logout removing client mode; fix: nickname not showing after app login --- public/js/bundle.js | 4 ++-- src/components/TheSettingsTab.vue | 10 +++++----- src/store/modules/login.js | 2 ++ src/utils/adjust-volume.js | 1 - 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/public/js/bundle.js b/public/js/bundle.js index f2974e8..32c598b 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -8,7 +8,7 @@ var e=Object.freeze({});function t(e){return null==e}function a(e){return null!= * vuex v3.5.1 * (c) 2020 Evan You * @license MIT - */var xo=("undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function To(e,t){if(void 0===t&&(t=[]),null===e||"object"!=typeof e)return e;var a,n=(a=function(t){return t.original===e},t.filter(a)[0]);if(n)return n.copy;var i=Array.isArray(e)?[]:{};return t.push({original:e,copy:i}),Object.keys(e).forEach((function(a){i[a]=To(e[a],t)})),i}function So(e,t){Object.keys(e).forEach((function(a){return t(e[a],a)}))}function zo(e){return null!==e&&"object"==typeof e}var Mo=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var a=e.state;this.state=("function"==typeof a?a():a)||{}},Do={namespaced:{configurable:!0}};Do.namespaced.get=function(){return!!this._rawModule.namespaced},Mo.prototype.addChild=function(e,t){this._children[e]=t},Mo.prototype.removeChild=function(e){delete this._children[e]},Mo.prototype.getChild=function(e){return this._children[e]},Mo.prototype.hasChild=function(e){return e in this._children},Mo.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)},Mo.prototype.forEachChild=function(e){So(this._children,e)},Mo.prototype.forEachGetter=function(e){this._rawModule.getters&&So(this._rawModule.getters,e)},Mo.prototype.forEachAction=function(e){this._rawModule.actions&&So(this._rawModule.actions,e)},Mo.prototype.forEachMutation=function(e){this._rawModule.mutations&&So(this._rawModule.mutations,e)},Object.defineProperties(Mo.prototype,Do);var Po,$o=function(e){this.register([],e,!1)};$o.prototype.get=function(e){return e.reduce((function(e,t){return e.getChild(t)}),this.root)},$o.prototype.getNamespace=function(e){var t=this.root;return e.reduce((function(e,a){return e+((t=t.getChild(a)).namespaced?a+"/":"")}),"")},$o.prototype.update=function(e){!function e(t,a,n){if(a.update(n),n.modules)for(var i in n.modules){if(!a.getChild(i))return;e(t.concat(i),a.getChild(i),n.modules[i])}}([],this.root,e)},$o.prototype.register=function(e,t,a){var n=this;void 0===a&&(a=!0);var i=new Mo(t,a);0===e.length?this.root=i:this.get(e.slice(0,-1)).addChild(e[e.length-1],i);t.modules&&So(t.modules,(function(t,i){n.register(e.concat(i),t,a)}))},$o.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),a=e[e.length-1],n=t.getChild(a);n&&n.runtime&&t.removeChild(a)},$o.prototype.isRegistered=function(e){var t=this.get(e.slice(0,-1)),a=e[e.length-1];return t.hasChild(a)};var No=function(e){var t=this;void 0===e&&(e={}),!Po&&"undefined"!=typeof window&&window.Vue&&Bo(window.Vue);var a=e.plugins;void 0===a&&(a=[]);var n=e.strict;void 0===n&&(n=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new $o(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new Po,this._makeLocalGettersCache=Object.create(null);var i=this,r=this.dispatch,s=this.commit;this.dispatch=function(e,t){return r.call(i,e,t)},this.commit=function(e,t,a){return s.call(i,e,t,a)},this.strict=n;var o=this._modules.root.state;Eo(this,o,[],this._modules.root),Fo(this,o),a.forEach((function(e){return e(t)})),(void 0!==e.devtools?e.devtools:Po.config.devtools)&&function(e){xo&&(e._devtoolHook=xo,xo.emit("vuex:init",e),xo.on("vuex:travel-to-state",(function(t){e.replaceState(t)})),e.subscribe((function(e,t){xo.emit("vuex:mutation",e,t)}),{prepend:!0}),e.subscribeAction((function(e,t){xo.emit("vuex:action",e,t)}),{prepend:!0}))}(this)},Lo={state:{configurable:!0}};function Ro(e,t,a){return t.indexOf(e)<0&&(a&&a.prepend?t.unshift(e):t.push(e)),function(){var a=t.indexOf(e);a>-1&&t.splice(a,1)}}function Io(e,t){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var a=e.state;Eo(e,a,[],e._modules.root,!0),Fo(e,a,t)}function Fo(e,t,a){var n=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var i=e._wrappedGetters,r={};So(i,(function(t,a){r[a]=function(e,t){return function(){return e(t)}}(t,e),Object.defineProperty(e.getters,a,{get:function(){return e._vm[a]},enumerable:!0})}));var s=Po.config.silent;Po.config.silent=!0,e._vm=new Po({data:{$$state:t},computed:r}),Po.config.silent=s,e.strict&&function(e){e._vm.$watch((function(){return this._data.$$state}),(function(){}),{deep:!0,sync:!0})}(e),n&&(a&&e._withCommit((function(){n._data.$$state=null})),Po.nextTick((function(){return n.$destroy()})))}function Eo(e,t,a,n,i){var r=!a.length,s=e._modules.getNamespace(a);if(n.namespaced&&(e._modulesNamespaceMap[s],e._modulesNamespaceMap[s]=n),!r&&!i){var o=jo(t,a.slice(0,-1)),l=a[a.length-1];e._withCommit((function(){Po.set(o,l,n.state)}))}var c=n.context=function(e,t,a){var n=""===t,i={dispatch:n?e.dispatch:function(a,n,i){var r=Oo(a,n,i),s=r.payload,o=r.options,l=r.type;return o&&o.root||(l=t+l),e.dispatch(l,s)},commit:n?e.commit:function(a,n,i){var r=Oo(a,n,i),s=r.payload,o=r.options,l=r.type;o&&o.root||(l=t+l),e.commit(l,s,o)}};return Object.defineProperties(i,{getters:{get:n?function(){return e.getters}:function(){return function(e,t){if(!e._makeLocalGettersCache[t]){var a={},n=t.length;Object.keys(e.getters).forEach((function(i){if(i.slice(0,n)===t){var r=i.slice(n);Object.defineProperty(a,r,{get:function(){return e.getters[i]},enumerable:!0})}})),e._makeLocalGettersCache[t]=a}return e._makeLocalGettersCache[t]}(e,t)}},state:{get:function(){return jo(e.state,a)}}}),i}(e,s,a);n.forEachMutation((function(t,a){!function(e,t,a,n){(e._mutations[t]||(e._mutations[t]=[])).push((function(t){a.call(e,n.state,t)}))}(e,s+a,t,c)})),n.forEachAction((function(t,a){var n=t.root?a:s+a,i=t.handler||t;!function(e,t,a,n){(e._actions[t]||(e._actions[t]=[])).push((function(t){var i,r=a.call(e,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:e.getters,rootState:e.state},t);return(i=r)&&"function"==typeof i.then||(r=Promise.resolve(r)),e._devtoolHook?r.catch((function(t){throw e._devtoolHook.emit("vuex:error",t),t})):r}))}(e,n,i,c)})),n.forEachGetter((function(t,a){!function(e,t,a,n){if(e._wrappedGetters[t])return;e._wrappedGetters[t]=function(e){return a(n.state,n.getters,e.state,e.getters)}}(e,s+a,t,c)})),n.forEachChild((function(n,r){Eo(e,t,a.concat(r),n,i)}))}function jo(e,t){return t.reduce((function(e,t){return e[t]}),e)}function Oo(e,t,a){return zo(e)&&e.type&&(a=t,t=e,e=e.type),{type:e,payload:t,options:a}}function Bo(e){Po&&e===Po||function(e){if(Number(e.version.split(".")[0])>=2)e.mixin({beforeCreate:a});else{var t=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[a].concat(e.init):a,t.call(this,e)}}function a(){var e=this.$options;e.store?this.$store="function"==typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}(Po=e)}Lo.state.get=function(){return this._vm._data.$$state},Lo.state.set=function(e){},No.prototype.commit=function(e,t,a){var n=this,i=Oo(e,t,a),r=i.type,s=i.payload,o={type:r,payload:s},l=this._mutations[r];l&&(this._withCommit((function(){l.forEach((function(e){e(s)}))})),this._subscribers.slice().forEach((function(e){return e(o,n.state)})))},No.prototype.dispatch=function(e,t){var a=this,n=Oo(e,t),i=n.type,r=n.payload,s={type:i,payload:r},o=this._actions[i];if(o){try{this._actionSubscribers.slice().filter((function(e){return e.before})).forEach((function(e){return e.before(s,a.state)}))}catch(e){}var l=o.length>1?Promise.all(o.map((function(e){return e(r)}))):o[0](r);return new Promise((function(e,t){l.then((function(t){try{a._actionSubscribers.filter((function(e){return e.after})).forEach((function(e){return e.after(s,a.state)}))}catch(e){}e(t)}),(function(e){try{a._actionSubscribers.filter((function(e){return e.error})).forEach((function(t){return t.error(s,a.state,e)}))}catch(e){}t(e)}))}))}},No.prototype.subscribe=function(e,t){return Ro(e,this._subscribers,t)},No.prototype.subscribeAction=function(e,t){return Ro("function"==typeof e?{before:e}:e,this._actionSubscribers,t)},No.prototype.watch=function(e,t,a){var n=this;return this._watcherVM.$watch((function(){return e(n.state,n.getters)}),t,a)},No.prototype.replaceState=function(e){var t=this;this._withCommit((function(){t._vm._data.$$state=e}))},No.prototype.registerModule=function(e,t,a){void 0===a&&(a={}),"string"==typeof e&&(e=[e]),this._modules.register(e,t),Eo(this,this.state,e,this._modules.get(e),a.preserveState),Fo(this,this.state)},No.prototype.unregisterModule=function(e){var t=this;"string"==typeof e&&(e=[e]),this._modules.unregister(e),this._withCommit((function(){var a=jo(t.state,e.slice(0,-1));Po.delete(a,e[e.length-1])})),Io(this)},No.prototype.hasModule=function(e){return"string"==typeof e&&(e=[e]),this._modules.isRegistered(e)},No.prototype.hotUpdate=function(e){this._modules.update(e),Io(this,!0)},No.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t},Object.defineProperties(No.prototype,Lo);var Uo=Ho((function(e,t){var a={};return Wo(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){var t=this.$store.state,a=this.$store.getters;if(e){var n=Ko(this.$store,"mapState",e);if(!n)return;t=n.context.state,a=n.context.getters}return"function"==typeof i?i.call(this,t,a):t[i]},a[n].vuex=!0})),a})),qo=Ho((function(e,t){var a={};return Wo(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];var n=this.$store.commit;if(e){var r=Ko(this.$store,"mapMutations",e);if(!r)return;n=r.context.commit}return"function"==typeof i?i.apply(this,[n].concat(t)):n.apply(this.$store,[i].concat(t))}})),a})),Vo=Ho((function(e,t){var a={};return Wo(t).forEach((function(t){var n=t.key,i=t.val;i=e+i,a[n]=function(){if(!e||Ko(this.$store,"mapGetters",e))return this.$store.getters[i]},a[n].vuex=!0})),a})),Go=Ho((function(e,t){var a={};return Wo(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];var n=this.$store.dispatch;if(e){var r=Ko(this.$store,"mapActions",e);if(!r)return;n=r.context.dispatch}return"function"==typeof i?i.apply(this,[n].concat(t)):n.apply(this.$store,[i].concat(t))}})),a}));function Wo(e){return function(e){return Array.isArray(e)||zo(e)}(e)?Array.isArray(e)?e.map((function(e){return{key:e,val:e}})):Object.keys(e).map((function(t){return{key:t,val:e[t]}})):[]}function Ho(e){return function(t,a){return"string"!=typeof t?(a=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),e(t,a)}}function Ko(e,t,a){return e._modulesNamespaceMap[a]}function Qo(e,t,a){var n=a?e.groupCollapsed:e.group;try{n.call(e,t)}catch(a){e.log(t)}}function Yo(e){try{e.groupEnd()}catch(t){e.log("—— log end ——")}}function Jo(){var e=new Date;return" @ "+Zo(e.getHours(),2)+":"+Zo(e.getMinutes(),2)+":"+Zo(e.getSeconds(),2)+"."+Zo(e.getMilliseconds(),3)}function Zo(e,t){return function(e,t){return new Array(t+1).join(e)}("0",t-e.toString().length)+e}var Xo={Store:No,install:Bo,version:"3.5.1",mapState:Uo,mapMutations:qo,mapGetters:Vo,mapActions:Go,createNamespacedHelpers:function(e){return{mapState:Uo.bind(null,e),mapGetters:Vo.bind(null,e),mapMutations:qo.bind(null,e),mapActions:Go.bind(null,e)}},createLogger:function(e){void 0===e&&(e={});var t=e.collapsed;void 0===t&&(t=!0);var a=e.filter;void 0===a&&(a=function(e,t,a){return!0});var n=e.transformer;void 0===n&&(n=function(e){return e});var i=e.mutationTransformer;void 0===i&&(i=function(e){return e});var r=e.actionFilter;void 0===r&&(r=function(e,t){return!0});var s=e.actionTransformer;void 0===s&&(s=function(e){return e});var o=e.logMutations;void 0===o&&(o=!0);var l=e.logActions;void 0===l&&(l=!0);var c=e.logger;return void 0===c&&(c=console),function(e){var d=To(e.state);void 0!==c&&(o&&e.subscribe((function(e,r){var s=To(r);if(a(e,d,s)){var o=Jo(),l=i(e),u="mutation "+e.type+o;Qo(c,u,t),c.log("%c prev state","color: #9E9E9E; font-weight: bold",n(d)),c.log("%c mutation","color: #03A9F4; font-weight: bold",l),c.log("%c next state","color: #4CAF50; font-weight: bold",n(s)),Yo(c)}d=s})),l&&e.subscribeAction((function(e,a){if(r(e,a)){var n=Jo(),i=s(e),o="action "+e.type+n;Qo(c,o,t),c.log("%c action","color: #03A9F4; font-weight: bold",i),Yo(c)}})))}}};var el={state:{currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null},getters:{getAboutInfo:e=>e},actions:{setAboutInfo({commit:e},t){e("SET_CURRENT_COMMIT",t.currentCommit),e("SET_LATEST_COMMIT",t.latestCommit),e("SET_UPDATE_AVAILABLE",t.updateAvailable),e("SET_DEEMIX_VERSION",t.deemixVersion)}},mutations:{SET_CURRENT_COMMIT:(e,t)=>{e.currentCommit=t},SET_LATEST_COMMIT:(e,t)=>{e.latestCommit=t},SET_UPDATE_AVAILABLE:(e,t)=>{e.updateAvailable=t},SET_DEEMIX_VERSION:(e,t)=>{e.deemixVersion=t}}};const tl=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""},clientMode:!1});var al={state:tl(),getters:{getARL:e=>e.arl,getUser:e=>e.user,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl},actions:{login({commit:e,dispatch:t},a){const{arl:n,user:i,status:r}=a;t("setARL",{arl:n}),e("SET_USER",i),e("SET_STATUS",r)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},t){let{arl:a,saveOnLocalStorage:n}=t;n=void 0===n||n,e("SET_ARL",a),n&&localStorage.setItem("arl",a)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:e},t){e("SET_USER",t)},setClientMode({commit:e},t){e("SET_CLIENT_MODE",t)}},mutations:{SET_ARL(e,t){e.arl=t},SET_STATUS(e,t){e.status=t},SET_USER(e,t){e.user=t},SET_CLIENT_MODE(e,t){e.clientMode=t},RESET_LOGIN(e){Object.assign(e,tl())}}};var nl={state:{artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""},getters:{getErrors:e=>e},actions:{setErrors({commit:e},t){e("SET_ERRORS",t)}},mutations:{SET_ERRORS(e,t){for(const a in e)if(e.hasOwnProperty(a)){const n=t[a];e[a]=n}}}};_a.use(Xo);var il=new Xo.Store({modules:{about:el,login:al,errors:nl},strict:!1});const rl=io.connect(window.location.href);function sl(e,t=null){e&&rl.emit("addToQueue",{url:e,bitrate:t},()=>{})}rl.on("connect",()=>{document.getElementById("start_app_placeholder").classList.add("loading_placeholder--hidden")}),rl.on("init_update",e=>{il.dispatch("setAboutInfo",e)});var ol={sendAddToQueue:sl};const ll={data:()=>({open:!1,url:""}),mounted(){this.$root.$on("QualityModal:open",this.openModal),this.$refs.modal.addEventListener("webkitAnimationEnd",this.handleAnimationEnd)},methods:{tryToDownloadTrack(e){const{target:t}=e;this.$refs.modal.classList.add("animated","fadeOut"),t.matches(".quality-button")&&ol.sendAddToQueue(this.url,t.dataset.qualityValue)},openModal(e){this.url=e,this.open=!0,this.$refs.modal.classList.add("animated","fadeIn")},handleAnimationEnd(e){const{animationName:t}=e;this.$refs.modal.classList.remove("animated",t),"fadeIn"!==t&&(this.open=!1)}}};var cl=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"show",rawName:"v-show",value:e.open,expression:"open"}],ref:"modal",staticClass:"smallmodal",attrs:{id:"modal_quality"},on:{click:function(t){return e.tryToDownloadTrack(t)}}},[a("div",{staticClass:"smallmodal-content"},[a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"9"}},[e._v(e._s(e.$t("globals.download",{thing:"FLAC"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"3"}},[e._v(e._s(e.$t("globals.download",{thing:"MP3 320kbps"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"1"}},[e._v(e._s(e.$t("globals.download",{thing:"MP3 128kbps"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"15"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [HQ]"}))+"\n\t\t")]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"14"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [MQ]"}))+"\n\t\t")]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"13"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [LQ]"}))+"\n\t\t")])])])};cl._withStripped=!0;var dl=function(e,t,a,n,i,r,s,o){const l=("function"==typeof a?a.options:a)||{};l.__file="C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=n;{let e;if(t&&(e=function(e){t.call(this,s(e))}),void 0!==e)if(l.functional){const t=l.render;l.render=function(a,n){return e.call(n),t(a,n)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,e):[e]}}return l}({render:cl,staticRenderFns:[]},(function(e){e&&e("data-v-48a043f0_0",{source:"\n.smallmodal {\r\n\tposition: fixed;\r\n\tz-index: 1250;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: auto;\r\n\tbackground-color: hsla(0, 0%, 0%, 0.4);\r\n\tanimation-duration: 0.3s;\n}\n.smallmodal-content {\r\n\tbackground-color: transparent;\r\n\tmargin: auto;\r\n\twidth: var(--modal-content-width);\r\n\tposition: relative;\r\n\ttop: 50%;\r\n\ttransform: translateY(-50%);\n}\n.smallmodal-content button {\r\n\twidth: 100%;\r\n\tmargin-bottom: 8px;\n}\r\n",map:{version:3,sources:["C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui/C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue"],names:[],mappings:";AAmBA;CACA,eAAA;CACA,aAAA;CACA,OAAA;CACA,MAAA;CACA,WAAA;CACA,YAAA;CACA,cAAA;CACA,sCAAA;CACA,wBAAA;AACA;AAEA;CACA,6BAAA;CACA,YAAA;CACA,iCAAA;CACA,kBAAA;CACA,QAAA;CACA,2BAAA;AACA;AAEA;CACA,WAAA;CACA,kBAAA;AACA",file:"TheQualityModal.vue",sourcesContent:["\r\n\r\n