Add d7/Firefox workaround

* When Firefox is run from d7ii all tabs crash thus preventing installing uBO
* Added d7_forefix_fix.py to install uBO just for mozilla-type browsers
This commit is contained in:
2Shirt 2018-08-18 17:53:50 -07:00
parent 241f5cb897
commit ceba2e5ff2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 51 additions and 3 deletions

View file

@ -0,0 +1,44 @@
# Wizard Kit: Install uBlock Origin for Firefox
import os
import sys
# Init
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
from functions.browsers import *
from functions.cleanup import *
from functions.setup import *
init_global_vars()
os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\User Checklist ({USERNAME}).log'.format(
**global_vars, **global_vars['Env'])
D7_MODE = 'd7mode' in sys.argv
if __name__ == '__main__':
try:
stay_awake()
clear_screen()
print_info('{}: Firefox Fix for d7')
other_results = {
'Warning': {
'NotInstalledError': 'Not installed',
'NoProfilesError': 'No profiles found',
}}
# Scan for Firefox browsers
print_info('Scanning for Firefox browsers')
scan_for_browsers(just_firefox=True)
# Install uBlock Origin
print_info('Installing uBlock Origin')
install_adblock(just_firefox=True)
# Done
print_standard('\nDone.')
pause('Press Enter to exit...')
exit_script()
except SystemExit:
pass
except:
major_exception()

View file

@ -374,9 +374,11 @@ def get_mozilla_profiles(search_path, dev=False):
return profiles
def install_adblock(indent=8, width=32):
def install_adblock(indent=8, width=32, just_firefox=False):
"""Install adblock for all supported browsers."""
for browser in sorted(browser_data):
if just_firefox and browser_data[browser]['base'] != 'mozilla':
continue
exe_path = browser_data[browser].get('exe_path', None)
function=run_program
if not exe_path:
@ -483,9 +485,11 @@ def reset_browsers(indent=8, width=32):
indent=indent, width=width, function=function,
other_results=other_results, profile=profile)
def scan_for_browsers():
def scan_for_browsers(just_firefox=False):
"""Scan system for any supported browsers."""
for name in sorted(SUPPORTED_BROWSERS):
for name, details in sorted(SUPPORTED_BROWSERS.items()):
if just_firefox and details['base'] != 'mozilla':
continue
try_and_print(message='{}...'.format(name),
function=get_browser_details, cs='Detected',
other_results=other_results, name=name)