Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Add support for Brave Browser and Waterfox Current #260

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion webextension/native/open_with_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def install():
'type': 'stdio',
}
locations = {
'brave': os.path.join(home_path, '.config', 'BraveSoftware', 'Brave-Browser-Dev', 'NativeMessagingHosts'),
'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'),
'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'),
'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'),
'waterfox-current': os.path.join(home_path, '.waterfox', 'native-messaging-hosts'),
}
filename = 'open_with.json'

Expand All @@ -74,7 +76,7 @@ def install():
os.mkdir(location)

browser_manifest = manifest.copy()
if browser == 'firefox':
if browser == 'firefox' or browser == 'waterfox-current':
browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net']
else:
browser_manifest['allowed_origins'] = [
Expand Down Expand Up @@ -112,6 +114,9 @@ def _read_desktop_file(path):

def find_browsers():
apps = [
'brave',
'brave-browser',
'brave-browser-dev',
'Chrome',
'Chromium',
'chromium-browser',
Expand All @@ -123,6 +128,8 @@ def find_browsers():
'Opera',
'SeaMonkey',
'seamonkey',
'Waterfox Current',
'waterfox-current',
]
paths = [
os.path.join(os.getenv('HOME'), '.local/share/applications'),
Expand Down
6 changes: 5 additions & 1 deletion webextension/native/open_with_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def install():
'type': 'stdio',
}
locations = {
'brave': os.path.join(home_path, 'Library', 'Application Support', 'BraveSoftware', 'Brave-Browser-Dev', 'NativeMessagingHosts'),
'chrome': os.path.join(home_path, 'Library', 'Application Support', 'Google', 'Chrome', 'NativeMessagingHosts'),
'chromium': os.path.join(home_path, 'Library', 'Application Support', 'Chromium', 'NativeMessagingHosts'),
'firefox': os.path.join(home_path, 'Library', 'Application Support', 'Mozilla', 'NativeMessagingHosts'),
'waterfox-current': os.path.join(home_path, 'Library', 'Application Support', 'Waterfox', 'NativeMessagingHosts'),
}
filename = 'open_with.json'

Expand All @@ -74,7 +76,7 @@ def install():
os.mkdir(location)

browser_manifest = manifest.copy()
if browser == 'firefox':
if browser == 'firefox' or browser == 'waterfox-current':
browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net']
else:
browser_manifest['allowed_origins'] = [
Expand All @@ -90,13 +92,15 @@ def install():

def find_browsers():
apps = [
'Brave',
'Chrome',
'Chromium',
'Firefox',
'Google Chrome',
'Opera',
'Safari',
'SeaMonkey',
'Waterfox Current',
]
paths = [
os.path.join(os.getenv('HOME'), 'Applications'),
Expand Down
4 changes: 3 additions & 1 deletion webextension/native/open_with_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ def install():
file.write('@echo off\r\ncall "%s" "%s" %%1 %%2\r\n' % (sys.executable, this_file))

registry_locations = {
'brave': os.path.join('Software', 'BraveSoftware', 'Brave-Browser-Dev', 'NativeMessagingHosts'),
'chrome': os.path.join('Software', 'Google', 'Chrome', 'NativeMessagingHosts'),
'firefox': os.path.join('Software', 'Mozilla', 'NativeMessagingHosts'),
'waterfox-current': os.path.join('Software', 'Waterfox', 'Waterfox Current 68.0', 'NativeMessagingHosts'),
}

for browser, registry_location in registry_locations.items():
browser_manifest = manifest.copy()
if browser == 'firefox':
if browser == 'firefox' or browser == 'waterfox-current':
browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net']
else:
browser_manifest['allowed_origins'] = [
Expand Down