Add basics of URI handling for Mac and Windows
This commit is contained in:
parent
2cc60fade1
commit
758bb59ccb
3 changed files with 22 additions and 1 deletions
|
@ -303,3 +303,12 @@ function upgrade(event, installerPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on('upgrade', upgrade);
|
ipcMain.on('upgrade', upgrade);
|
||||||
|
|
||||||
|
if (process.platform == 'darwin') {
|
||||||
|
app.on('open-url', (event, uri) => {
|
||||||
|
win.webContents.send('open-uri-requested', url);
|
||||||
|
});
|
||||||
|
} else if (process.argv.length >= 3) {
|
||||||
|
// No open-url event on Win, but we can still handle URIs provided at launch time
|
||||||
|
win.webContents.send('open-uri-requested', process.argv[2]);
|
||||||
|
}
|
||||||
|
|
|
@ -32,11 +32,19 @@
|
||||||
},
|
},
|
||||||
"backgroundColor": "155B4A"
|
"backgroundColor": "155B4A"
|
||||||
},
|
},
|
||||||
|
"protocols": [{
|
||||||
|
"name": "lbry",
|
||||||
|
"role": "Viewer",
|
||||||
|
"schemes": ["lbry"]
|
||||||
|
}],
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": "deb"
|
"target": "deb"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": "nsis"
|
"target": "nsis"
|
||||||
|
},
|
||||||
|
"nsis": {
|
||||||
|
"perMachine": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import SplashScreen from './component/splash.js';
|
||||||
import SnackBar from './component/snack-bar.js';
|
import SnackBar from './component/snack-bar.js';
|
||||||
import {AuthOverlay} from './component/auth.js';
|
import {AuthOverlay} from './component/auth.js';
|
||||||
|
|
||||||
const {remote} = require('electron');
|
const {remote, ipcRenderer} = require('electron');
|
||||||
const contextMenu = remote.require('./menu/context-menu');
|
const contextMenu = remote.require('./menu/context-menu');
|
||||||
|
|
||||||
lbry.showMenuIfNeeded();
|
lbry.showMenuIfNeeded();
|
||||||
|
@ -19,6 +19,10 @@ window.addEventListener('contextmenu', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('open-uri-requested', (event, uri) => {
|
||||||
|
window.location.href = `?show=${uri}`;
|
||||||
|
});
|
||||||
|
|
||||||
let init = function() {
|
let init = function() {
|
||||||
window.lbry = lbry;
|
window.lbry = lbry;
|
||||||
window.lighthouse = lighthouse;
|
window.lighthouse = lighthouse;
|
||||||
|
|
Loading…
Add table
Reference in a new issue