diff --git a/js/interface/setup_settings.js b/js/interface/setup_settings.js index 2496bf003..8a20e5e68 100644 --- a/js/interface/setup_settings.js +++ b/js/interface/setup_settings.js @@ -19,7 +19,8 @@ function setupSettings() { updateStreamerModeNotification(); }}); new Setting('classroom_mode', {value: false, requires_restart: true}); - new Setting('cdn_mirror', {value: false}); + new Setting('cdn_mirror', {value: false, condition: () => settings.custom_cdn.value == '',requires_restart: true}); + new Setting('custom_cdn', {value: '', type: 'text', requires_restart: true}); new Setting('recovery_save_interval', {value: 30, type: 'number', min: 0, onChange() { clearTimeout(AutoBackup.loop_timeout); AutoBackup.backupProjectLoop(false); diff --git a/js/plugin_loader.ts b/js/plugin_loader.ts index c360dbfcc..50980df0d 100644 --- a/js/plugin_loader.ts +++ b/js/plugin_loader.ts @@ -35,7 +35,7 @@ export const Plugins = { /** * The currently used path to the plugin API */ - api_path: settings.cdn_mirror.value ? 'https://blckbn.ch/cdn/plugins' : 'https://cdn.jsdelivr.net/gh/JannisX11/blockbench-plugins/plugins', + api_path: settings.custom_cdn.value || (settings.cdn_mirror.value ? 'https://blckbn.ch/cdn/plugins' : 'https://cdn.jsdelivr.net/gh/JannisX11/blockbench-plugins/plugins'), path: '', /** * Dev reload all side-loaded plugins @@ -1023,7 +1023,7 @@ Plugins.loading_promise = new Promise((resolve, reject) => { resolve(); Plugins.loading_promise = null; - if (settings.cdn_mirror.value == false && navigator.onLine) { + if (!settings.custom_cdn.value && settings.cdn_mirror.value == false && navigator.onLine) { settings.cdn_mirror.set(true); console.log('Switching to plugin CDN mirror. Restart to apply.'); } diff --git a/lang/en.json b/lang/en.json index 3349c37bd..0df253a6d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1008,6 +1008,8 @@ "settings.classroom_mode.desc": "Restricts functionality such as installing plugins and removes links to social media", "settings.cdn_mirror": "Use CDN Mirror", "settings.cdn_mirror.desc": "Use the mirror CDN to download plugins. The mirror receives updates faster and works in some regions where the default does not work.", + "settings.custom_cdn": "Custom CDN", + "settings.custom_cdn.desc": "Specify a custom CDN URL to download plugins from.", "settings.recovery_save_interval": "Recovery Point Save Interval", "settings.recovery_save_interval.desc": "Blockbench regularly saves the open project in the background to recover in case of a computer crash. Set the interval in seconds. Set to 0 to disable saving.",