2026-01-01 18:59:48 +00:00
|
|
|
(function(G,p,r,z,Dt,D,re,T,v,H,rt,ne){"use strict";const h={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1368513179272871956",MIN_UPDATE_INTERVAL:3,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/api",requiresApiKey:!0,requiresToken:!1},listenbrainz:{name:"ListenBrainz",baseUrl:"https://api.listenbrainz.org/1",requiresApiKey:!1,requiresToken:!0}},DEFAULT_HEADERS:{},DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,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 M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(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 B(e,t,n){return t&&ve(e.prototype,t),n&&ve(e,n),e}const{SET_ACTIVITY:_t}=z.findByProps("SET_ACTIVITY"),nt=z.findByProps("getAssetIds"),at=z.findByStoreName("SelfPresenceStore"),we=z.findByStoreName("UserStore"),Re=function(...e){return console.log("[Activity]",...e)},it=function(...e){return console.error("[Activity] Error:",...e)},q=function(...e){try{console.log("[Activity] Verbose:",...e)}catch{console.log("[Activity] Verbose:",...e)}};function ae(){return Re("Clearing Discord activity"),Ee(null)}function Ee(e){S.pluginStopped&&(q("Plugin is stopped, clearing activity"),ge(),e=null),S.lastActivity=e,q("Dispatching activity update:",e?"Setting activity":"Clearing activity"),r.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Multi-Service-Scrobbler@Vendetta"}),Re(e?`Activity set: ${e.details} - ${e.state}`:"Activity cleared")}async function st(e,t=h.APPLICATION_ID){if(!e?.length)return q("No assets to fetch"),[];try{q(`Fetching ${e.length} asset(s):`,e);const n=await nt.fetchAssetIds(t,e);return q(`Successfully fetched ${n.length} asset(s)`),n}catch(n){return it("Failed to fetch assets:",n),[]}}const w={};w.componentMountErrors=[],w.componentMountCount=0,w.settingsLoadAttempts=0,w.serviceErrors={lastfm:[],librefm:[],listenbrainz:[]},w.apiCallCount=0,w.connectionAttempts=0,w.lastCredentialValidation={lastfm:!1,librefm:!1,listenbrainz:!1};const Q=function(...e){return console.log("[Debug]",...e)},Se=function(...e){return console.error("[Debug] Error:",...e)};function ie(e,t){w[e]=t,e==="lastError"&&t?Se("Error recorded:",t.message):e==="lastTrack"&&t?Q("Track updated:",`${t.artist} - ${t.name}`):e==="currentService"&&t&&Q("Service changed to:",t)}function Te(){w.apiCallCount=(w.apiCallCount||0)+1,Q(`API call count: ${w.apiCallCount}`)}function J(e,t){w.serviceErrors=w.serviceErrors||{lastfm:[],librefm:[],listenbrainz:[]},w.serviceErrors[e]=w.serviceErrors[e]||[],w.serviceErrors[e].push(`${new Date().toISOString()}: ${t}`),w.serviceErrors[e].length>10&&(w.serviceErrors[e]=w.serviceErrors[e].slice(-10)),Se(`${e} error:`,t)}function Ie(){w.lastSuccessfulUpdate=new Date().toISOString(),Q("Successful update recorded at:",w.lastSuccessfulUpdate)}function Z(e){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Z(e)}function ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ke=function(){return!!e})()}function ot(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lt(e){"@swc/helpers - typeof";return e&&t
|