diff --git a/src/main/plugins/discordrpc.ts b/src/main/plugins/discordrpc.ts index 9d158763..682b3c1c 100644 --- a/src/main/plugins/discordrpc.ts +++ b/src/main/plugins/discordrpc.ts @@ -59,40 +59,16 @@ export default class DiscordRPC { const self = this; ipcMain.on("discordrpc:updateImage", async (_event, imageurl) => { if (!this._utils.getStoreValue("general.privateEnabled")) { - let b64data = ""; - let postbody = ""; - if (imageurl.startsWith("/ciderlocalart")) { - let port = await this._utils.getWindow().webContents.executeJavaScript(`app.clientPort`); - console.log("http://localhost:" + port + imageurl); - const response = await fetch("http://localhost:" + port + imageurl); - b64data = (await response.buffer()).toString("base64"); - postbody = JSON.stringify({ data: b64data }); - fetch("https://api.cider.sh/v1/images", { + fetch("https://api-test.cider.sh/v1/images", { method: "POST", - body: postbody, headers: { - "Content-Type": "application/json", "User-Agent": this._utils.getWindow().webContents.getUserAgent(), + "url": imageurl }, }) .then((res) => res.json()) .then(function (json) { - self._attributes["artwork"]["url"] = json.url; - self.setActivity(self._attributes); - }); - } else { - postbody = JSON.stringify({ url: imageurl }); - fetch("https://api.cider.sh/v1/images", { - method: "POST", - body: postbody, - headers: { - "Content-Type": "application/json", - "User-Agent": this._utils.getWindow().webContents.getUserAgent(), - }, - }) - .then((res) => res.json()) - .then(function (json) { - self._attributes["artwork"]["url"] = json.url; + self._attributes["artwork"]["url"] = json.imageUrl; self.setActivity(self._attributes); }); }