*Don't attempt to process if we are not logged in
This commit is contained in:
parent
c9b0daf053
commit
d485116f89
|
@ -9,6 +9,7 @@ import WebEngine from "../webEngine.js";
|
|||
import { getTld, isDomain, isIp, normalizeDomain } from "../util.js";
|
||||
import tldEnum from "@lumeweb/tld-enum";
|
||||
import { resolve } from "@lumeweb/kernel-dns-client";
|
||||
import { getAuthStatus } from "../main/vars.js";
|
||||
|
||||
export default abstract class BaseProvider {
|
||||
private engine: WebEngine;
|
||||
|
@ -48,6 +49,10 @@ export default abstract class BaseProvider {
|
|||
const originalUrl = new URL(details.url);
|
||||
const hostname = normalizeDomain(originalUrl.hostname);
|
||||
|
||||
if (getAuthStatus().loginComplete !== true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tldEnum.list.includes(getTld(hostname))) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import { getTld, isDomain, isIp, normalizeDomain } from "./util.js";
|
|||
import tldEnum from "@lumeweb/tld-enum";
|
||||
import { resolve } from "@lumeweb/kernel-dns-client";
|
||||
import { blake2b, bufToHex } from "libskynet";
|
||||
import { authStatus } from "./main/background.js";
|
||||
import { getAuthStatus } from "./main/vars.js";
|
||||
|
||||
export default class WebEngine {
|
||||
private contentProviders: BaseProvider[] = [];
|
||||
|
@ -70,9 +70,6 @@ export default class WebEngine {
|
|||
}
|
||||
|
||||
private async proxyHandler(details: OnRequestDetailsType): Promise<any> {
|
||||
if (authStatus.loginComplete !== true) {
|
||||
return {};
|
||||
}
|
||||
let handle = null;
|
||||
for (const provider of this.contentProviders) {
|
||||
if (await provider.shouldHandleRequest(details)) {
|
||||
|
@ -217,6 +214,13 @@ export default class WebEngine {
|
|||
}
|
||||
}
|
||||
|
||||
if ("kernel.skynet" === hostname) {
|
||||
return;
|
||||
}
|
||||
if (getAuthStatus().loginComplete !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
let resolveRequest: any, rejectRequest: any;
|
||||
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
|
Reference in New Issue