diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index ef87242b..1e35caa7 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -657,7 +657,12 @@ export class BrowserWindow { ipcMain.on('get-remote-pair-url', (_event, _) => { let url = `http://${BrowserWindow.getIP()}:${this.remotePort}`; - BrowserWindow.win.webContents.send('send-remote-pair-url', (`https://cider.sh/pair-remote?url=${Buffer.from(encodeURI(url)).toString('base64')}`).toString()); + if (app.isPackaged) { + BrowserWindow.win.webContents.send('send-remote-pair-url', (`https://cider.sh/pair-remote?url=${Buffer.from(encodeURI(url)).toString('base64')}`).toString()); + } else { + BrowserWindow.win.webContents.send('send-remote-pair-url', (`http://127.0.0.1:5500/pair-remote.html?url=${Buffer.from(encodeURI(url)).toString('base64')}`).toString()); + } + }); if (process.platform === "darwin") { app.setUserActivity('com.CiderCollective.remote.pair', { diff --git a/src/renderer/views/pages/webview.ejs b/src/renderer/views/pages/webview.ejs index 2a762499..8c96062f 100644 --- a/src/renderer/views/pages/webview.ejs +++ b/src/renderer/views/pages/webview.ejs @@ -1,5 +1,6 @@ diff --git a/src/web-remote/index.js b/src/web-remote/index.js index 3a8b522b..ed3739d4 100644 --- a/src/web-remote/index.js +++ b/src/web-remote/index.js @@ -55,6 +55,21 @@ var app = new Vue({ // url: "localhost", }, methods: { + isElectron() { + // Renderer process + if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { + return true; + } + // Main process + if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) { + return true; + } + // Detect the user agent when the `nodeIntegration` option is set to true + if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { + return true; + } + return false; + }, searchScroll(e) { this.search.lastY = e.target.scrollTop; }, @@ -429,7 +444,7 @@ var app = new Vue({ '--textColor3': `#${data['artwork']['textColor3'] ?? 'ffffff'}`, '--textColor4': `#${data['artwork']['textColor4'] ?? 'ffffff'}` } - return palette } else { + return palette } else { let u = { '--bgColor': `#${'000000'}`, '--textColor1': `#${ 'ffffff'}`,