From 4f87f42d74418fb203cea1dedf83a67cb8ce8382 Mon Sep 17 00:00:00 2001 From: Kristofer Lund Date: Thu, 26 Dec 2019 23:51:37 +0100 Subject: [PATCH 1/2] HTML "_blank" links open in default system browser --- happ-ui-controller.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/happ-ui-controller.js b/happ-ui-controller.js index cabf765..385a70d 100644 --- a/happ-ui-controller.js +++ b/happ-ui-controller.js @@ -1,4 +1,4 @@ -const { BrowserView, dialog, protocol, session, ipcMain } = require('electron') +const { BrowserView, dialog, protocol, session, ipcMain, shell } = require('electron') const { ncp } = require('ncp') const fs = require('fs') const path = require('path') @@ -271,6 +271,13 @@ class HappUiController { console.log('Created view. Loading', windowURL) view.webContents.loadURL(windowURL) + + // Open with default system browser + view.webContents.on("new-window", function (event, url) { + event.preventDefault() + shell.openExternal(url) + }) + //setupWindowDevProduction(view) let holoscape = this.holoscape view.on('close', (event) => { From 33754055bdd3715a98c8d1378a979a33a054dd7d Mon Sep 17 00:00:00 2001 From: Kristofer Lund Date: Mon, 30 Dec 2019 23:27:20 +0100 Subject: [PATCH 2/2] Fixes holochain/holoscape#54 --- views/legacy_install_bundle_view.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/views/legacy_install_bundle_view.html b/views/legacy_install_bundle_view.html index 63d647c..ee843c2 100644 --- a/views/legacy_install_bundle_view.html +++ b/views/legacy_install_bundle_view.html @@ -313,7 +313,6 @@

Bundle successfully installed!

installed_instances: [], installed_dnas: [], installed_bridges: [], - used_ports: [], happ_index: [], selected_happ: undefined, }, @@ -631,15 +630,17 @@

Bundle successfully installed!

console.log('Bridge added') } - const nextMinPort = () => { - if(app.used_ports.length > 0) { - app.used_ports.sort() - return app.used_ports[app.used_ports.length -1] + 1 + const nextMinPort = async () => { + const interfaces = await call('admin/interface/list')() + if (Array.isArray(interfaces) && interfaces.length > 0) { + const ports = [] + interfaces.forEach(interface => ports.push(interface.driver.port)) + return Math.max(...ports) + 1 } else { return 10000 } } - + const installUi = async (ui) => { console.log(JSON.stringify(ui)) let extractedPath = temp.path() @@ -658,8 +659,8 @@

Bundle successfully installed!

let id = `${ui.name}-interface` let type = 'websocket' let admin = app.installAsAdmin - let port = await getPort({port: getPort.makeRange(nextMinPort(), 31000)}) - app.used_ports.push(port) + let minPort = await nextMinPort() + let port = await getPort({port: getPort.makeRange(minPort, 31000)}) await call('admin/interface/add')({id,admin,type,port}) for(ref of ui.instance_references) {