2 lines
52 KiB
JavaScript
2 lines
52 KiB
JavaScript
|
|
(function(Y,p,r,x,Pt,U,re,T,w,Q,Qe,ne){"use strict";const b={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1368513179272871956",MIN_UPDATE_INTERVAL:3,LIBREFM_MIN_UPDATE_INTERVAL:60,MAX_RETRY_ATTEMPTS:3,RETRY_DELAY:5e3,SERVICES:{lastfm:{name:"Last.fm",baseUrl:"https://ws.audioscrobbler.com/2.0",requiresApiKey:!0,requiresToken:!1},librefm:{name:"Libre.fm",baseUrl:"https://libre.fm/2.0",requiresApiKey:!0,requiresToken:!1},listenbrainz:{name:"ListenBrainz",baseUrl:"https://api.listenbrainz.org/1",requiresApiKey:!0,requiresToken:!0}},DEFAULT_HEADERS:{},DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,showLargeText:!0,ignoreYouTubeMusic:!1,verboseLogging:!1,service:void 0,librefmUsername:"",librefmApiKey:"",listenbrainzUsername:"",listenbrainzToken:""},API_ERROR_CODES:{2:"Invalid service",3:"Invalid method",4:"Invalid format",5:"Invalid parameters",6:"Invalid resource specified",7:"Invalid session key",8:"Invalid API key",9:"Invalid session",10:"Invalid API signature",11:"Service offline",13:"Invalid method signature supplied",16:"Service temporarily unavailable",26:"Suspended API key",29:"Rate limit exceeded"}};function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function O(e,t,n){return t&&be(e.prototype,t),n&&be(e,n),e}const{SET_ACTIVITY:Nt}=x.findByProps("SET_ACTIVITY"),Je=x.findByProps("getAssetIds"),Ze=x.findByStoreName("SelfPresenceStore"),he=x.findByStoreName("UserStore");function ae(){return ye(null)}function ye(e){S.pluginStopped&&(ue(),e=null),S.lastActivity=e,r.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Multi-Scrobbler@Vendetta"})}async function et(e,t=b.APPLICATION_ID){if(!e?.length)return[];try{return await Je.fetchAssetIds(t,e)}catch(n){return console.error("[Multi-Scrobbler] Failed to fetch assets:",n),[]}}const R={};R.componentMountErrors=[],R.componentMountCount=0,R.settingsLoadAttempts=0,R.serviceErrors={lastfm:[],librefm:[],listenbrainz:[]},R.apiCallCount=0,R.connectionAttempts=0,R.lastCredentialValidation={lastfm:!1,librefm:!1,listenbrainz:!1};const J=function(...e){return console.log("[Debug]",...e)},me=function(...e){return console.error("[Debug] Error:",...e)};function G(e,t){R[e]=t,e==="lastError"&&t?me("Error recorded:",t.message):e==="lastTrack"&&t?J("Track updated:",`${t.artist} - ${t.name}`):e==="currentService"&&t&&J("Service changed to:",t)}function ve(){R.apiCallCount=(R.apiCallCount||0)+1,J(`API call count: ${R.apiCallCount}`)}function Z(e,t){R.serviceErrors=R.serviceErrors||{lastfm:[],librefm:[],listenbrainz:[]},R.serviceErrors[e]=R.serviceErrors[e]||[],R.serviceErrors[e].push(`${new Date().toISOString()}: ${t}`),R.serviceErrors[e].length>10&&(R.serviceErrors[e]=R.serviceErrors[e].slice(-10)),me(`${e} error:`,t)}function we(){R.lastSuccessfulUpdate=new Date().toISOString(),J("Successful update recorded at:",R.lastSuccessfulUpdate)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ee(e)}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Re=function(){return!!e})()}function tt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function nt(e,t){return t&&(rt(t)==="object"||typeof t=="function")?t:tt(e)}function ie(e,t,n){return t=ee(t),nt(e,Re()?Reflect.construct(t,n||[],ee(e).constructor):t.apply(e,n))}function se(e,t){return se=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},se(e,t)}function oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function"
|