Merge branch 'ciderapp:develop' into develop
This commit is contained in:
commit
d8ea209123
8 changed files with 101 additions and 31 deletions
|
@ -109,9 +109,9 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build": {
|
"build": {
|
||||||
"electronVersion": "18.1.0",
|
"electronVersion": "18.2.0",
|
||||||
"electronDownload": {
|
"electronDownload": {
|
||||||
"version": "18.1.0+wvcus",
|
"version": "18.2.0+wvcus",
|
||||||
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
||||||
},
|
},
|
||||||
"appId": "cider",
|
"appId": "cider",
|
||||||
|
|
|
@ -212,7 +212,6 @@ export class AppEvents {
|
||||||
* Handles the creation of a new instance of the app
|
* Handles the creation of a new instance of the app
|
||||||
*/
|
*/
|
||||||
private InstanceHandler() {
|
private InstanceHandler() {
|
||||||
|
|
||||||
// Detects of an existing instance is running (So if the lock has been achieved, no existing instance has been found)
|
// Detects of an existing instance is running (So if the lock has been achieved, no existing instance has been found)
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
const gotTheLock = app.requestSingleInstanceLock()
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ export class BrowserWindow {
|
||||||
platform: process.platform,
|
platform: process.platform,
|
||||||
dev: app.isPackaged,
|
dev: app.isPackaged,
|
||||||
osRelease: os.release(),
|
osRelease: os.release(),
|
||||||
|
updatable: !process.windowsStore || !process.mas,
|
||||||
components: [
|
components: [
|
||||||
"pages/podcasts",
|
"pages/podcasts",
|
||||||
"pages/apple-account-settings",
|
"pages/apple-account-settings",
|
||||||
|
@ -1214,16 +1215,27 @@ export class BrowserWindow {
|
||||||
shell.openPath(app.getPath('userData'));
|
shell.openPath(app.getPath('userData'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//#region Cider Connect
|
||||||
ipcMain.on('cc-auth', (_event) => {
|
ipcMain.on('cc-auth', (_event) => {
|
||||||
shell.openExternal(String(utils.getStoreValue('cc_authURL')));
|
shell.openExternal(String(utils.getStoreValue('cc_authURL')));
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('cc-logout', (_event) => {
|
ipcMain.on('cc-logout', (_event) => { //Make sure to update the default store
|
||||||
utils.setStoreValue('connectUser', {
|
utils.setStoreValue('connectUser', {
|
||||||
auth: null
|
"auth": null,
|
||||||
|
"sync": {
|
||||||
|
themes: false,
|
||||||
|
plugins: false,
|
||||||
|
settings: false,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
utils.getWindow().reload();
|
utils.getWindow().reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on('cc-push', (_event) => {
|
||||||
|
utils.pushStoreToConnect();
|
||||||
|
})
|
||||||
/* *********************************************************************************************
|
/* *********************************************************************************************
|
||||||
* Window Events
|
* Window Events
|
||||||
* **********************************************************************************************/
|
* **********************************************************************************************/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as ElectronStore from 'electron-store';
|
import * as ElectronStore from 'electron-store';
|
||||||
import * as electron from "electron";
|
import * as electron from "electron";
|
||||||
import {app} from "electron";
|
import {app} from "electron";
|
||||||
|
import fetch from "electron-fetch";
|
||||||
export class Store {
|
export class Store {
|
||||||
static cfg: ElectronStore;
|
static cfg: ElectronStore;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export class Store {
|
||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"close_button_hide": false,
|
"close_button_hide": false,
|
||||||
"discord_rpc": {
|
"discordrpc": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"client": "Cider",
|
"client": "Cider",
|
||||||
"clear_on_pause": true,
|
"clear_on_pause": true,
|
||||||
|
@ -212,17 +212,22 @@ export class Store {
|
||||||
},
|
},
|
||||||
"connectUser": {
|
"connectUser": {
|
||||||
"auth": null,
|
"auth": null,
|
||||||
|
"sync": {
|
||||||
|
themes: false,
|
||||||
|
plugins: false,
|
||||||
|
settings: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
private migrations: any = {
|
private migrations: any = {
|
||||||
'>=1.4.3': (store: ElectronStore) => {
|
'>=1.4.3': (store: ElectronStore) => {
|
||||||
if (typeof store.get('general.discord_rpc') == 'number' || typeof store.get('general.discord_rpc') == 'string') {
|
if (typeof store.get('general.discordrpc') == 'number' || typeof store.get('general.discordrpc') == 'string') {
|
||||||
store.delete('general.discord_rpc');
|
store.delete('general.discordrpc');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
private schema: ElectronStore.Schema<any> = {
|
private schema: ElectronStore.Schema<any> = {
|
||||||
"general.discord_rpc": {
|
"general.discordrpc": {
|
||||||
type: 'object'
|
type: 'object'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -261,6 +266,7 @@ export class Store {
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IPC Handler
|
* IPC Handler
|
||||||
*/
|
*/
|
||||||
|
@ -281,5 +287,43 @@ export class Store {
|
||||||
Store.cfg.store = store
|
Store.cfg.store = store
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static pushToCloud(): void {
|
||||||
|
if (Store.cfg.get('connectUser.auth') === null) return;
|
||||||
|
var syncData = Object();
|
||||||
|
if (Store.cfg.get('connectUser.sync.themes')) {
|
||||||
|
syncData.push({
|
||||||
|
themes: Store.cfg.store.themes
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (Store.cfg.get('connectUser.sync.plugins')) {
|
||||||
|
syncData.push({
|
||||||
|
plugins: Store.cfg.store.plugins
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Store.cfg.get('connectUser.sync.settings')) {
|
||||||
|
syncData.push({
|
||||||
|
general: Store.cfg.get('general'),
|
||||||
|
home: Store.cfg.get('home'),
|
||||||
|
libraryPrefs: Store.cfg.get('libraryPrefs'),
|
||||||
|
advanced: Store.cfg.get('advanced'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let postBody = {
|
||||||
|
id: Store.cfg.get('connectUser.id'),
|
||||||
|
app: electron.app.getName(),
|
||||||
|
version: electron.app.isPackaged ? electron.app.getVersion() : 'dev',
|
||||||
|
syncData: syncData
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch('https://connect.cidercollective.dev/api/v1/setttings/set', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(postBody)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ export class utils {
|
||||||
return Store.cfg.store
|
return Store.cfg.store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the store instance
|
* Get the store instance
|
||||||
* @returns {Store}
|
* @returns {Store}
|
||||||
|
@ -97,6 +98,18 @@ export class utils {
|
||||||
Store.cfg.set(key, value)
|
Store.cfg.set(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes Store to Connect
|
||||||
|
* @return Function
|
||||||
|
*/
|
||||||
|
static pushStoreToConnect(): Function {
|
||||||
|
return Store.pushToCloud
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the browser window
|
* Gets the browser window
|
||||||
*/
|
*/
|
||||||
|
@ -198,4 +211,6 @@ export class utils {
|
||||||
autoUpdater.logger = log
|
autoUpdater.logger = log
|
||||||
await autoUpdater.checkForUpdatesAndNotify()
|
await autoUpdater.checkForUpdatesAndNotify()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,10 @@ export default class DiscordRPC {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private connect() {
|
private connect() {
|
||||||
if (!this._utils.getStoreValue("general.discord_rpc.enabled")) {
|
if (!this._utils.getStoreValue("general.discordrpc.enabled")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const clientId = this._utils.getStoreValue("general.discord_rpc.client") === "Cider" ? '911790844204437504' : '886578863147192350';
|
const clientId = this._utils.getStoreValue("general.discordrpc.client") === "Cider" ? '911790844204437504' : '886578863147192350';
|
||||||
|
|
||||||
// Apparently needed for ask to join, join, spectate etc.
|
// Apparently needed for ask to join, join, spectate etc.
|
||||||
RPC.register(clientId)
|
RPC.register(clientId)
|
||||||
|
@ -187,7 +187,7 @@ export default class DiscordRPC {
|
||||||
activity = DiscordRPC.filterActivity(activity, this._attributes)
|
activity = DiscordRPC.filterActivity(activity, this._attributes)
|
||||||
|
|
||||||
// Set the activity
|
// Set the activity
|
||||||
if (!this._attributes.status && this._utils.getStoreValue("general.discord_rpc.clear_on_pause")) {
|
if (!this._attributes.status && this._utils.getStoreValue("general.discordrpc.clear_on_pause")) {
|
||||||
this._client.clearActivity()
|
this._client.clearActivity()
|
||||||
} else if (this._activity && this._activityCache !== this._activity && this._activity.details) {
|
} else if (this._activity && this._activityCache !== this._activity && this._activity.details) {
|
||||||
this._client.setActivity(activity)
|
this._client.setActivity(activity)
|
||||||
|
@ -200,7 +200,7 @@ export default class DiscordRPC {
|
||||||
* @param {object} attributes
|
* @param {object} attributes
|
||||||
*/
|
*/
|
||||||
private updateActivity(attributes: any) {
|
private updateActivity(attributes: any) {
|
||||||
if (!this._utils.getStoreValue("general.discord_rpc.enabled") || this._utils.getStoreValue("general.privateEnabled")) {
|
if (!this._utils.getStoreValue("general.discordrpc.enabled") || this._utils.getStoreValue("general.privateEnabled")) {
|
||||||
return
|
return
|
||||||
} else if (!this._client || !this._connection) {
|
} else if (!this._client || !this._connection) {
|
||||||
this.connect()
|
this.connect()
|
||||||
|
@ -208,15 +208,15 @@ export default class DiscordRPC {
|
||||||
|
|
||||||
// Check if show buttons is (true) or (false)
|
// Check if show buttons is (true) or (false)
|
||||||
this._activity = {
|
this._activity = {
|
||||||
details: this._utils.getStoreValue("general.discord_rpc.details_format"),
|
details: this._utils.getStoreValue("general.discordrpc.details_format"),
|
||||||
state: this._utils.getStoreValue("general.discord_rpc.state_format"),
|
state: this._utils.getStoreValue("general.discordrpc.state_format"),
|
||||||
largeImageKey: attributes?.artwork?.url?.replace('{w}', '1024').replace('{h}', '1024'),
|
largeImageKey: attributes?.artwork?.url?.replace('{w}', '1024').replace('{h}', '1024'),
|
||||||
largeImageText: attributes.albumName,
|
largeImageText: attributes.albumName,
|
||||||
instance: false // Whether the activity is in a game session
|
instance: false // Whether the activity is in a game session
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the buttons if people want them
|
// Add the buttons if people want them
|
||||||
if (!this._utils.getStoreValue("general.discord_rpc.hide_buttons")) {
|
if (!this._utils.getStoreValue("general.discordrpc.hide_buttons")) {
|
||||||
this._activity.buttons = [
|
this._activity.buttons = [
|
||||||
{label: 'Listen on Cider', url: attributes.url.cider},
|
{label: 'Listen on Cider', url: attributes.url.cider},
|
||||||
{label: 'View on Apple Music', url: attributes.url.appleMusic}
|
{label: 'View on Apple Music', url: attributes.url.appleMusic}
|
||||||
|
@ -230,7 +230,7 @@ export default class DiscordRPC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user wants to keep the activity when paused
|
// If the user wants to keep the activity when paused
|
||||||
if (!this._utils.getStoreValue("general.discord_rpc.clear_on_pause")) {
|
if (!this._utils.getStoreValue("general.discordrpc.clear_on_pause")) {
|
||||||
this._activity.smallImageKey = attributes.status ? 'play' : 'pause';
|
this._activity.smallImageKey = attributes.status ? 'play' : 'pause';
|
||||||
this._activity.smallImageText = attributes.status ? 'Playing' : 'Paused';
|
this._activity.smallImageText = attributes.status ? 'Playing' : 'Paused';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1013,18 +1013,18 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="app.cfg.general.discord_rpc.enabled" switch/>
|
<input type="checkbox" v-model="app.cfg.general.discordrpc.enabled" switch/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc.enabled != false">
|
<div class="md-option-line" v-show="app.cfg.general.discordrpc.enabled != false">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.connectivity.discordRPC.clientName')}}
|
{{$root.getLz('settings.option.connectivity.discordRPC.clientName')}}
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<select class="md-select" v-model="app.cfg.general.discord_rpc.client">
|
<select class="md-select" v-model="app.cfg.general.discordrpc.client">
|
||||||
<option value="Cider">{{$root.getLz('app.name')}}</option>
|
<option value="Cider">{{$root.getLz('app.name')}}</option>
|
||||||
<option value="AppleMusic">{{$root.getLz('term.appleMusic')}}
|
<option value="AppleMusic">{{$root.getLz('term.appleMusic')}}
|
||||||
</option>
|
</option>
|
||||||
|
@ -1033,29 +1033,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc.enabled != false">
|
<div class="md-option-line" v-show="app.cfg.general.discordrpc.enabled != false">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.connectivity.discordRPC.clearOnPause')}}
|
{{$root.getLz('settings.option.connectivity.discordRPC.clearOnPause')}}
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="app.cfg.general.discord_rpc.clear_on_pause" switch/>
|
<input type="checkbox" v-model="app.cfg.general.discordrpc.clear_on_pause" switch/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc.enabled != false">
|
<div class="md-option-line" v-show="app.cfg.general.discordrpc.enabled != false">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.connectivity.discordRPC.hideButtons')}}
|
{{$root.getLz('settings.option.connectivity.discordRPC.hideButtons')}}
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="app.cfg.general.discord_rpc.hide_buttons" switch/>
|
<input type="checkbox" v-model="app.cfg.general.discordrpc.hide_buttons" switch/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc.enabled != false">
|
<div class="md-option-line" v-show="app.cfg.general.discordrpc.enabled != false">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.connectivity.discordRPC.detailsFormat')}}<br/>
|
{{$root.getLz('settings.option.connectivity.discordRPC.detailsFormat')}}<br/>
|
||||||
<small>{{$root.getLz('term.variables')}}: {artist}, {composer}, {title}, {album},
|
<small>{{$root.getLz('term.variables')}}: {artist}, {composer}, {title}, {album},
|
||||||
|
@ -1063,12 +1063,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<input type="text" v-model="app.cfg.general.discord_rpc.details_format"/>
|
<input type="text" v-model="app.cfg.general.discordrpc.details_format"/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc.enabled != false">
|
<div class="md-option-line" v-show="app.cfg.general.discordrpc.enabled != false">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.connectivity.discordRPC.stateFormat')}}
|
{{$root.getLz('settings.option.connectivity.discordRPC.stateFormat')}}
|
||||||
<small>{{$root.getLz('term.variables')}}: {artist}, {composer}, {title}, {album},
|
<small>{{$root.getLz('term.variables')}}: {artist}, {composer}, {title}, {album},
|
||||||
|
@ -1076,7 +1076,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-segment md-option-segment_auto">
|
<div class="md-option-segment md-option-segment_auto">
|
||||||
<label>
|
<label>
|
||||||
<input type="text" v-model="app.cfg.general.discord_rpc.state_format"/>
|
<input type="text" v-model="app.cfg.general.discordrpc.state_format"/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"electronVersion": "18.0.4",
|
"electronVersion": "18.2.0",
|
||||||
"electronDownload": {
|
"electronDownload": {
|
||||||
"version": "18.0.4+wvcus",
|
"version": "18.2.0+wvcus",
|
||||||
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
"mirror": "https://github.com/castlabs/electron-releases/releases/download/v"
|
||||||
},
|
},
|
||||||
"appId": "cider",
|
"appId": "cider",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue