*Handle both google.com and www.google.com
*Ensure queriedUrl has a protocol before parsing *Handle kernel.skynet in navigation request *Abort if we are not logged in only after checking for kernel urls
This commit is contained in:
parent
fe93f6763a
commit
a3baf41237
|
@ -206,7 +206,6 @@ async function boot() {
|
||||||
engine.registerContentProvider(new SkynetProvider(engine));
|
engine.registerContentProvider(new SkynetProvider(engine));
|
||||||
engine.registerContentProvider(new IpfsProvider(engine));
|
engine.registerContentProvider(new IpfsProvider(engine));
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
setKernelIframe(document.createElement("iframe"));
|
setKernelIframe(document.createElement("iframe"));
|
||||||
getKernelIframe().src = "http://kernel.skynet";
|
getKernelIframe().src = "http://kernel.skynet";
|
||||||
getKernelIframe().onload = init;
|
getKernelIframe().onload = init;
|
||||||
|
|
|
@ -203,13 +203,7 @@ export default class WebEngine {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("kernel.skynet" === hostname) {
|
if (!["google.com", "www.google.com"].includes(hostname)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (getAuthStatus().loginComplete !== true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ("google.com" !== hostname) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -222,6 +216,9 @@ export default class WebEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
let queriedUrl = originalUrl.searchParams.get("q") as string;
|
let queriedUrl = originalUrl.searchParams.get("q") as string;
|
||||||
|
if (!queriedUrl.includes("://")) {
|
||||||
|
queriedUrl = `http://${queriedUrl}`;
|
||||||
|
}
|
||||||
let queriedHost = queriedUrl;
|
let queriedHost = queriedUrl;
|
||||||
try {
|
try {
|
||||||
let queriedUrlUbj = new URL(queriedUrl);
|
let queriedUrlUbj = new URL(queriedUrl);
|
||||||
|
@ -250,6 +247,19 @@ export default class WebEngine {
|
||||||
|
|
||||||
this.navigations.set(this.getNavigationId(details), promise);
|
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 {
|
try {
|
||||||
dns = await resolve(queriedHost, {});
|
dns = await resolve(queriedHost, {});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Reference in New Issue