mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
Merge pull request #1149 from lbryio/issue/1119
Repair deep linking and fix daemon quitting on auto update
This commit is contained in:
commit
098a641688
5 changed files with 47 additions and 15 deletions
|
@ -34,6 +34,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||||
* Fix right click bug ([#928](https://github.com/lbryio/lbry-app/pull/928))
|
* Fix right click bug ([#928](https://github.com/lbryio/lbry-app/pull/928))
|
||||||
* Fix Election linting errors ([#929](https://github.com/lbryio/lbry-app/pull/929))
|
* Fix Election linting errors ([#929](https://github.com/lbryio/lbry-app/pull/929))
|
||||||
* App will no longer reset when minimizing to tray ([#1042](https://github.com/lbryio/lbry-app/pull/1042))
|
* App will no longer reset when minimizing to tray ([#1042](https://github.com/lbryio/lbry-app/pull/1042))
|
||||||
|
* Error when clicking LBRY URLs when app is closed on macOS ([#1119](https://github.com/lbryio/lbry-app/issues/1119))
|
||||||
|
* LBRY URLs not working on Linux ([#1120](https://github.com/lbryio/lbry-app/issues/1120))
|
||||||
* Fix Windows notifications not showing ([1145](https://github.com/lbryio/lbry-app/pull/1145))
|
* Fix Windows notifications not showing ([1145](https://github.com/lbryio/lbry-app/pull/1145))
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
@ -46,7 +46,8 @@
|
||||||
"target": "deb",
|
"target": "deb",
|
||||||
"category": "AudioVideo;Video",
|
"category": "AudioVideo;Video",
|
||||||
"desktop": {
|
"desktop": {
|
||||||
"MimeType": "x-scheme-handler/lbry;"
|
"MimeType": "x-scheme-handler/lbry",
|
||||||
|
"Exec": "/opt/LBRY/lbry %U"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"deb": {
|
"deb": {
|
||||||
|
|
|
@ -33,8 +33,11 @@ export default appState => {
|
||||||
window.loadURL(rendererURL);
|
window.loadURL(rendererURL);
|
||||||
|
|
||||||
let deepLinkingURI;
|
let deepLinkingURI;
|
||||||
// Protocol handler for win32
|
if (
|
||||||
if (process.platform === 'win32' && String(process.argv[1]).startsWith('lbry')) {
|
(process.platform === 'win32' || process.platform === 'linux') &&
|
||||||
|
String(process.argv[1]).startsWith('lbry')
|
||||||
|
) {
|
||||||
|
[, deepLinkingURI] = process.argv;
|
||||||
// Keep only command line / deep linked arguments
|
// Keep only command line / deep linked arguments
|
||||||
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||||
// restore the original URI that was typed.
|
// restore the original URI that was typed.
|
||||||
|
@ -42,7 +45,11 @@ export default appState => {
|
||||||
// path, so we just strip it off.
|
// path, so we just strip it off.
|
||||||
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
|
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
|
||||||
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
|
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
|
||||||
deepLinkingURI = process.argv[1].replace(/\/$/, '').replace('/#', '#');
|
if (process.platform === 'win32') {
|
||||||
|
deepLinkingURI = deepLinkingURI.replace(/\/$/, '').replace('/#', '#');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deepLinkingURI = appState.macDeepLinkingURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupBarMenu();
|
setupBarMenu();
|
||||||
|
|
|
@ -66,8 +66,8 @@ app.on('ready', async () => {
|
||||||
'For more information please visit: \n' +
|
'For more information please visit: \n' +
|
||||||
'https://lbry.io/faq/startup-troubleshooting'
|
'https://lbry.io/faq/startup-troubleshooting'
|
||||||
);
|
);
|
||||||
app.quit();
|
|
||||||
}
|
}
|
||||||
|
app.quit();
|
||||||
});
|
});
|
||||||
daemon.launch();
|
daemon.launch();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,10 @@ app.on('will-quit', event => {
|
||||||
}
|
}
|
||||||
|
|
||||||
appState.isQuitting = true;
|
appState.isQuitting = true;
|
||||||
if (daemon) daemon.quit();
|
if (daemon) {
|
||||||
|
daemon.quit();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// https://electronjs.org/docs/api/app#event-will-finish-launching
|
// https://electronjs.org/docs/api/app#event-will-finish-launching
|
||||||
|
@ -120,8 +123,13 @@ app.on('will-finish-launching', () => {
|
||||||
// Protocol handler for macOS
|
// Protocol handler for macOS
|
||||||
app.on('open-url', (event, URL) => {
|
app.on('open-url', (event, URL) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (rendererWindow) {
|
||||||
rendererWindow.webContents.send('open-uri-requested', URL);
|
rendererWindow.webContents.send('open-uri-requested', URL);
|
||||||
rendererWindow.show();
|
rendererWindow.show();
|
||||||
|
} else {
|
||||||
|
appState.macDeepLinkingURI = URL;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -220,16 +228,26 @@ process.on('uncaughtException', error => {
|
||||||
|
|
||||||
// Force single instance application
|
// Force single instance application
|
||||||
const isSecondInstance = app.makeSingleInstance(argv => {
|
const isSecondInstance = app.makeSingleInstance(argv => {
|
||||||
// Protocol handler for win32
|
if (
|
||||||
// argv: An array of the second instance’s (command line / deep linked) arguments
|
(process.platform === 'win32' || process.platform === 'linux') &&
|
||||||
|
String(argv[1]).startsWith('lbry')
|
||||||
|
) {
|
||||||
|
let URI = argv[1];
|
||||||
|
|
||||||
let URI;
|
|
||||||
if (process.platform === 'win32' && String(argv[1]).startsWith('lbry')) {
|
|
||||||
// Keep only command line / deep linked arguments
|
// Keep only command line / deep linked arguments
|
||||||
URI = argv[1].replace(/\/$/, '').replace('/#', '#');
|
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||||
|
// restore the original URI that was typed.
|
||||||
|
// - If the URI has no path, Windows adds a trailing slash. LBRY URIs can't have a slash with no
|
||||||
|
// path, so we just strip it off.
|
||||||
|
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
|
||||||
|
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
URI = URI.replace(/\/$/, '').replace('/#', '#');
|
||||||
}
|
}
|
||||||
|
|
||||||
rendererWindow.webContents.send('open-uri-requested', URI);
|
rendererWindow.webContents.send('open-uri-requested', URI);
|
||||||
|
}
|
||||||
|
|
||||||
rendererWindow.show();
|
rendererWindow.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import SnackBar from 'component/snackBar';
|
||||||
import SplashScreen from 'component/splash';
|
import SplashScreen from 'component/splash';
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
import { ipcRenderer, remote, shell } from 'electron';
|
import { ipcRenderer, remote, shell } from 'electron';
|
||||||
import lbry from 'lbry';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
@ -100,6 +99,11 @@ const init = () => {
|
||||||
app.store.dispatch(doAutoUpdate());
|
app.store.dispatch(doAutoUpdate());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
autoUpdater.on('error', (error) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error.message)
|
||||||
|
});
|
||||||
|
|
||||||
if (['win32', 'darwin'].includes(process.platform)) {
|
if (['win32', 'darwin'].includes(process.platform)) {
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', () => {
|
||||||
console.log('Update available');
|
console.log('Update available');
|
||||||
|
|
Loading…
Add table
Reference in a new issue