Coder Social home page Coder Social logo

Updater about betterfox HOT 22 OPEN

Patrxgt avatar Patrxgt commented on August 18, 2024 5
Updater

from betterfox.

Comments (22)

alana-glitch avatar alana-glitch commented on August 18, 2024 4

Good news! I've over-engineered the update process 😅

Free-as-in-mattress for anyone who wants to organize overrides per-section, and is comfortable with make: https://codeberg.org/oneirophage/firefox-user-js

from betterfox.

Patrxgt avatar Patrxgt commented on August 18, 2024 3

Great script! But I still think, that yokoffing should make an official solution to updating and overriding settings in separate file. It would make it way more user friendly and as far as I understand, this user.js is all about delivering privacy in the easiest to use package possible.

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024 2

Good consideration. Using that idea, you could create an overrides file and append it to the user.js:

#!/bin/bash
# NOTE: this installs to the default profile directory
# update user.js
curl https://raw.githubusercontent.com/yokoffing/Betterfox/master/user.js > "$(find ~/.mozilla/firefox/ -type d -name "*.default-release")"
# append overrides to file
cat user-overrides.js >> "$(find ~/.mozilla/firefox/ -type d -name "*.default-release")"/user.js

from betterfox.

stefnotch avatar stefnotch commented on August 18, 2024 2

A simple executable would be awesome for Windows users.

In my case, it'd make it very nice and easy to convince my friends to use Betterfox. "Oh you're using Firefox? Here, try downloading and running Betterfox, it simply makes your experience slightly better."

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024 1

Here's a oneliner curl script if you are on Linux. It just overwrites user.js with the latest version of the script from the GitHub repository:

curl https://raw.githubusercontent.com/yokoffing/Betterfox/master/user.js > "$(find ~/.mozilla/firefox/ -type d -name "*.default-release")"

from betterfox.

Patrxgt avatar Patrxgt commented on August 18, 2024 1

Problem with this method is, that it will remove all of my overrides. It could be nice, if your user.js could support user-overrides.js, like in ArkenFox's user.js

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024 1

Having a shell script seems to be the best approach. As for the normies who don't know how to run a shell script, having a section in the Wiki would help.

Perhaps we should consolidate Arkenfox's user.js update script for a basis for ours? Some ways we could go about overrides in the user.js are either:

  1. Having a separate file with overrides and appending that to the user.js file(proposed by me above)
  2. Extracting user overrides from the old file and insert them into the new file(might be harder to extract)

What do you think is the better approach, or do you have something else in mind?

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024 1

Maintaining a shell script for Windows and *Nix wouldn't be too hard. Powershell is a cross platform consideration. Python works too. Judging based off of what yokoffing said previously, it is likely that (Windows) users would need to install the interpreter for the language we choose.

Find Firefox user profile. Is this easy, or is this surprisingly finicky? What if the user installed Firefox on a different disk? (One approach seems to be parsing the file at %APPDATA%\Mozilla\Firefox\profiles.ini or ~/.mozilla/firefox/profiles.ini or /snap/firefox/common/.mozilla/firefox or */Library/Application Support/Firefox/profiles.ini or ...)

I think a majority of people install Firefox on the same disk as their operating system is on. Perhaps we should make a poll to see if this is something we should consider.

Figure out the version of Firefox

What purpose would detecting browser version be for?

Read the current user.js, and figure out which user.js this corresponds to? (There are multiple versions of Betterfox)

There aren't multiple versions of Betterfox, the other user.js files only contain specific sections of the main user.js.

Download the new user.js
Write the new user.js to the file

Having used Betterfox for a few months now, I'd like to share my updated (Bash) script that accomplishes this:

#!/bin/bash

# fetch betterfox user.js
curl -o user.js https://raw.githubusercontent.com/yokoffing/Betterfox/main/user.js

# append user added settings to user.js
echo '

// your settings/overrides here

' >> user.js

# ensure profiles directory is created
if [ ! -d "~/.mozilla/" ]; then
    sleep 5 && killall firefox &
    firefox -headless &
    wait
fi
# move user.js into firefox default profile directory
mv user.js "$(find ~/.mozilla/firefox/ -type d -name "*.default-release")"

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024 1

What are your thoughts on an executable? The concept of running an executable would be familiar for Windows users and we could bundle any dependencies for the tooling we use with it.

There can be multiple Firefox profiles, so that's maybe also worth keeping in mind.
Good consideration.
Every Firefox version has a corresponding version of Betterfox. It'd be weird if the updater could update the Betterfox script before Firefox got around to doing its update.

I forgot about the releases, thank you for pointing that out! We could probably get the version number from the Firefox binary and form a URL with the version number.

And finally, I noticed that I missed an important step: Making a backup of the Firefox profile. The wiki seems to strongly recommend it, so I suppose it'd be useful to have that in an installer script as well. (Of course as a skip-able option.)

Ah that is something I overlooked too.

from betterfox.

 avatar commented on August 18, 2024

Here's a simple batch script I wrote for updating the user.js file

@echo off
powershell invoke-webrequest -uri 'https://github.com/yokoffing/Betterfox/raw/master/user.js' -outfile user.js
pause

I couldn't test so please let me know if it works

from betterfox.

 avatar commented on August 18, 2024

Here's a simple batch script I wrote for updating the user.js file

@echo off
powershell invoke-webrequest -uri 'https://github.com/yokoffing/Betterfox/raw/master/user.js' -outfile user.js
pause

I couldn't test so please let me know if it works

The script written in PowerShell

invoke-webrequest -uri "https://github.com/yokoffing/Betterfox/raw/master/user.js" -outfile user.js
pause

from betterfox.

unrealapex avatar unrealapex commented on August 18, 2024

Just an FYI, this does not update the script file, it just retrieves a new version. It would be better if the new file could be moved to the profiles directory automatically. It is C:\Users\<username>\Appdata\Roaming\Firefox\<profile-name>. In my Bash script, I found the profile directory with a wildcard and moved the file there.

from betterfox.

yokoffing avatar yokoffing commented on August 18, 2024

I've had the honor of meeting a handful of Betterfox users in real life. Do you know how many of them would know how to run a script to update their user.js?

Zero.

I'm aware that we have more advanced users of Betterfox, so an updater would be nice -- but it's also out of scope for the primary audience.

If someone creates a solution, I will happily integrate it and give them credit.

from betterfox.

HyperCriSiS avatar HyperCriSiS commented on August 18, 2024

Having a shell script seems to be the best approach. As for the normies who don't know how to run a shell script, having a section in the Wiki would help.

Perhaps we should consolidate Arkenfox's user.js update script for a basis for ours? Some ways we could go about overrides in the user.js are either:

1. Having a separate file with overrides and appending that to the user.js file(proposed by me above)

2. Extracting user overrides from the old file and insert them into the new file(might be harder to extract)

What do you think is the better approach, or do you have something else in mind?

Just came here to ask the same. I think this would be the best solution with also the least of work?
I was using the Arkenfox user.js and had many issues. Glad I found this one here. Would be awesome to also have the updater 😀

from betterfox.

Patrxgt avatar Patrxgt commented on August 18, 2024

I've had the honor of meeting a handful of Betterfox users in real life. Do you know how many of them would know how to run a script to update their user.js?

Zero.

Emm, no? Double click script is easier than modifying user.js, to copy user's overrides.

from betterfox.

Finoderi avatar Finoderi commented on August 18, 2024

There is no need to over-engineer an update process. Replacing the user.js and copying/pasting overrides is easy and simple enough already.

from betterfox.

Patrxgt avatar Patrxgt commented on August 18, 2024
  1. It's not over-engineering.
  2. If it's impossible to make an updater, then it would be nice to at least have separate file for user overrides.

from betterfox.

Finoderi avatar Finoderi commented on August 18, 2024

If you need an updater and a separate file for overrides so badly you can just use arkenfox's 'parrot' nonsense. The less moving parts the project has - the more stable and dependable it is.

from betterfox.

VenimK avatar VenimK commented on August 18, 2024

is there a 'updater' for osx

from betterfox.

yokoffing avatar yokoffing commented on August 18, 2024

@alana-glitch Thank you for your work.

from betterfox.

stefnotch avatar stefnotch commented on August 18, 2024

For future people who want to tackle this: How does one best go about this task? Which tech stack? Which things to watch out for?

Tech stack:

  • Should be cross platform
  • Should be as simple as possible, both for devs and for the end user
    e.g. If we go with shell scripts, then we would need to maintain one script for Windows, and one for Linux.

Steps:

  1. Find Firefox user profile. Is this easy, or is this surprisingly finicky? What if the user installed Firefox on a different disk? (One approach seems to be parsing the file at %APPDATA%\Mozilla\Firefox\profiles.ini or ~/.mozilla/firefox/profiles.ini or ~/snap/firefox/common/.mozilla/firefox or *~/Library/Application Support/Firefox/profiles.ini or ...)
  2. Figure out the version of Firefox
  3. Read the current user.js, this could be used to detect if the user did any changes to the user.js file?
  4. Download the new user.js
  5. Make a backup of the Firefox profile
  6. Write the new user.js to the file

What did I miss?

from betterfox.

stefnotch avatar stefnotch commented on August 18, 2024

If we do end up choosing something that requires an extra installation, then it'd be lovely if that were as simple as possible for the end-user.

Python is an excellent example, since installing Python in Windows using the official installer frequently fails. And uninstalling it is equally error-prone.
Meanwhile, if the script starts off by

  1. Check if Python is installed
  2. If not, download a binary from PyPy and use that
    then the user experience would be near-perfect. The user wouldn't even have to know that the script relies on Python.

I think a majority of people install Firefox on the same disk as their operating system is on. Perhaps we should make a poll to see if this is something we should consider.

There can be multiple Firefox profiles, so that's maybe also worth keeping in mind.

What purpose would detecting browser version be for?

Every Firefox version has a corresponding version of Betterfox. It'd be weird if the updater could update the Betterfox script before Firefox got around to doing its update.

And the second consideration would be that there are multiple Firefox release channels, like Firefox Nightly, Firefox Beta, Firefox ESR.

There aren't multiple versions of Betterfox, the other user.js files only contain specific sections of the main user.js.

Ah, I see. Thank you for clearing that up.

Having used Betterfox for a few months now, I'd like to share my updated (Bash) script that accomplishes this:

On that note, apparently arkenfox's user.js also has a shell script
https://github.com/arkenfox/user.js/blob/master/updater.sh

And finally, I noticed that I missed an important step: Making a backup of the Firefox profile. The wiki seems to strongly recommend it, so I suppose it'd be useful to have that in an installer script as well. (Of course as a skip-able option.)

from betterfox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.