Merge branch 'develop' of https://github.com/ciderapp/Cider into develop

This commit is contained in:
Core 2022-02-17 03:02:25 +00:00
commit bd3a2b6172
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
5 changed files with 48 additions and 66 deletions

View file

@ -88,7 +88,7 @@ export class BrowserWindow {
y: undefined,
minWidth: 900,
minHeight: 390,
frame: false,
frame: (process.platform === "linux"),
title: "Cider",
vibrancy: "fullscreen-ui",
transparent: process.platform === "darwin",
@ -130,6 +130,7 @@ export class BrowserWindow {
this.startWebServer();
BrowserWindow.win = new bw(this.options);
BrowserWindow.win.setMenuBarVisibility(false)
const ws = new wsapi(BrowserWindow.win)
ws.InitWebSockets()
// and load the renderer.

View file

@ -9,7 +9,6 @@ export class Store {
"close_button_hide": false,
"open_on_startup": false,
"discord_rpc": 1, // 0 = disabled, 1 = enabled as Cider, 2 = enabled as Apple Music
"discord_rpc_clear_on_pause": true,
"language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future
"playbackNotifications": true,
"update_branch": "main"

View file

@ -8,8 +8,8 @@ export default class DiscordRichPresence {
* Private variables for interaction in plugins
*/
private static _store: any;
private _app : any;
private _attributes : any;
private _app: any;
private _attributes: any;
private static _connection: boolean = false;
/**
@ -124,7 +124,7 @@ export default class DiscordRichPresence {
delete activity.largeImageText
}
activity.buttons.forEach((key: {label: string, url: string}, _v: Number) => {
activity.buttons.forEach((key: { label: string, url: string }, _v: Number) => {
if (key.url.includes('undefined') || key.url.includes('no-id-found')) {
activity.buttons.splice(key, 1);
}
@ -162,23 +162,9 @@ export default class DiscordRichPresence {
// Check if its pausing (false) or playing (true)
if (!attributes.status) {
if (DiscordRichPresence._store.general.discord_rpc_clear_on_pause) {
this._client.clearActivity()
.catch((e: any) => console.error(`[DiscordRichPresence][clearActivity] ${e}`));
} else {
this._activity.smallImageKey = 'pause';
this._activity.smallImageText = 'Paused';
delete this._activity.endTimestamp;
delete this._activity.startTimestamp;
this._client.setActivity(this._activity)
.catch((e: any) => console.error(`[DiscordRichPresence][setActivity] ${e}`));
}
} else if (this._activity && this._activityCache !== this._activity && this._activity.details) {
if (!DiscordRichPresence._store.general.discord_rpc_clear_on_pause) {
this._activity.smallImageKey = 'play';
this._activity.smallImageText = 'Playing';
}
this._client.setActivity(this._activity)
.catch((e: any) => console.error(`[DiscordRichPresence][updateActivity] ${e}`));
this._activityCache = this._activity;
@ -207,17 +193,17 @@ export default class DiscordRichPresence {
this.connect((DiscordRichPresence._store.general.discord_rpc == 1) ? '911790844204437504' : '886578863147192350');
console.debug(`[Plugin][${this.name}] Ready.`);
ipcMain.on('updateRPCImage', (_event, imageurl) => {
fetch('https://api.cider.sh/v1/images' ,{
fetch('https://api.cider.sh/v1/images', {
method: 'POST',
body: JSON.stringify({url : imageurl}),
body: JSON.stringify({url: imageurl}),
headers: {
'Content-Type': 'application/json',
'User-Agent': _win.webContents.getUserAgent()
},
})
.then(res => res.json())
.then(function(json){
.then(function (json) {
self._attributes["artwork"]["url"] = json.url
self.updateActivity(self._attributes)
})

View file

@ -3134,6 +3134,10 @@ body[platform='darwin'] {
}
}
body[platform='linux'] #window-controls-container {
display: none;
}
.percent {
display: inline-block;
position: relative;

View file

@ -568,14 +568,6 @@
</select>
</div>
</div>
<div class="md-option-line" v-show="app.cfg.general.discord_rpc != 0">
<div class="md-option-segment">
{{$root.getLz('settings.option.connectivity.discordRPC.clearOnPause')}}
</div>
<div class="md-option-segment md-option-segment_auto">
<input type="checkbox" v-model="app.cfg.general.discord_rpc_clear_on_pause" switch/>
</div>
</div>
<div class="md-option-line">
<div class="md-option-segment">
{{$root.getLz('settings.option.connectivity.lastfmScrobble')}}