EFForg / privacybadger

Privacy Badger is a browser extension that automatically learns to block invisible trackers.
https://privacybadger.org
Other
3.19k stars 386 forks source link

Option to disable first run page #1206

Closed allo- closed 7 years ago

allo- commented 7 years ago

Can you merge/adapt https://github.com/EFForg/privacybadgerfirefox-legacy/commit/1eca2cbe8472792dbf68278daf7261c4682710b9 for the new addon?

cowlicks commented 7 years ago

This would be useful for testing.

cowlicks commented 7 years ago

I'm not sure the best way to do this. Chrome doesn't have global extension preferences like firefox does, so you can't set a preference before installation to turn off the first run page. And I don't think firefox preferences api is exposed to WebExtensions.

@allo- how are you installing Privacy Badger?

allo- commented 7 years ago

My usecase is preinstalling it in new profiles, which means i place it in the extension folder with the right name (as the installed extension has, not as the download from addons.mozilla.org has) and add in the new prefs.js user_pref("extensions.autoDisableScopes", 14);. The the extensions gets installed on first run and should be updated as soon as possible.

cooperq commented 7 years ago

yea unfortunately I'm not sure there is any way to do this any more with the new web extensions API. Maybe you could add in a pre-configured storage.json that already has the first run page setting toggled and all of the other pre-seeded settings that would desire?

allo- commented 7 years ago

So the new api doesn't use about:config anymore at all? I think i need to look into the new SDK what it is doing and what would be possible to configure before installation.

I guess it's ./browser-extension-data/jid1-MnnxcxisBPnSXQ@jetpack/storage.js and then json['seenComic']=true now? I think this should be no problem, if the setting is parsed every time (i.e. even in a trigger right after installation).

cooperq commented 7 years ago

yes that is it! I believe that setting is parsed every time, so that should do the trick. Good luck!

cowlicks commented 7 years ago

@allo- that should work except that name "jid1-MnnxcxisBPnSXQ@jetpack" might be unique for each user and if it is related to the extension URL. Unlike chrome, where the extension URL is based off the app developers' public key, so it is the same for each user.

This code might be useful: https://github.com/EFForg/privacybadger/pull/1168/files#diff-f448424892a6d1a088de9a3cc2c800abR28

But that might be practical for you, since most users will not have marionette installed.

cowlicks commented 7 years ago

@allo- Ah, that string actually comes from package.json (here). So it is deterministic and should be easy to get.

allo- commented 7 years ago

seenComic seems not to be set, if you closed the tab, but the comic is not shown again. There is a isFirstRun setting, which seems to be set.

In theory this should work:

currently this does not work. I am still experimenting, if the installation of the addon overwrites the storage.js file or if am still missing something. Possibly extensions.json or another file needs to be pregenerated as well.

@cooperq The user does not need to have installed anything, but should get a pregenerated profile in a zipfile. But the generator should work without advanced stuff like selenium, too. I do not want to run it, the profile.zip should be a bare minimum (people can control what's in there) and everyone should be able to setup the site himself without too much efford.

cooperq commented 7 years ago

were you not able to get storage.js working then?

allo- commented 7 years ago

I tried yesterday the steps described above without success. I need to test more before i know if i did something in the wrong order or if its not working and depends on other "is already installed" config options in the profile.

So my current status: I will work on it again, when i have enough time and patience.

allo- commented 7 years ago

Single Quotes are invalid JSON. It works, with: {"settings_map":{"isFirstRun": false}}.

I corrected my post above, so you can use it if you want to build tests based on it.

You can create a test profile on ffprofile.com. Go directly to the "addons" section and select only "privacy badger". Then save and download profile.zip on the finish page.

ghostwords commented 6 years ago

This seems related to #914.