minor fixes for electron/index.js

This commit is contained in:
btzr-io 2021-07-30 17:37:01 -05:00
parent 3f3be5feb0
commit f87a212b32
2 changed files with 7 additions and 10 deletions

View file

@ -45,13 +45,12 @@ let daemon;
let lbryFirst; let lbryFirst;
const appState = {}; const appState = {};
const PROTOCOL = 'lbry';
const PROTOCOL = 'lbry'
if (isDev && process.platform === 'win32') { if (isDev && process.platform === 'win32') {
// Setting this is required to get this working in dev mode. // Setting this is required to get this working in dev mode.
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [ app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
path.resolve(process.argv[1]) path.resolve(process.argv[1]),
]); ]);
} else { } else {
app.setAsDefaultProtocolClient(PROTOCOL); app.setAsDefaultProtocolClient(PROTOCOL);
@ -157,11 +156,11 @@ if (!gotSingleInstanceLock) {
// Send the url to the app to navigate first, then focus // Send the url to the app to navigate first, then focus
if (rendererWindow) { if (rendererWindow) {
// External uri (last item on argv): // External uri (last item on argv):
const EXTERNAL_URI = argv[argv.length ? (argv.length-1) : 0] const EXTERNAL_URI = (argv.length) ? argv[argv.length - 1] : '';
// Handle protocol requests for windows and linux // Handle protocol requests for windows and linux
const platforms = (process.platform === 'win32' || process.platform === 'linux') const platforms = (process.platform === 'win32' || process.platform === 'linux');
// Is LBRY protocol // Is LBRY protocol
const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL) const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL + '://');
// External protocol requested: // External protocol requested:
if (platforms && isProtocolURI) { if (platforms && isProtocolURI) {
let URI = EXTERNAL_URI; let URI = EXTERNAL_URI;
@ -210,7 +209,7 @@ if (!gotSingleInstanceLock) {
if (details.method === 'POST' && details.requestHeaders['Content-Type'] === 'application/json-rpc') { if (details.method === 'POST' && details.requestHeaders['Content-Type'] === 'application/json-rpc') {
delete details.requestHeaders['Origin']; delete details.requestHeaders['Origin'];
} }
callback({ cancel: false, requestHeaders: details.requestHeaders }); callback({ cancel: false, requestHeaders: details.requestHeaders, });
}); });
}); });
} }

View file

@ -2064,12 +2064,10 @@
"Skip Navigation": "Skip Navigation", "Skip Navigation": "Skip Navigation",
"Reset": "Reset", "Reset": "Reset",
"Reset to original (previous) publish date": "Reset to original (previous) publish date", "Reset to original (previous) publish date": "Reset to original (previous) publish date",
"Show reply": "Show reply",
"Show %count% replies": "Show %count% replies",
"Open in Desktop": "Open in Desktop",
"%title% by %channelTitle%": "%title% by %channelTitle%", "%title% by %channelTitle%": "%title% by %channelTitle%",
"%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%", "%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%",
"%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%", "%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%",
"Search for something...": "Search for something...", "Search for something...": "Search for something...",
"Open in Desktop": "Open in Desktop",
"--end--": "--end--" "--end--": "--end--"
} }