@forge/cli
13.3.0-next.12-experimental-4b981ef-experimental-5b8eb3c13.3.0-next.25
out/command-line/controller/settings-controller.js~
out/command-line/controller/settings-controller.jsModified+1−39
Index: package/out/command-line/controller/settings-controller.js
===================================================================
--- package/out/command-line/controller/settings-controller.js
+++ package/out/command-line/controller/settings-controller.js
@@ -3,11 +3,10 @@
exports.SettingsController = exports.DELETABLE_SETTINGS = exports.ALLOWED_SETTINGS = void 0;
const cli_shared_1 = require("@forge/cli-shared");
const manifest_1 = require("@forge/manifest");
const environment_1 = require("../environment");
-exports.ALLOWED_SETTINGS = ['usage-analytics', 'default-environment', 'seasonal-effects', 'proxy'];
+exports.ALLOWED_SETTINGS = ['usage-analytics', 'default-environment', 'seasonal-effects'];
exports.DELETABLE_SETTINGS = ['proxy'];
-const INVALID_PROXY_URL = 'Invalid proxy URL specified. Valid proxy URLs must start with http:// or https://';
class SettingsController {
settingsView;
cachedConfigService;
getAppConfig;
@@ -63,21 +62,8 @@
set: async (value) => {
const parsedValue = this.parseBoolean(value);
this.cachedConfigService.setCustomEffects(parsedValue);
}
- },
- proxy: {
- description: cli_shared_1.Text.settings.proxy.description,
- get: async () => {
- const proxy = this.cachedConfigService.getProxy();
- return proxy ? this.redactUrlCredentials(proxy) : proxy;
- },
- set: async (value) => {
- this.validateProxyUrl(value);
- this.cachedConfigService.setProxy(value);
- },
- getDisplayValue: (value) => this.redactUrlCredentials(value),
- delete: async () => this.cachedConfigService.deleteProxy()
}
};
parseBoolean(value) {
switch (value) {
@@ -94,32 +80,8 @@
}
isSettingDeleteAllowed(preference) {
return exports.DELETABLE_SETTINGS.includes(preference);
}
- validateProxyUrl(value) {
- try {
- const proxyUrl = new URL(value);
- if (proxyUrl.protocol === 'http:' || proxyUrl.protocol === 'https:') {
- return;
- }
- }
- catch (e) {
- }
- throw new cli_shared_1.ValidationError(INVALID_PROXY_URL);
- }
- redactUrlCredentials(value) {
- try {
- const url = new URL(value);
- if (url.username || url.password) {
- url.username = '***';
- url.password = url.password ? '***' : '';
- }
- return url.toString();
- }
- catch (e) {
- return value;
- }
- }
async showSettings(json) {
const settings = [];
for (const settingName of exports.ALLOWED_SETTINGS) {
const setting = this.SETTINGS_MAP[settingName];