Switch ALLOW_HTTP_SETTING for allowHttp()

This commit is contained in:
Robert
2023-07-21 14:53:49 +01:00
parent f0318b0c84
commit a79b71cff6
2 changed files with 3 additions and 6 deletions

View File

@@ -649,10 +649,7 @@ export function isCodespacesTemplate() {
const DATABASE_DOWNLOAD_SETTING = new Setting("databaseDownload", ROOT_SETTING); const DATABASE_DOWNLOAD_SETTING = new Setting("databaseDownload", ROOT_SETTING);
export const ALLOW_HTTP_SETTING = new Setting( const ALLOW_HTTP_SETTING = new Setting("allowHttp", DATABASE_DOWNLOAD_SETTING);
"allowHttp",
DATABASE_DOWNLOAD_SETTING,
);
export function allowHttp(): boolean { export function allowHttp(): boolean {
return ALLOW_HTTP_SETTING.getValue<boolean>() || false; return ALLOW_HTTP_SETTING.getValue<boolean>() || false;

View File

@@ -30,7 +30,7 @@ import {
} from "../common/github-url-identifier-helper"; } from "../common/github-url-identifier-helper";
import { Credentials } from "../common/authentication"; import { Credentials } from "../common/authentication";
import { AppCommandManager } from "../common/commands"; import { AppCommandManager } from "../common/commands";
import { ALLOW_HTTP_SETTING } from "../config"; import { allowHttp } from "../config";
import { showAndLogInformationMessage } from "../common/logging"; import { showAndLogInformationMessage } from "../common/logging";
/** /**
@@ -371,7 +371,7 @@ function validateUrl(databaseUrl: string) {
throw new Error(`Invalid url: ${databaseUrl}`); throw new Error(`Invalid url: ${databaseUrl}`);
} }
if (!ALLOW_HTTP_SETTING.getValue() && uri.scheme !== "https") { if (!allowHttp() && uri.scheme !== "https") {
throw new Error("Must use https for downloading a database."); throw new Error("Must use https for downloading a database.");
} }
} }