Skip to content

[Feature Request] add support for declarative extension settings (sync) #8094

@nenikitov

Description

@nenikitov

Module Name

programs.firefox (and forks like Librewolf or Floorp)

Requested Feature

Please add an option to modify sync extension settings in Firefox (and forks). It could be an option programs.firefox.profiles."<PROFILE>".extensions.settings."<EXTENSION>".syncSettings similar to programs.firefox.profiles."<PROFILE>".extensions.settings."<EXTENSION>".settings where the value is a JSON object.

Current Limitations

Firefox has 2 APIs for managing extension configurations, storage.local and storage.sync. The option added in #6389 works great for extensions that support local storage (like uBlock or DarkReader with extensions.settings."[email protected]".settings.syncSettings = false). But, it does not work with extensions relying on sync API (like SponsorBlock).

Test config

  1. Configure Librewolf
    # Assuming `firefoxAddons` input is available (`gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons`)
    programs.librewolf = {
      enable = true;
      profiles.default = {
        isDefault = true;
        settings."extensions.autoDisableScopes" = 0;
        extensions = {
          force = true;
          packages = with inputs.firefoxAddons.packages.${pkgs.system}; [
            sponsorblock
          ];
          settings."[email protected]" = {
            force = true;
            settings = {
              categorySelections = [
                {
                  name = "sponsor";
                  option = 1;
                }
              ];
            };
          };
        };
      };
    };
  2. Remove ~/.librewolf and rebuild the configuration
  3. Launch Librewolf, it should start with the SponsorBlock welcome tab
  4. Notice that Sponsor category is set to Auto skip when it should be Manual skip (option = 1)

Additional Context

Sync configurations are stored in ~/.librewolf/<PROFILE>/storage-sync-v2.sqlite file in the table storage_sync_data having these properties:

  • ext_id: like [email protected]
  • data: JSON configuration stored as text
  • sync_change_counter: not sure what this one is

Manually writing an example configuration to this file before starting Librewolf works. The generated file should not be write protected though.

storage-sync-v2-examples.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions