Skip to content

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_preference model from being too bloated, we move some business logic to its own class WebIde::ExtensionMarketplaceOptIn.

Screenshots or screen recordings

check_marketplace_home_url_demo

How to set up and validate locally

Prerequisites:

  1. Enable feature flag web_ide_extensions_marketplace
  2. 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:

  1. Go to Admin > Settings > General.
  2. In the VS Code Extension Marketplace section, enable the extension marketplace, then toggle ON Use Open VSX and click Save changes.
  3. Go to your user's profile preferences /-/profile/preferences.
  4. In the Integrations section, look for Web IDE and Workspaces with checkbox Enable extension marketplace.
  5. EXPECTATION: The url in this section should be https://open-vsx.org.
  6. Check the checkbox and click Save changes.
  7. Go to Admin > Settings > General.
  8. In the VS Code Extension Marketplace section, toggle OFF Use Open VSX and for Service URL enter https://openvsx.test:8883/vscode/gallery, for Item URL enter https://openvsx.test:8883/vscode/item, for Resource URL Template enter https://openvsx.test:8883/vscode/unpkg/{publisher}/{name}/{versionRaw}/{path}, then click Save changes.
  9. Go to your user's profile preferences /-/profile/preferences.
  10. 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:

  1. Make sure nginx is installed.

  2. Update /etc/hosts with openvsx.test 127.0.0.1

  3. Create a directory and create a file openvsx-proxy.conf with 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/;
        }
      }
    }
    
  4. Inside the directory, run mkcert openvsx.test.

  5. Start an nginx server with something like nginx -c ./openvsx-proxy.conf

  6. Try visiting https://nginx.test:8883 locally to confirm if the server is up and running.

  7. Now you can use the following custom_values in your vscode_extension_marketplace settings 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}"
      }
    }
Edited by Paul Slaughter

Merge request reports

Loading