Use vscode_extension_marketplace settings in Web IDE
Issue: Update Web IDE settings to use admin settings f... (#508991 - closed)
What does this MR do and why?
This MR integrates the application setting vscode_extension_marketplace into the Web IDE and User Preferences page:
- It adds to the Web IDE settings pipeline:
-
extension_marketplace_generator.rbwhich generates the setting forvscode_extension_marketplace. Previously this was hardcoded with OpenVSX defaults, but now we read from application settings (based onvscode_extension_marketplace_settingsfeature flag). -
extension_marketplace_home_url_generator.rbwhich reads fromvscode_extension_marketplacesetting and returns the "Home URL" (used in the user-opt in text). This is moved to the settings pipeline, because we'll need to use this value in theextension_marketplace_metadata_generator.rb(future MR) to determine the user opt-in.
-
- It updates the
WebIde::ExtensionMarketplace.marketplace_home_urlfunction to use the settings pipeline to pullvscode_extension_marketplace_home_url. - It updates other parts of the code to respect the
vscode_extension_marketplace_settingsfeature flag which means that we are not hardcoding Open VSX marketplace, and instead use the value from thevscode_extension_marketplaceapplication setting.
Screenshots or screen recordings
Here's a demo where I walk through the behavior:
web_ide_extension_marketplace_demo
How to set up and validate locally
- Enable
vscode_web_ide,web_ide_extensions_marketplace, andvscode_extension_marketplace_settingsfeature flags. - Go to Admin > General > VS Code Extension Marketplace.
- In the textarea (UI handled in separate MR) enter
{}. - EXPECTATION: In the user preferences, the checkbox for extension marketplace should not be visible. (You might need to refresh the page a couple of times since things get heavily cached in GitLab).
- EXPECTATION: In the Web IDE, open the extension marketplace tab. The extension marketplace should be disabled.
-
- Go to Admin > General > VS Code Extension Marketplace.
- In the textarea enter
{"enabled":true,"preset":"open_vsx"}. -
EXPECTATION: In the user preferences, the checkbox for extension marketplace should be visible, with links pointing to
https://open-vsx.org. -
EXPECTATION: In the Web IDE, open the extension marketplace tab. The extension marketplace should be enabled and reaching out to
https://open-vsx.org.
How to setup local Open VSX proxy for more testing
This isn't required to test out this MR, but for the brave:
-
Make sure
nginxis installed. -
Update
/etc/hostswithopenvsx.test 127.0.0.1 -
Create a directory and create a file
openvsx-proxy.confwith content:events { worker_connections 1024; } http { server { listen openvsx.test:8883 ssl; server_name openvsx.test; ssl_certificate openvsx.test.pem; ssl_certificate_key openvsx.test-key.pem; location / { proxy_pass https://open-vsx.org/; } } } -
Inside the directory, run
mkcert openvsx.test. -
Start an
nginxserver with something likenginx -c ./openvsx-proxy.conf -
Try visiting
https://nginx.test:8883locally to confirm if the server is up and running. -
Now you can use the following
custom_valuesin yourvscode_extension_marketplacesettings on the GDK:{ "enabled":true, "preset":"custom", "custom_values": { "service_url":"https://openvsx.test:8883/vscode/gallery", "item_url":"https://openvsx.test:8883/vscode/item", "resource_url_template":"https://openvsx.test:8883/vscode/unpkg/{publisher}/{name}/{version}/{path}" } }