зеркало из https://github.com/mozilla/ff-tool.git
feat: create ability to install addons (#104)
* feat: create ability to install addons (WIP) * Add support for preinstalling FF add-ons
This commit is contained in:
Родитель
7af35e5c84
Коммит
43e14774a5
15
README.rst
15
README.rst
|
@ -132,6 +132,21 @@ new one with that name.
|
|||
$ ff -p my_cool_profile1
|
||||
|
||||
|
||||
Preinstalling Profile Add-ons
|
||||
=============================
|
||||
|
||||
Fully qualified URL to an add-on XPI to install in profile.
|
||||
Firefox/mozprofile provides the ability to specify zero or more add-ons to
|
||||
preinstall into a profile.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
$ ff -c nightly -p my-profile-name -a https://moz-activity-streams-dev.s3.amazonaws.com/dist/activity-streams-latest.xpi --addon https://testpilot.firefox.com/files/pageshot/pageshot-0.1.201609272025.xpi
|
||||
|
||||
|
||||
|
||||
Custom Browser Prefs
|
||||
====================
|
||||
|
||||
|
|
|
@ -6,6 +6,13 @@ from fftool import CHANNELS, DEFAULT_CHANNEL
|
|||
def arg_parser():
|
||||
parser = ArgumentParser(prog='ff')
|
||||
|
||||
parser.add_argument(
|
||||
'-a',
|
||||
'--addon',
|
||||
action='append',
|
||||
help='Fully qualified URL to an add-on XPI to install in profile.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-c',
|
||||
'--channel',
|
||||
|
|
|
@ -13,7 +13,7 @@ import shutil
|
|||
import ConfigParser as configparser
|
||||
from tempfile import mkdtemp
|
||||
from outlawg import Outlawg
|
||||
from mozprofile import Profile, Preferences
|
||||
from mozprofile import FirefoxProfile, Preferences
|
||||
from ini_handler import IniHandler
|
||||
from fftool import (
|
||||
DIR_TEMP_PROFILES as BASE_PROFILE_DIR,
|
||||
|
@ -95,7 +95,7 @@ def clean_profiles():
|
|||
shutil.rmtree(profile_dir, True)
|
||||
|
||||
|
||||
def create_mozprofile(profile_dir, prefs_dirs=None, env=None):
|
||||
def create_mozprofile(profile_dir, addons, prefs_dirs=None, env=None):
|
||||
# Ensure base `.cache/profiles/` dir exists before trying to
|
||||
# create a nested directory.
|
||||
if not os.path.exists(BASE_PROFILE_DIR):
|
||||
|
@ -126,8 +126,11 @@ def create_mozprofile(profile_dir, prefs_dirs=None, env=None):
|
|||
# so we can go to about:config and verify our current profile.
|
||||
prefs.add([("fftool.profile.name", full_profile_dir)])
|
||||
|
||||
profile = Profile(
|
||||
profile=full_profile_dir, restore=False, preferences=prefs())
|
||||
profile = FirefoxProfile(
|
||||
addons=addons,
|
||||
profile=full_profile_dir,
|
||||
restore=False,
|
||||
preferences=prefs())
|
||||
|
||||
Log.header("USER CONFIGS")
|
||||
print("Launching browser with the following user configs:")
|
||||
|
|
|
@ -41,6 +41,7 @@ def main():
|
|||
# PROFILE
|
||||
profile_path = create_mozprofile(
|
||||
options.profile,
|
||||
options.addon,
|
||||
prefs_dirs=options.prefs_dirs,
|
||||
)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче