Check marketplace_home_url with user opt in
Issue: Update Extensions Marketplace user preferences ... (#508992 - closed)
Next MR: Enable extension marketplace by default (!184662 - merged)
What does this MR do and why?
Check marketplace_home_url with user opt in
- If a user has opted-in to marketplace A, we DO NOT want this to transfer over to marketplace B.
- For now, we store alongside the opt_in field, a url field, and check this field to determine the enablement.
- To avoid
user_preferencemodel from being too bloated, we move some business logic to its own classWebIde::ExtensionMarketplaceOptIn.
Screenshots or screen recordings
check_marketplace_home_url_demo
How to set up and validate locally
Prerequisites:
- Enable feature flag
web_ide_extensions_marketplace - Enable feature flag
vscode_extension_marketplace_settings
NOTE: GitLab caches application settings and feature flags a bit. You might need to refresh the page a couple of times (and wait) for cache to catch up to changes.
Test user preferences after changing URL:
- Go to Admin > Settings > General.
- In the
VS Code Extension Marketplacesection, enable the extension marketplace, then toggle ON Use Open VSX and click Save changes. - Go to your user's profile preferences
/-/profile/preferences. - In the Integrations section, look for Web IDE and Workspaces with checkbox Enable extension marketplace.
- EXPECTATION: The url in this section should be
https://open-vsx.org. - Check the checkbox and click Save changes.
- Go to Admin > Settings > General.
- In the
VS Code Extension Marketplacesection, toggle OFF Use Open VSX and for Service URL enterhttps://openvsx.test:8883/vscode/gallery, for Item URL enterhttps://openvsx.test:8883/vscode/item, for Resource URL Template enterhttps://openvsx.test:8883/vscode/unpkg/{publisher}/{name}/{versionRaw}/{path}, then click Save changes. - Go to your user's profile preferences
/-/profile/preferences. - EXPECTATION: The checkbox should be UNCHECKED and the url in this section should be
https://openvsx.test:8883.
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}" } }