mirror of
https://github.com/yokoffing/Betterfox.git
synced 2026-06-12 07:30:47 +05:30
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c97bc06396 | |||
| 392c62a03c | |||
| 0bc76714a9 |
@@ -1,13 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: yokoffing
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: yokoffing
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: yokoffing
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
+9
-7
@@ -99,7 +99,7 @@ def _get_default_profile_folder(firefox_root):
|
||||
print(f"Reading {config_path}...")
|
||||
|
||||
config_parser = ConfigParser(strict=False)
|
||||
config_parser.read(config_path)
|
||||
config_parser.read(config_path, encoding = "utf8")
|
||||
|
||||
path = None
|
||||
for section in config_parser.sections():
|
||||
@@ -174,12 +174,17 @@ def download_betterfox(url):
|
||||
def extract_betterfox(data, profile_folder):
|
||||
zipfile = ZipFile(data)
|
||||
userjs_zipinfo = None
|
||||
depth = 1 # default to firefox user.js living at root dir
|
||||
if args.browser != "firefox":
|
||||
depth = 2 # ignore the outside
|
||||
for file in zipfile.filelist:
|
||||
if "/zen/" in file.filename and not args.zen:
|
||||
path = file.filename.split("/")
|
||||
if len(path)-1 != depth or (args.browser not in path and depth != 1) :
|
||||
continue
|
||||
if file.filename.endswith("user.js"):
|
||||
userjs_zipinfo = file
|
||||
userjs_zipinfo.filename = Path(userjs_zipinfo.filename).name
|
||||
break
|
||||
|
||||
if not userjs_zipinfo:
|
||||
raise BaseException("Could not find user.js!")
|
||||
@@ -212,18 +217,15 @@ if __name__ == "__main__":
|
||||
|
||||
default_profile_folder = _get_default_profile_folder(firefox_root)
|
||||
|
||||
argparser = ArgumentParser(
|
||||
|
||||
)
|
||||
argparser = ArgumentParser()
|
||||
argparser.add_argument("--overrides", "-o", default=default_profile_folder.joinpath("user-overrides.js"), help="if the provided file exists, add overrides to user.js. Defaults to " + str(default_profile_folder.joinpath("user-overrides.js"))),
|
||||
argparser.add_argument("--zen", "-z", action="store_true", default=False, help="Install user.js for the Zen browser instead. Defaults to False"),
|
||||
|
||||
|
||||
advanced = argparser.add_argument_group("Advanced")
|
||||
advanced.add_argument("--betterfox-version", "-bv", default=None, help=f"Which version of Betterfox to install. Defaults to the latest compatible release for your installed Firefox version")
|
||||
advanced.add_argument("--profile-dir", "-p", "-pd", default=default_profile_folder, help=f"Which profile dir to install user.js in. Defaults to {default_profile_folder}")
|
||||
advanced.add_argument("--repository-owner", "-ro", default="yokoffing", help="owner of the Betterfox repository. Defaults to yokoffing")
|
||||
advanced.add_argument("--repository-name", "-rn", default="Betterfox", help="name of the Betterfox repository. Defaults to Betterfox")
|
||||
advanced.add_argument("--browser", "-b", default="firefox", help="Which browser should Betterfox install to. Defaults to firefox. Available options: firefox, zen, waterfox")
|
||||
|
||||
disable = argparser.add_argument_group("Disable functionality")
|
||||
disable.add_argument("--no-backup", "-nb", action="store_true", default=False, help="disable backup of current profile (not recommended)"),
|
||||
|
||||
Reference in New Issue
Block a user