*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 IpfsProvider(engine));
|
||||
|
||||
// @ts-ignore
|
||||
setKernelIframe(document.createElement("iframe"));
|
||||
getKernelIframe().src = "http://kernel.skynet";
|
||||
getKernelIframe().onload = init;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Reference in New Issue