From 263a4a38f5693b73552125e7e354fa6b27a4b4c1 Mon Sep 17 00:00:00 2001 From: amsyarasyiq Date: Mon, 15 Jan 2024 13:59:51 +0000 Subject: [PATCH] deploy: ef38568839d1d94dd76f62ad7cb90061c251e696 --- Last.fm/index.js | 2 +- Last.fm/manifest.json | 2 +- MoreConfirm/index.js | 1 - MoreConfirm/manifest.json | 1 - PyonInstaller/index.js | 1 + PyonInstaller/manifest.json | 1 + RichPresence/index.js | 1 - RichPresence/manifest.json | 1 - 8 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 MoreConfirm/index.js delete mode 100644 MoreConfirm/manifest.json create mode 100644 PyonInstaller/index.js create mode 100644 PyonInstaller/manifest.json delete mode 100644 RichPresence/index.js delete mode 100644 RichPresence/manifest.json diff --git a/Last.fm/index.js b/Last.fm/index.js index 9f0da8a..4a0d1b3 100644 --- a/Last.fm/index.js +++ b/Last.fm/index.js @@ -1 +1 @@ -(function(f,a,y,F,o,S,_,h,m,w,A){"use strict";const u={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1054951789318909972",LFM_API_KEY:"014ffe8a614370f000d85d95ec30e1be",LFM_DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f","c6f59c1e5e7240a4c0d427abd71f3dbb"]};A.findByProps("SET_ACTIVITY");const C=A.findByProps("getAssetIds"),k=A.findByStoreName("SelfPresenceStore"),U=A.findByStoreName("UserStore");function p(){return L(null)}function L(e){r.pluginStopped&&(g(!0),e=null),r.lastActivity=e,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Last.fm@Vendetta"})}async function M(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.APPLICATION_ID;return e?await C.fetchAssetIds(t,e):[]}let N;const R={};function c(e,t){R[e]=t,N?.()}function O(){return[,N]=h.useReducer(function(e){return~e},0),JSON.stringify(R,null,4)}async function V(){const e=new URLSearchParams({method:"user.getrecenttracks",user:s.username,api_key:u.LFM_API_KEY,format:"json",limit:"1",extended:"1"}).toString(),t=await fetch(`https://ws.audioscrobbler.com/2.0/?${e}`);if(!t.ok)throw new Error(`Failed to fetch the latest scrobble: ${t.statusText}`);const n=await t.json(),l=n?.recenttracks?.track?.[0];if(c("lastAPIResponse",l),!l)throw n;return{name:l.name,artist:l.artist.name,album:l.album["#text"],albumArt:await x(l.image?.find(function(K){return K.size==="large"})?.["#text"]),url:l.url,date:l.date?.["#text"]??"now",nowPlaying:!!l["@attr"]?.nowplaying,loved:l.loved==="1"}}async function x(e){return u.LFM_DEFAULT_COVER_HASHES.some(function(t){return e.includes(t)})?null:e}var E;(function(e){e[e.PLAYING=0]="PLAYING",e[e.STREAMING=1]="STREAMING",e[e.LISTENING=2]="LISTENING",e[e.COMPETING=5]="COMPETING"})(E||(E={}));const i=function(){for(var e=arguments.length,t=new Array(e),n=0;n Plugin is unloaded, aborting update()..."),g();return}if(i("--> Fetching last track..."),!s.username)throw _.showToast("Last.fm username is not set!",o.getAssetIDByName("Small")),g(),new Error("Username is not set");if(s.ignoreSpotify)if(k.findActivity(function(n){return n.sync_id})){i("--> Spotify is currently playing, aborting..."),c("isSpotifyIgnored",!0),p();return}else c("isSpotifyIgnored",!1);else c("isSpotifyIgnored",void 0);const e=await V().catch(async function(n){throw i("--> An error occurred while fetching the last track, aborting..."),p(),n});if(c("lastTrack",e),!e.nowPlaying){i("--> Last track is not currently playing, aborting..."),p();return}if(i("--> Track fetched!"),r.lastTrackUrl===e.url){i("--> Last track is the same as the previous one, aborting...");return}const t={name:s.appName||u.DEFAULT_APP_NAME,flags:0,type:s.listeningTo?E.LISTENING:E.PLAYING,details:e.name,state:`by ${e.artist}`,application_id:u.APPLICATION_ID};if(r.lastTrackUrl=e.url,t.name.includes("{{"))for(const n in e)t.name=t.name.replace(`{{${n}}}`,e[n]);if(s.showTimestamp&&(t.timestamps={start:Date.now()/1e3|0}),e.album){const n=await M([e.albumArt]);t.assets={large_image:n[0],large_text:`on ${e.album}`}}i("--> Setting activity..."),c("lastActivity",t),i(t);try{L(t)}catch(n){throw i("--> An error occurred while setting the activity"),p(),n}i("--> Successfully set activity!")}function g(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;r.lastActivity=null,r.lastTrackUrl=null,r.updateInterval&&clearInterval(r.updateInterval),!e&&p()}async function I(){if(r.pluginStopped)throw new Error("Plugin is already stopped!");g();let e=0;await P().catch(function(t){console.error(t),e++}),r.updateInterval=setInterval(function(){return P().then(function(){e=0}).catch(function(t){console.error(t),++e>3&&(console.error("Failed to fetch/set activity 3 times, aborting..."),g())})},(Number(s.timeInterval)||u.DEFAULT_TIME_INTERVAL)*1e3)}const r={};w.plugin.storage.ignoreSpotify??=!0;const s={...w.plugin.storage};var B={settings:h.lazy(function(){return Promise.resolve().then(function(){return z})}),onLoad(){if(r.pluginStopped=!1,U.getCurrentUser())I().catch(console.error);else{const e=function(){I().catch(console.error),a.FluxDispatcher.unsubscribe(e)};a.FluxDispatcher.subscribe("CONNECTION_OPEN",e)}},onUnload(){r.pluginStopped=!0,g()}};const{FormRow:D,FormInput:T,FormDivider:d,FormSwitchRow:v,FormText:G,FormIcon:b}=S.Forms;function $(){async function e(){for(const t in y.storage)y.storage[t]!=null&&(s[t]=y.storage[t]);await I(),_.showToast("Settings updated!",o.getAssetIDByName("Check"))}return a.React.createElement(m.TouchableOpacity,{onPress:e},a.React.createElement(G,{style:{marginRight:12}},"UPDATE"))}var Y=a.React.memo(function(){const e=F.useProxy(y.storage),t=a.NavigationNative.useNavigation();return h.useEffect(function(){t.setOptions({title:"Last.fm Configuration",headerRight:$})},[]),a.React.createElement(m.ScrollView,null,a.React.createElement(T,{value:e.appName||void 0,onChangeText:function(n){return e.appName=n.trim()},title:"Discord Application Name",placeholder:u.DEFAULT_APP_NAME,returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(T,{required:!0,value:e.username||void 0,onChangeText:function(n){return e.username=n.trim()},title:"Last.fm username",helpText:!e.username&&a.React.createElement(m.Text,{style:{color:"#FF0000"}},"This field is required!"),placeholder:"wumpus123",returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(T,{value:e.timeInterval,onChangeText:function(n){return e.timeInterval=n},title:"Update interval (in seconds)",placeholder:u.DEFAULT_TIME_INTERVAL.toString(),keyboardType:"numeric",returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(v,{label:"Show time elapsed",subLabel:"Show the time elapsed since the song started playing",leading:a.React.createElement(b,{source:o.getAssetIDByName("clock")}),value:e.showTimestamp,onValueChange:function(n){return e.showTimestamp=n}}),a.React.createElement(d,null),a.React.createElement(v,{label:"Set status as listening",subLabel:'Set your status as "Listening to" instead of "Playing"',leading:a.React.createElement(b,{source:o.getAssetIDByName("ic_headset_neutral")}),value:e.listeningTo,onValueChange:function(n){return e.listeningTo=n}}),a.React.createElement(d,null),a.React.createElement(v,{label:"Hide when Spotify is running",subLabel:"Hide the status when a Spotify activity is detected",leading:a.React.createElement(b,{source:o.getAssetIDByName("img_account_sync_spotify_light_and_dark")}),value:e.ignoreSpotify,onValueChange:function(n){return e.ignoreSpotify=n}}),a.React.createElement(d,null),a.React.createElement(D,{label:"Debug",subLabel:"View debug information",leading:a.React.createElement(b,{source:o.getAssetIDByName("debug")}),trailing:D.Arrow,onPress:function(){t.push("VendettaCustomPage",{title:"Debug",render:h.lazy(function(){return Promise.resolve().then(function(){return j})})})}}))}),z=Object.freeze({__proto__:null,default:Y});function H(){const e=O();return React.createElement(m.ScrollView,null,React.createElement(S.Codeblock,{selectable:!0,style:{margin:12}},e))}var j=Object.freeze({__proto__:null,default:H});return f.currentSettings=s,f.default=B,f.pluginState=r,Object.defineProperty(f,"__esModule",{value:!0}),f})({},vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui.assets,vendetta.ui.components,vendetta.ui.toasts,window.React,vendetta.metro.common.ReactNative,vendetta,vendetta.metro); +(function(f,a,y,F,o,v,S,h,m,_,A){"use strict";const u={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1054951789318909972",LFM_API_KEY:"014ffe8a614370f000d85d95ec30e1be",LFM_DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f","c6f59c1e5e7240a4c0d427abd71f3dbb"]};A.findByProps("SET_ACTIVITY");const C=A.findByProps("getAssetIds"),k=A.findByStoreName("SelfPresenceStore"),U=A.findByStoreName("UserStore");function p(){return w(null)}function w(e){r.pluginStopped&&(g(!0),e=null),r.lastActivity=e,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Last.fm@Vendetta"})}async function M(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.APPLICATION_ID;return e?await C.fetchAssetIds(t,e):[]}let R;const L={};function c(e,t){L[e]=t,R?.()}function O(){return[,R]=h.useReducer(function(e){return~e},0),JSON.stringify(L,null,4)}async function V(){const e=new URLSearchParams({method:"user.getrecenttracks",user:s.username,api_key:u.LFM_API_KEY,format:"json",limit:"1",extended:"1"}).toString(),t=await fetch(`https://ws.audioscrobbler.com/2.0/?${e}`);if(!t.ok)throw new Error(`Failed to fetch the latest scrobble: ${t.statusText}`);const n=await t.json(),l=n?.recenttracks?.track?.[0];if(c("lastAPIResponse",l),!l)throw n;return{name:l.name,artist:l.artist.name,album:l.album["#text"],albumArt:await x(l.image?.find(function(K){return K.size==="large"})?.["#text"]),url:l.url,date:l.date?.["#text"]??"now",nowPlaying:!!l["@attr"]?.nowplaying,loved:l.loved==="1"}}async function x(e){return u.LFM_DEFAULT_COVER_HASHES.some(function(t){return e.includes(t)})?null:e}var P;(function(e){e[e.PLAYING=0]="PLAYING",e[e.STREAMING=1]="STREAMING",e[e.LISTENING=2]="LISTENING",e[e.COMPETING=5]="COMPETING"})(P||(P={}));const i=function(){for(var e=arguments.length,t=new Array(e),n=0;n Plugin is unloaded, aborting update()..."),g();return}if(i("--> Fetching last track..."),!s.username)throw S.showToast("Last.fm username is not set!",o.getAssetIDByName("Small")),g(),new Error("Username is not set");if(s.ignoreSpotify)if(k.findActivity(function(n){return n.sync_id})){i("--> Spotify is currently playing, aborting..."),c("isSpotifyIgnored",!0),p();return}else c("isSpotifyIgnored",!1);else c("isSpotifyIgnored",void 0);const e=await V().catch(async function(n){throw i("--> An error occurred while fetching the last track, aborting..."),p(),n});if(c("lastTrack",e),!e.nowPlaying){i("--> Last track is not currently playing, aborting..."),p();return}if(i("--> Track fetched!"),r.lastTrackUrl===e.url){i("--> Last track is the same as the previous one, aborting...");return}const t={name:s.appName||u.DEFAULT_APP_NAME,flags:0,type:s.listeningTo?2:0,details:e.name,state:`by ${e.artist}`,application_id:u.APPLICATION_ID};if(r.lastTrackUrl=e.url,t.name.includes("{{"))for(const n in e)t.name=t.name.replace(`{{${n}}}`,e[n]);if(s.showTimestamp&&(t.timestamps={start:Date.now()/1e3|0}),e.album){const n=await M([e.albumArt]);t.assets={large_image:n[0],large_text:`on ${e.album}`}}i("--> Setting activity..."),c("lastActivity",t),i(t);try{w(t)}catch(n){throw i("--> An error occurred while setting the activity"),p(),n}i("--> Successfully set activity!")}function g(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;r.lastActivity=null,r.lastTrackUrl=null,r.updateInterval&&clearInterval(r.updateInterval),!e&&p()}async function b(){if(r.pluginStopped)throw new Error("Plugin is already stopped!");g();let e=0;await N().catch(function(t){console.error(t),e++}),r.updateInterval=setInterval(function(){return N().then(function(){e=0}).catch(function(t){console.error(t),++e>3&&(console.error("Failed to fetch/set activity 3 times, aborting..."),g())})},(Number(s.timeInterval)||u.DEFAULT_TIME_INTERVAL)*1e3)}const r={};_.plugin.storage.ignoreSpotify??=!0;const s={..._.plugin.storage};var B={settings:h.lazy(function(){return Promise.resolve().then(function(){return H})}),onLoad(){if(r.pluginStopped=!1,U.getCurrentUser())b().catch(console.error);else{const e=function(){b().catch(console.error),a.FluxDispatcher.unsubscribe(e)};a.FluxDispatcher.subscribe("CONNECTION_OPEN",e)}},onUnload(){r.pluginStopped=!0,g()}};const{FormRow:D,FormInput:I,FormDivider:d,FormSwitchRow:T,FormText:$,FormIcon:E}=v.Forms;function G(){async function e(){for(const t in y.storage)y.storage[t]!=null&&(s[t]=y.storage[t]);await b(),S.showToast("Settings updated!",o.getAssetIDByName("Check"))}return a.React.createElement(m.TouchableOpacity,{onPress:e},a.React.createElement($,{style:{marginRight:12}},"UPDATE"))}var z=a.React.memo(function(){const e=F.useProxy(y.storage),t=a.NavigationNative.useNavigation();return h.useEffect(function(){t.setOptions({title:"Last.fm Configuration",headerRight:G})},[]),a.React.createElement(m.ScrollView,null,a.React.createElement(I,{value:e.appName||void 0,onChangeText:function(n){return e.appName=n.trim()},title:"Discord Application Name",placeholder:u.DEFAULT_APP_NAME,returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(I,{required:!0,value:e.username||void 0,onChangeText:function(n){return e.username=n.trim()},title:"Last.fm username",helpText:!e.username&&a.React.createElement(m.Text,{style:{color:"#FF0000"}},"This field is required!"),placeholder:"wumpus123",returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(I,{value:e.timeInterval,onChangeText:function(n){return e.timeInterval=n},title:"Update interval (in seconds)",placeholder:u.DEFAULT_TIME_INTERVAL.toString(),keyboardType:"numeric",returnKeyType:"done"}),a.React.createElement(d,null),a.React.createElement(T,{label:"Show time elapsed",subLabel:"Show the time elapsed since the song started playing",leading:a.React.createElement(E,{source:o.getAssetIDByName("clock")}),value:e.showTimestamp,onValueChange:function(n){return e.showTimestamp=n}}),a.React.createElement(d,null),a.React.createElement(T,{label:"Set status as listening",subLabel:'Set your status as "Listening to" instead of "Playing"',leading:a.React.createElement(E,{source:o.getAssetIDByName("ic_headset_neutral")}),value:e.listeningTo,onValueChange:function(n){return e.listeningTo=n}}),a.React.createElement(d,null),a.React.createElement(T,{label:"Hide when Spotify is running",subLabel:"Hide the status when a Spotify activity is detected",leading:a.React.createElement(E,{source:o.getAssetIDByName("img_account_sync_spotify_light_and_dark")}),value:e.ignoreSpotify,onValueChange:function(n){return e.ignoreSpotify=n}}),a.React.createElement(d,null),a.React.createElement(D,{label:"Debug",subLabel:"View debug information",leading:a.React.createElement(E,{source:o.getAssetIDByName("debug")}),trailing:D.Arrow,onPress:function(){t.push("VendettaCustomPage",{title:"Debug",render:h.lazy(function(){return Promise.resolve().then(function(){return j})})})}}))}),H=Object.freeze({__proto__:null,default:z});function Y(){const e=O();return React.createElement(m.ScrollView,null,React.createElement(v.Codeblock,{selectable:!0,style:{margin:12}},e))}var j=Object.freeze({__proto__:null,default:Y});return f.currentSettings=s,f.default=B,f.pluginState=r,Object.defineProperty(f,"__esModule",{value:!0}),f})({},vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui.assets,vendetta.ui.components,vendetta.ui.toasts,window.React,vendetta.metro.common.ReactNative,vendetta,vendetta.metro); diff --git a/Last.fm/manifest.json b/Last.fm/manifest.json index e4bee1e..60e5779 100644 --- a/Last.fm/manifest.json +++ b/Last.fm/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"Last.fm","description":"Show off your last.fm status on your Discord profile.","vendetta":{"icon":"ic_stage_music"},"hash":"d29cfa07eba14d6d0ad1f22d1c074dd0ed17043e26549322e0d4754967efa3c6"} \ No newline at end of file +{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"Last.fm","description":"Show off your last.fm status on your Discord profile.","vendetta":{"icon":"ic_stage_music"},"hash":"f381fb3a15c574706b7156fca952a081f270dec17eb075001473f5dbeba6a026"} \ No newline at end of file diff --git a/MoreConfirm/index.js b/MoreConfirm/index.js deleted file mode 100644 index afe84fb..0000000 --- a/MoreConfirm/index.js +++ /dev/null @@ -1 +0,0 @@ -(function(s,u,o){"use strict";function p(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function h(n,t){for(var e=0;e0:t||t===0||t===!1}function B(t){return JSON.parse(JSON.stringify(t,function(l,e){if(e===t)return e;if(!(typeof l=="string"&&l.startsWith("_")))switch(typeof e){case"object":{if(Array.isArray(e)&&e.length===0)return;const a=Object.entries(e).filter(function(M){return v(M[1])});return a.length>0?Object.fromEntries(a):void 0}default:return v(e)?e:void 0}}))}var f;(function(t){t[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.WATCHING=3]="WATCHING",t[t.COMPETING=5]="COMPETING"})(f||(f={}));const _=d.findByProps("getAssetIds"),T=Date.now(),u=s.plugin.storage;typeof u.selected?.length!="number"&&Object.assign(u,{selected:"default",selections:{default:G()}});function G(){return{name:"Discord",application_id:"1054951789318909972",flags:0,type:f.PLAYING,timestamps:{_enabled:!1,start:T},assets:{},buttons:[{},{}]}}async function I(t){if(typeof t!="object")throw new Error("Invalid activity");if(t){const l=t?.timestamps?._enabled;if(t=B(t),l?t.timestamps.start||=T:delete t.timestamps,t.assets){const e=[t.application_id,[t.assets.large_image,t.assets.small_image]];let a=_.getAssetIds(...e);a.length||(a=await _.fetchAssetIds(...e)),t.assets.large_image=a[0],t.assets.small_image=a[1]}t.buttons?.length?(t.buttons=t.buttons.filter(function(e){return e.label&&e.url}),t.buttons.length?Object.assign(t,{metadata:{button_urls:t.buttons.map(function(e){return e.url})},buttons:t.buttons.map(function(e){return e.label})}):delete t.buttons):delete t.buttons}return n.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:1608,socketId:"RichPresence@Vendetta"}),t}var m=new(function(){function t(){w(this,t),P(this,"settings",D)}return L(t,[{key:"onLoad",value:function(){s.logger.log("Sending RPC request");const l=u.selections[u.selected];if(!l)throw new Error("Selected activity does not exist");I(l).then(function(e){s.logger.log("RPC request sent"),s.logger.log(e)}).catch(function(e){s.logger.error("An error occured while sending RPC request :("),s.logger.error(e?.stack??e)})}},{key:"onUnload",value:function(){s.logger.log("Stopping RPC request"),I(null)}}]),t}());return c.default=m,Object.defineProperty(c,"__esModule",{value:!0}),c})({},vendetta,vendetta.metro,vendetta.metro.common,vendetta.plugin,vendetta.ui.components,vendetta.storage,vendetta.ui,vendetta.metro.common.ReactNative,window.React); diff --git a/RichPresence/manifest.json b/RichPresence/manifest.json deleted file mode 100644 index b02bb7c..0000000 --- a/RichPresence/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"RichPresence","description":"Sets Discord Rich Presence for your profile.","vendetta":{"icon":"games"},"hash":"fdcc10daa087bd26b1f2ab16b6e97897704bd25fabe5165cb9262b1ffd63b036"} \ No newline at end of file