diff --git a/package.json b/package.json index 71e9cbc8..944f6bf3 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,8 @@ "extends": null, "files": [ "./build/**/*", - "./resources/icons/icon.*" + "./resources/icons/icon.*", + "./src/**/*" ], "linux": { "target": [ diff --git a/src/main/base/app.ts b/src/main/base/app.ts index 4ca9e187..9e1e54e1 100644 --- a/src/main/base/app.ts +++ b/src/main/base/app.ts @@ -1,4 +1,5 @@ import * as electron from 'electron'; +import * as path from 'path'; export class AppEvents { constructor(store: any) { @@ -14,6 +15,28 @@ export class AppEvents { private static start(store: any): void { console.log('App started'); + /********************************************************************************************************************** + * Startup arguments handling + **********************************************************************************************************************/ + if (electron.app.commandLine.hasSwitch('version') || electron.app.commandLine.hasSwitch('v')) { + console.log(electron.app.getVersion()) + electron.app.exit() + } + + // Verbose Check + if (electron.app.commandLine.hasSwitch('verbose')) { + console.log("[Apple-Music-Electron] User has launched the application with --verbose"); + } + + // Log File Location + if (electron.app.commandLine.hasSwitch('log') || electron.app.commandLine.hasSwitch('l')) { + console.log(path.join(electron.app.getPath('userData'), 'logs')) + electron.app.exit() + } + + /*********************************************************************************************************************** + * Commandline arguments + **********************************************************************************************************************/ switch (store.get("visual.hw_acceleration")) { default: case "default": diff --git a/src/main/base/win.ts b/src/main/base/win.ts index 67013ba4..ff49c3fe 100644 --- a/src/main/base/win.ts +++ b/src/main/base/win.ts @@ -45,18 +45,11 @@ export class Win { frame: false, title: "Cider", vibrancy: 'dark', - // transparent: true, + transparent: (process.platform === "darwin"), hasShadow: false, webPreferences: { - webviewTag: true, - plugins: true, nodeIntegration: true, - nodeIntegrationInWorker: false, - webSecurity: false, - allowRunningInsecureContent: true, - enableRemoteModule: true, sandbox: true, - nativeWindowOpen: true, contextIsolation: false, preload: path.join(this.paths.srcPath, './preload/cider-preload.js') } @@ -133,7 +126,7 @@ export class Win { app.use(express.static(path.join(this.paths.srcPath, './renderer/'))); app.set("views", path.join(this.paths.srcPath, './renderer/views')); app.set("view engine", "ejs"); - + app.use((req, res, next) => { // @ts-ignore if (req.url.includes("audio.webm") || (req.headers.host.includes("localhost") && (this.devMode || req.headers["user-agent"].includes("Electron")))) { diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index c0246916..e3db8bd5 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -1,5 +1,4 @@ -const electron = require('electron') - +global.ipcRenderer = require('electron').ipcRenderer; console.log('Loaded Preload') let cache = {playParams: {id: 0}, status: null, remainingTime: 0}, @@ -91,6 +90,5 @@ const MusicKitInterop = { process.once('loaded', () => { console.log("Setting ipcRenderer") - global.ipcRenderer = electron.ipcRenderer; global.MusicKitInterop = MusicKitInterop; }); \ No newline at end of file