*Abort trying to intercept if we are not logged in

This commit is contained in:
Derrick Hammer 2022-08-14 13:51:01 -04:00
parent f3ee68679b
commit 0274210bfb
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,7 @@ function logLargeObjects() {
} }
setTimeout(logLargeObjects, timer); setTimeout(logLargeObjects, timer);
let authStatus: KernelAuthStatus; export let authStatus: KernelAuthStatus;
let authStatusKnown = false; let authStatusKnown = false;
let authStatusResolve: DataFn; let authStatusResolve: DataFn;
let bridgeLoadedResolve: DataFn; let bridgeLoadedResolve: DataFn;

View File

@ -15,6 +15,7 @@ import { getTld, isDomain, isIp, normalizeDomain } from "./util.js";
import tldEnum from "@lumeweb/tld-enum"; import tldEnum from "@lumeweb/tld-enum";
import { resolve } from "@lumeweb/kernel-dns-client"; import { resolve } from "@lumeweb/kernel-dns-client";
import { blake2b, bufToHex } from "libskynet"; import { blake2b, bufToHex } from "libskynet";
import { authStatus } from "./main/background.js";
export default class WebEngine { export default class WebEngine {
private contentProviders: BaseProvider[] = []; private contentProviders: BaseProvider[] = [];
@ -69,6 +70,9 @@ export default class WebEngine {
} }
private async proxyHandler(details: OnRequestDetailsType): Promise<any> { private async proxyHandler(details: OnRequestDetailsType): Promise<any> {
if (authStatus.loginComplete !== true) {
return {};
}
let handle = null; let handle = null;
for (const provider of this.contentProviders) { for (const provider of this.contentProviders) {
if (await provider.shouldHandleRequest(details)) { if (await provider.shouldHandleRequest(details)) {