From 699c5c2a52fe2e28d8bc00b4c76bb87a15142d9e Mon Sep 17 00:00:00 2001 From: wont-stream Date: Thu, 11 Jul 2024 04:16:37 +0000 Subject: [PATCH] deploy: 314e346db5033fc03226eea6292f893c4194ca35 --- DiscordRPC/index.js | 2 +- DiscordRPC/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DiscordRPC/index.js b/DiscordRPC/index.js index 6a421d1..68afc3b 100644 --- a/DiscordRPC/index.js +++ b/DiscordRPC/index.js @@ -1 +1 @@ -import{store as p,intercept as g,currentMediaItem as u}from"@neptune";import{getMediaURLFromID as y}from"@neptune/utils";var a=[],s=t=>t.length>=128?t.slice(0,125)+"...":t,n=new WebSocket("ws://127.0.0.1:6463/?v=1&client_id=1130698654987067493");n.onclose=()=>{a.forEach(t=>t()),a=[],setTimeout(()=>{n=new WebSocket("ws://127.0.0.1:6463/?v=1&client_id=1130698654987067493")},5e3)};n.onopen=b;var b=()=>{a.push(g("playbackControls/TIME_UPDATE",([t])=>{let i=p.getState(),{item:e,type:r}=u;if(r!="track")return;let l=y(e.album.cover),o=new Date,S=o.getTime()/1e3|0,m=o.setSeconds(o.getSeconds()+(e.duration-t)),c=i.playbackControls.playbackState=="NOT_PLAYING";n.send(JSON.stringify({cmd:"SET_ACTIVITY",args:{pid:2094112,activity:{timestamps:{...c?{}:{end:m}},type:2,name:s(e.title),details:s("by "+e.artists.map(d=>d.name).join(", ")),assets:{large_image:l,large_text:`on ${s(e.album.title)}`,...c?{small_image:"paused-icon",small_text:"Paused"}:{}}}}}))}))};async function f(){a.forEach(t=>t());try{n.close()}catch{}}export{f as onUnload}; +import{store as p,intercept as g,currentMediaItem as u}from"@neptune";import{getMediaURLFromID as y}from"@neptune/utils";var c=[],n=t=>t.length>=128?t.slice(0,125)+"...":t,o=new WebSocket("ws://127.0.0.1:6463/?v=1&client_id=1130698654987067493");o.onopen=()=>{c.push(g("playbackControls/TIME_UPDATE",([t])=>{let i=p.getState(),{item:e,type:r}=u;if(r!="track")return;let l=y(e.album.cover),a=new Date,b=a.getTime()/1e3|0,m=a.setSeconds(a.getSeconds()+(e.duration-t)),s=i.playbackControls.playbackState=="NOT_PLAYING";o.send(JSON.stringify({cmd:"SET_ACTIVITY",args:{pid:2094112,activity:{timestamps:{...s?{}:{end:m}},type:2,name:n(e.title),details:n("by "+e.artists.map(d=>d.name).join(", ")),assets:{large_image:l,large_text:`on ${n(e.album.title)}`,...s?{small_image:"paused-icon",small_text:"Paused"}:{}}}}}))}))};async function _(){c.forEach(t=>t());try{o.close()}catch{}}export{_ as onUnload}; diff --git a/DiscordRPC/manifest.json b/DiscordRPC/manifest.json index 83c8346..28398f5 100644 --- a/DiscordRPC/manifest.json +++ b/DiscordRPC/manifest.json @@ -1 +1 @@ -{"name":"Discord RPC","description":"An opinionated arRPC only Discord RPC. (forked from toonlink's plugin)","author":"wont-stream","hash":"24731d0cb961de98ff1e4a67f1447be2"} \ No newline at end of file +{"name":"Discord RPC","description":"An opinionated arRPC only Discord RPC. (forked from toonlink's plugin)","author":"wont-stream","hash":"3802f38e74234ea2ac453ddda8b2059f"} \ No newline at end of file