diff --git a/src/main/background.ts b/src/main/background.ts index 21960e9..b91ed2f 100644 --- a/src/main/background.ts +++ b/src/main/background.ts @@ -206,7 +206,6 @@ async function boot() { engine.registerContentProvider(new SkynetProvider(engine)); engine.registerContentProvider(new IpfsProvider(engine)); - // @ts-ignore setKernelIframe(document.createElement("iframe")); getKernelIframe().src = "http://kernel.skynet"; getKernelIframe().onload = init; diff --git a/src/webEngine.ts b/src/webEngine.ts index 5baded8..e3c8d51 100644 --- a/src/webEngine.ts +++ b/src/webEngine.ts @@ -203,13 +203,7 @@ export default class WebEngine { return; } - if ("kernel.skynet" === hostname) { - return; - } - if (getAuthStatus().loginComplete !== true) { - return; - } - if ("google.com" !== hostname) { + if (!["google.com", "www.google.com"].includes(hostname)) { return; } if ( @@ -222,6 +216,9 @@ export default class WebEngine { } let queriedUrl = originalUrl.searchParams.get("q") as string; + if (!queriedUrl.includes("://")) { + queriedUrl = `http://${queriedUrl}`; + } let queriedHost = queriedUrl; try { let queriedUrlUbj = new URL(queriedUrl); @@ -250,6 +247,19 @@ export default class WebEngine { this.navigations.set(this.getNavigationId(details), promise); + if ("kernel.skynet" === queriedHost) { + if (!queriedUrl.includes("://")) { + queriedUrl = `http://${queriedUrl}`; + } + rejectRequest(queriedUrl); + return; + } + + if (getAuthStatus().loginComplete !== true) { + resolveRequest(); + return; + } + try { dns = await resolve(queriedHost, {}); } catch (e) {