Private implemented

This commit is contained in:
Core 2022-06-16 14:33:24 +01:00
parent 4defeb82f0
commit 23ad2640dc
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
2 changed files with 30 additions and 34 deletions

View file

@ -1,18 +1,19 @@
require('v8-compile-cache');
const {app, components, ipcMain} = require('electron');
import {join} from 'path';
require("v8-compile-cache");
import {join} from "path";
import {app} from "electron"
if (!app.isPackaged) {
app.setPath('userData', join(app.getPath('appData'), 'Cider'));
app.setPath("userData", join(app.getPath("appData"), "Cider"));
}
import {Store} from "./base/store";
import {AppEvents} from "./base/app";
import {Plugins} from "./base/plugins";
import {BrowserWindow} from "./base/browserwindow";
import {init as Sentry} from '@sentry/electron';
import {init as Sentry} from "@sentry/electron";
import {RewriteFrames} from "@sentry/integrations";
import {components, ipcMain} from "electron"
// Analytics for debugging fun yeah.
Sentry({
@ -32,13 +33,13 @@ const CiderPlug = new Plugins();
* App Event Handlers
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
app.on('ready', () => {
app.on("ready", () => {
Cider.ready(CiderPlug);
console.log('[Cider] Application is Ready. Creating Window.')
console.log("[Cider] Application is Ready. Creating Window.")
if (!app.isPackaged) {
console.info('[Cider] Running in development mode.')
require('vue-devtools').install()
console.info("[Cider] Running in development mode.")
require("vue-devtools").install()
}
components.whenReady().then(async () => {
@ -49,11 +50,11 @@ app.on('ready', () => {
console.log(gpuInfo)
})
console.log('[Cider][Widevine] Status:', components.status());
console.log("[Cider][Widevine] Status:", components.status());
Cider.bwCreated();
win.on("ready-to-show", () => {
console.debug('[Cider] Window is Ready.')
CiderPlug.callPlugins('onReady', win);
console.debug("[Cider] Window is Ready.")
CiderPlug.callPlugins("onReady", win);
win.show();
});
});
@ -68,20 +69,20 @@ ipcMain.handle("renderer-ready", (event) => {
CiderPlug.callPlugins("onRendererReady", event);
})
ipcMain.on('playbackStateDidChange', (_event, attributes) => {
CiderPlug.callPlugins('onPlaybackStateDidChange', attributes);
ipcMain.on("playbackStateDidChange", (_event, attributes) => {
CiderPlug.callPlugins("onPlaybackStateDidChange", attributes);
});
ipcMain.on('nowPlayingItemDidChange', (_event, attributes) => {
CiderPlug.callPlugins('onNowPlayingItemDidChange', attributes);
ipcMain.on("nowPlayingItemDidChange", (_event, attributes) => {
CiderPlug.callPlugins("onNowPlayingItemDidChange", attributes);
});
ipcMain.on('nowPlayingItemDidChangeLastFM', (_event, attributes) => {
CiderPlug.callPlugin('lastfm.js', 'nowPlayingItemDidChangeLastFM', attributes);
ipcMain.on("nowPlayingItemDidChangeLastFM", (_event, attributes) => {
CiderPlug.callPlugin("lastfm.js", "nowPlayingItemDidChangeLastFM", attributes);
})
app.on('before-quit', () => {
CiderPlug.callPlugins('onBeforeQuit');
app.on("before-quit", () => {
CiderPlug.callPlugins("onBeforeQuit");
console.warn(`${app.getName()} exited.`);
});
@ -90,21 +91,21 @@ app.on('before-quit', () => {
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// @ts-ignore
app.on('widevine-ready', (version, lastVersion) => {
app.on("widevine-ready", (version, lastVersion) => {
if (null !== lastVersion) {
console.log('[Cider][Widevine] Widevine ' + version + ', upgraded from ' + lastVersion + ', is ready to be used!')
console.log("[Cider][Widevine] Widevine " + version + ", upgraded from " + lastVersion + ", is ready to be used!")
} else {
console.log('[Cider][Widevine] Widevine ' + version + ' is ready to be used!')
console.log("[Cider][Widevine] Widevine " + version + " is ready to be used!")
}
})
// @ts-ignore
app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
console.log('[Cider][Widevine] Widevine ' + currentVersion + ' is ready to be upgraded to ' + pendingVersion + '!')
app.on("widevine-update-pending", (currentVersion, pendingVersion) => {
console.log("[Cider][Widevine] Widevine " + currentVersion + " is ready to be upgraded to " + pendingVersion + "!")
})
// @ts-ignore
app.on('widevine-error', (error) => {
console.log('[Cider][Widevine] Widevine installation encountered an error: ' + error)
app.on("widevine-error", (error) => {
console.log("[Cider][Widevine] Widevine installation encountered an error: " + error)
app.exit()
})

View file

@ -1,9 +1,3 @@
// https://github.com/maxkueng/node-lastfmapi
// https://github.com/maxkueng/lastfm-autocorrect
// @todo: add autocorrect
// @todo: add scrobble and filter to prevent no-title-found being scrobbled
// @todo: handle session keys through config to stop aids session.json
export default class lastfm {
/**
@ -74,6 +68,7 @@ export default class lastfm {
* @param attributes Music Attributes
*/
onNowPlayingItemDidChange(attributes: any): void {
if (this._utils.getStoreValue("general.privateEnabled")) return;
this._attributes = attributes
if (!attributes?.lfmTrack || !attributes?.lfmAlbum) {
this.verifyTrack(attributes)