Switch ALLOW_HTTP_SETTING for allowHttp()
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user