2 lines
37 KiB
JavaScript
2 lines
37 KiB
JavaScript
|
|
(function(B,f,r,$,tt,D,W,S,v,J,Le,Q){"use strict";const l={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1054951789318909972",MIN_UPDATE_INTERVAL:3,MAX_RETRY_ATTEMPTS:3,RETRY_DELAY:5e3,SERVICES:{lastfm:{name:"Last.fm",baseUrl:"http://ws.audioscrobbler.com/2.0",requiresApiKey:!0,requiresToken:!1},librefm:{name:"Libre.fm",baseUrl:"http://libre.fm/api",requiresApiKey:!0,requiresToken:!1},listenbrainz:{name:"ListenBrainz",baseUrl:"http://api.listenbrainz.org/1",requiresApiKey:!1,requiresToken:!0}},DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f","c6f59c1e5e7240a4c0d427abd71f3dbb"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,ignoreSpotify:!0,verboseLogging:!1,service:"lastfm",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 V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function F(e,t,n){return t&&ue(e.prototype,t),n&&ue(e,n),e}$.findByProps("SET_ACTIVITY");const Ce=$.findByProps("getAssetIds"),Pe=$.findByStoreName("SelfPresenceStore"),ge=$.findByStoreName("UserStore"),fe=function(...e){return console.log("[Activity]",...e)},Ne=function(...e){return console.error("[Activity] Error:",...e)},x=function(...e){try{console.log("[Activity] Verbose:",...e)}catch{console.log("[Activity] Verbose:",...e)}};function Z(){return fe("Clearing Discord activity"),de(null)}function de(e){h.pluginStopped&&(x("Plugin is stopped, clearing activity"),Ee(),e=null),h.lastActivity=e,x("Dispatching activity update:",e?"Setting activity":"Clearing activity"),r.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Multi-Service-Scrobbler@Vendetta"}),fe(e?`Activity set: ${e.details} - ${e.state}`:"Activity cleared")}async function $e(e,t=l.APPLICATION_ID){if(!e?.length)return x("No assets to fetch"),[];try{x(`Fetching ${e.length} asset(s):`,e);const n=await Ce.fetchAssetIds(t,e);return x(`Successfully fetched ${n.length} asset(s)`),n}catch(n){return Ne("Failed to fetch assets:",n),[]}}const b={};b.componentMountErrors=[],b.componentMountCount=0,b.settingsLoadAttempts=0,b.serviceErrors={lastfm:[],librefm:[],listenbrainz:[]},b.apiCallCount=0,b.connectionAttempts=0,b.lastCredentialValidation={lastfm:!1,librefm:!1,listenbrainz:!1};const q=function(...e){return console.log("[Debug]",...e)},pe=function(...e){return console.error("[Debug] Error:",...e)};function G(e,t){b[e]=t,e==="lastError"&&t?pe("Error recorded:",t.message):e==="lastTrack"&&t?q("Track updated:",`${t.artist} - ${t.name}`):e==="currentService"&&t&&q("Service changed to:",t)}function be(){b.apiCallCount=(b.apiCallCount||0)+1,q(`API call count: ${b.apiCallCount}`)}function j(e,t){b.serviceErrors=b.serviceErrors||{lastfm:[],librefm:[],listenbrainz:[]},b.serviceErrors[e]=b.serviceErrors[e]||[],b.serviceErrors[e].push(`${new Date().toISOString()}: ${t}`),b.serviceErrors[e].length>10&&(b.serviceErrors[e]=b.serviceErrors[e].slice(-10)),pe(`${e} error:`,t)}function he(){b.lastSuccessfulUpdate=new Date().toISOString(),q("Successful update recorded at:",b.lastSuccessfulUpdate)}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Y(e)}function ye(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ye=function(){return!!e})()}function Ue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){"@swc/
|