#582 Attempted Fix
This commit is contained in:
parent
c874d09f8e
commit
3746ed0817
2 changed files with 40 additions and 23 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -146,6 +146,9 @@ dist
|
||||||
!.yarn/sdks
|
!.yarn/sdks
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
|
|
||||||
|
# pnpm
|
||||||
|
pnpm-lock.yaml
|
||||||
|
|
||||||
## JetBrains GitIgnore ##
|
## JetBrains GitIgnore ##
|
||||||
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
|
|
@ -308,9 +308,11 @@ export class BrowserWindow {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "win32":
|
case "win32":
|
||||||
if (!(utils.getStoreValue('visual.transparent') ?? false)){
|
if (!(utils.getStoreValue('visual.transparent') ?? false)) {
|
||||||
this.options.backgroundColor = "#1E1E1E";} else {
|
this.options.backgroundColor = "#1E1E1E";
|
||||||
this.options.transparent = true;}
|
} else {
|
||||||
|
this.options.transparent = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "linux":
|
case "linux":
|
||||||
this.options.backgroundColor = "#1E1E1E";
|
this.options.backgroundColor = "#1E1E1E";
|
||||||
|
@ -450,7 +452,7 @@ export class BrowserWindow {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/themes/:theme/*", (req: {params: {theme: string, 0: string}}, res) => {
|
app.get("/themes/:theme/*", (req: { params: { theme: string, 0: string } }, res) => {
|
||||||
const theme = req.params.theme;
|
const theme = req.params.theme;
|
||||||
const file = req.params[0];
|
const file = req.params[0];
|
||||||
const themePath = join(utils.getPath('srcPath'), "./renderer/themes/", theme);
|
const themePath = join(utils.getPath('srcPath'), "./renderer/themes/", theme);
|
||||||
|
@ -464,9 +466,9 @@ export class BrowserWindow {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/plugins/:plugin/*", (req: {params: {plugin: string, 0: string}}, res) => {
|
app.get("/plugins/:plugin/*", (req: { params: { plugin: string, 0: string } }, res) => {
|
||||||
let plugin = req.params.plugin;
|
let plugin = req.params.plugin;
|
||||||
if(Plugins.getPluginFromMap(plugin)) {
|
if (Plugins.getPluginFromMap(plugin)) {
|
||||||
plugin = Plugins.getPluginFromMap(plugin)
|
plugin = Plugins.getPluginFromMap(plugin)
|
||||||
}
|
}
|
||||||
const file = req.params[0];
|
const file = req.params[0];
|
||||||
|
@ -597,11 +599,11 @@ export class BrowserWindow {
|
||||||
****************************************************************************************************************** */
|
****************************************************************************************************************** */
|
||||||
|
|
||||||
ipcMain.on("get-wallpaper", async (event) => {
|
ipcMain.on("get-wallpaper", async (event) => {
|
||||||
const wpPath:string = await wallpaper.get();
|
const wpPath: string = await wallpaper.get();
|
||||||
// get the wallpaper and encode it to base64 then return
|
// get the wallpaper and encode it to base64 then return
|
||||||
const wpBase64:string = await readFileSync(wpPath, 'base64')
|
const wpBase64: string = await readFileSync(wpPath, 'base64')
|
||||||
// add the data:image properties
|
// add the data:image properties
|
||||||
const wpData:string = `data:image/png;base64,${wpBase64}`
|
const wpData: string = `data:image/png;base64,${wpBase64}`
|
||||||
event.returnValue = wpData;
|
event.returnValue = wpData;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -609,11 +611,11 @@ export class BrowserWindow {
|
||||||
event.returnValue = process.platform;
|
event.returnValue = process.platform;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("reinstall-widevine-cdm", ()=>{
|
ipcMain.handle("reinstall-widevine-cdm", () => {
|
||||||
// remove WidevineCDM from appdata folder
|
// remove WidevineCDM from appdata folder
|
||||||
const widevineCdmPath = join(app.getPath("userData"), "./WidevineCdm");
|
const widevineCdmPath = join(app.getPath("userData"), "./WidevineCdm");
|
||||||
if(existsSync(widevineCdmPath)) {
|
if (existsSync(widevineCdmPath)) {
|
||||||
rmSync(widevineCdmPath, { recursive: true, force: true })
|
rmSync(widevineCdmPath, {recursive: true, force: true})
|
||||||
}
|
}
|
||||||
// reinstall WidevineCDM
|
// reinstall WidevineCDM
|
||||||
app.relaunch()
|
app.relaunch()
|
||||||
|
@ -771,7 +773,7 @@ export class BrowserWindow {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("open-path", async (event, path) => {
|
ipcMain.handle("open-path", async (event, path) => {
|
||||||
switch(path) {
|
switch (path) {
|
||||||
default:
|
default:
|
||||||
case "plugins":
|
case "plugins":
|
||||||
shell.openPath(utils.getPath("plugins"));
|
shell.openPath(utils.getPath("plugins"));
|
||||||
|
@ -888,9 +890,20 @@ export class BrowserWindow {
|
||||||
BrowserWindow.win.webContents.openDevTools({mode: 'detach'});
|
BrowserWindow.win.webContents.openDevTools({mode: 'detach'});
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('relaunchApp',(_event, _) => {
|
ipcMain.handle('relaunchApp', (_event, _) => {
|
||||||
app.relaunch()
|
const opt: Electron.RelaunchOptions = {};
|
||||||
app.exit()
|
opt.args = process.argv.slice(1).concat(['--relaunch']);
|
||||||
|
opt.execPath = process.execPath;
|
||||||
|
if (app.isPackaged && process.env.PORTABLE_EXECUTABLE_FILE != undefined) {
|
||||||
|
opt.execPath = process.env.PORTABLE_EXECUTABLE_FILE;
|
||||||
|
} else if (app.isPackaged && process.env.APPIMAGE != undefined) {
|
||||||
|
opt.execPath = process.env.APPIMAGE;
|
||||||
|
opt.args.unshift('--appimage-extract-and-run');
|
||||||
|
} else if (app.isPackaged && process.env.CHROME_DESKTOP != undefined && process.env.PLATFORM == "Linux") {
|
||||||
|
opt.execPath = `gtk-launch cider`;
|
||||||
|
}
|
||||||
|
app.relaunch(opt);
|
||||||
|
app.quit();
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('before-quit', () => {
|
app.on('before-quit', () => {
|
||||||
|
@ -1030,7 +1043,7 @@ export class BrowserWindow {
|
||||||
ipcMain.on('get-remote-pair-url', (_event, _) => {
|
ipcMain.on('get-remote-pair-url', (_event, _) => {
|
||||||
let url = `http://${BrowserWindow.getIP()}:${this.remotePort}`;
|
let url = `http://${BrowserWindow.getIP()}:${this.remotePort}`;
|
||||||
//if (app.isPackaged) {
|
//if (app.isPackaged) {
|
||||||
BrowserWindow.win.webContents.send('send-remote-pair-url', (`https://cider.sh/pair-remote?url=${Buffer.from(encodeURI(url)).toString('base64')}`).toString());
|
BrowserWindow.win.webContents.send('send-remote-pair-url', (`https://cider.sh/pair-remote?url=${Buffer.from(encodeURI(url)).toString('base64')}`).toString());
|
||||||
//} else {
|
//} 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());
|
// 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());
|
||||||
//}
|
//}
|
||||||
|
@ -1067,7 +1080,6 @@ export class BrowserWindow {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ipcMain.on('share-menu', async (_event, url) => {
|
ipcMain.on('share-menu', async (_event, url) => {
|
||||||
if (process.platform != 'darwin') return;
|
if (process.platform != 'darwin') return;
|
||||||
//https://www.electronjs.org/docs/latest/api/share-menu
|
//https://www.electronjs.org/docs/latest/api/share-menu
|
||||||
|
@ -1144,7 +1156,7 @@ export class BrowserWindow {
|
||||||
isQuiting = true
|
isQuiting = true
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('activate', function(){
|
app.on('activate', function () {
|
||||||
BrowserWindow.win.show()
|
BrowserWindow.win.show()
|
||||||
BrowserWindow.win.focus()
|
BrowserWindow.win.focus()
|
||||||
});
|
});
|
||||||
|
@ -1193,7 +1205,9 @@ export class BrowserWindow {
|
||||||
(ip2.startsWith('192.168.') && !ip.startsWith('192.168.')) &&
|
(ip2.startsWith('192.168.') && !ip.startsWith('192.168.')) &&
|
||||||
(ip2.startsWith('172.16.') && !ip.startsWith('192.168.') && !ip.startsWith('172.16.')) ||
|
(ip2.startsWith('172.16.') && !ip.startsWith('192.168.') && !ip.startsWith('172.16.')) ||
|
||||||
(ip2.startsWith('10.') && !ip.startsWith('192.168.') && !ip.startsWith('172.16.') && !ip.startsWith('10.'))
|
(ip2.startsWith('10.') && !ip.startsWith('192.168.') && !ip.startsWith('172.16.') && !ip.startsWith('10.'))
|
||||||
){ip = details.address;}
|
) {
|
||||||
|
ip = details.address;
|
||||||
|
}
|
||||||
++alias;
|
++alias;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue