sometest
This commit is contained in:
parent
46eb120973
commit
cabc36fc7f
3 changed files with 44 additions and 15 deletions
|
@ -52,12 +52,22 @@ export default class DiscordRPC {
|
||||||
const self = this
|
const self = this
|
||||||
this.connect();
|
this.connect();
|
||||||
console.debug(`[Plugin][${this.name}] Ready.`);
|
console.debug(`[Plugin][${this.name}] Ready.`);
|
||||||
ipcMain.on('updateRPCImage', (_event, imageurl) => {
|
ipcMain.on('updateRPCImage', async (_event, imageurl) => {
|
||||||
if (!this._utils.getStoreValue("general.privateEnabled")) {
|
if (!this._utils.getStoreValue("general.privateEnabled")) {
|
||||||
fetch('https://api.cider.sh/v1/images', {
|
let b64data = ""
|
||||||
|
let postbody = ""
|
||||||
|
if (imageurl.startsWith("/ciderlocalart")){
|
||||||
|
let port = await _win.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://cider-api-development.up.railway.app/v1/images', {
|
||||||
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({url: imageurl}),
|
body: postbody,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'User-Agent': _win.webContents.getUserAgent()
|
'User-Agent': _win.webContents.getUserAgent()
|
||||||
|
@ -68,6 +78,24 @@ export default class DiscordRPC {
|
||||||
self._attributes["artwork"]["url"] = json.url
|
self._attributes["artwork"]["url"] = json.url
|
||||||
self.setActivity(self._attributes)
|
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': _win.webContents.getUserAgent()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(function (json) {
|
||||||
|
self._attributes["artwork"]["url"] = json.url
|
||||||
|
self.setActivity(self._attributes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ipcMain.on("reloadRPC", () => {
|
ipcMain.on("reloadRPC", () => {
|
||||||
|
|
|
@ -12,6 +12,7 @@ const app = new Vue({
|
||||||
ipcRenderer: ipcRenderer,
|
ipcRenderer: ipcRenderer,
|
||||||
cfg: ipcRenderer.sendSync("getStore"),
|
cfg: ipcRenderer.sendSync("getStore"),
|
||||||
isDev: ipcRenderer.sendSync("is-dev"),
|
isDev: ipcRenderer.sendSync("is-dev"),
|
||||||
|
clientPort: ipcRenderer.sendSync("get-port"),
|
||||||
drawertest: false,
|
drawertest: false,
|
||||||
platform: "",
|
platform: "",
|
||||||
mk: {},
|
mk: {},
|
||||||
|
|
|
@ -14045,7 +14045,7 @@ input[type=checkbox][switch]:checked:active::before {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 100px;
|
float: right;
|
||||||
}
|
}
|
||||||
.artist-page .artist-header .animated {
|
.artist-page .artist-header .animated {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -16444,7 +16444,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 100px;
|
float: right;
|
||||||
}
|
}
|
||||||
.about-page .teamBtn {
|
.about-page .teamBtn {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue