Various updates to backend.

Implementation of MPRIS in TS.
LastFM now interacts with store object passed directly into class.
Experimental decorators enabled and utilised in MPRIS.
This commit is contained in:
Core 2022-01-26 05:13:46 +00:00
parent b4293cf065
commit 27becacbb7
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
10 changed files with 305 additions and 84 deletions

View file

@ -50,7 +50,7 @@ export class AppEvents {
/***********************************************************************************************************************
* Commandline arguments
**********************************************************************************************************************/
switch (store.get("visual.hw_acceleration")) {
switch (store.visual.hw_acceleration) {
default:
case "default":
electron.app.commandLine.appendSwitch('enable-accelerated-mjpeg-decode')
@ -75,6 +75,10 @@ export class AppEvents {
break;
}
if (process.platform === "linux") {
electron.app.commandLine.appendSwitch('disable-features', 'MediaSessionService');
}
/***********************************************************************************************************************
* Protocols
**********************************************************************************************************************/

View file

@ -5,10 +5,11 @@ import * as electron from 'electron'
export default class PluginHandler {
private basePluginsPath = path.join(__dirname, '../plugins');
private userPluginsPath = path.join(electron.app.getPath('userData'), 'plugins');
private pluginsList: any = {};
constructor() {
private readonly pluginsList: any = {};
private readonly _store: any;
constructor(config: any) {
this._store = config;
this.pluginsList = this.getPlugins();
}
@ -23,7 +24,7 @@ export default class PluginHandler {
if (plugins[file] || plugin.name in plugins) {
console.log(`[${plugin.name}] Plugin already loaded / Duplicate Class Name`);
} else {
plugins[file] = new plugin(electron.app);
plugins[file] = new plugin(electron.app, this._store);
}
}
});
@ -38,7 +39,7 @@ export default class PluginHandler {
if (plugins[file] || plugin in plugins) {
console.log(`[${plugin.name}] Plugin already loaded / Duplicate Class Name`);
} else {
plugins[file] = new plugin(electron.app);
plugins[file] = new plugin(electron.app, this._store);
}
}
});

View file

@ -2,7 +2,7 @@ import * as Store from 'electron-store';
import * as electron from "electron";
export class ConfigStore {
public store: Store | undefined;
private _store: Store;
private defaults: any = {
"general": {
@ -96,14 +96,26 @@ export class ConfigStore {
private migrations: any = {}
constructor() {
this.store = new Store({
this._store = new Store({
name: 'cider-config',
defaults: this.defaults,
migrations: this.migrations,
});
this.store.set(this.mergeStore(this.defaults, this.store.store))
this.ipcHandler(this.store);
this._store.set(this.mergeStore(this.defaults, this._store.store))
this.ipcHandler(this._store);
}
get store() {
return this._store.store;
}
get(key: string) {
return this._store.get(key);
}
set(key: string, value: any) {
this._store.set(key, value);
}
/**

View file

@ -15,10 +15,10 @@ import {wsapi} from "./wsapi";
import * as jsonc from "jsonc";
export class Win {
win: any | undefined = null;
app: any | undefined = null;
store: any | undefined = null;
devMode: boolean = !electron.app.isPackaged;
private win: any | undefined = null;
private app: any | undefined = null;
private store: any | undefined = null;
private devMode: boolean = !electron.app.isPackaged;
constructor(app: electron.App, store: any) {
this.app = app;