Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Brave Browser support #29

Merged
merged 6 commits into from
May 5, 2020
Merged
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
8 changes: 8 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Development

## Build, test and manual installation

1. Install docker: https://docs.docker.com/get-docker/
1. Install Python3
1. Clone repository and cd into it
1. Run:```rm -rf ./dist && python3 setup.py sdist bdist_wheel && docker build -t brotab-buildinstallrun . && docker run -it brotab-buildinstallrun```
1. The build is in the dist folder and can be installed with ```pip install $(find ./dist -name *.whl -type f) ```

## Installation in development mode

cd brotab
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ Features to show:
`sudo pip install brotab`)
1. Install native app manifests: `bt install`
1. Install Firefox extension: https://addons.mozilla.org/en-US/firefox/addon/brotab/
1. Install Chrome (Chromium) extension: https://chrome.google.com/webstore/detail/brotab/mhpeahbikehnfkfnmopaigggliclhmnc/
1. Install Chrome (Chromium) / Brave extension: https://chrome.google.com/webstore/detail/brotab/mhpeahbikehnfkfnmopaigggliclhmnc/
1. Enjoy! (try `bt clients`, `bt windows`, `bt list`, `bt words`)

## Build, test and manual installation

see [DEVELOPMENT.md](DEVELOPMENT.md)

## Author

Yuri Bochkarev
Expand Down
7 changes: 6 additions & 1 deletion brotab/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
from brotab.platform import is_windows
from brotab.platform import register_native_manifest_windows_chrome
from brotab.platform import register_native_manifest_windows_firefox
from brotab.platform import register_native_manifest_windows_brave
from brotab.platform import make_windows_path_double_sep
from brotab.utils import split_tab_ids, get_file_size, encode_query
from brotab.search.query import query
Expand Down Expand Up @@ -322,6 +323,8 @@ def install_mediator(args):
'~/.config/chromium/NativeMessagingHosts/brotab_mediator.json'),
('mediator/chromium_mediator.json',
'~/.config/google-chrome/NativeMessagingHosts/brotab_mediator.json'),
('mediator/chromium_mediator.json',
'~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/brotab_mediator.json'),
]

if args.tests:
Expand All @@ -346,9 +349,11 @@ def install_mediator(args):
register_native_manifest_windows_firefox(destination)
if is_windows() and 'chrome' in destination:
register_native_manifest_windows_chrome(destination)
if is_windows() and 'Brave' in destination:
register_native_manifest_windows_brave(destination)

print('Link to Firefox extension: https://addons.mozilla.org/en-US/firefox/addon/brotab/')
print('Link to Chrome (Chromium) extension: https://chrome.google.com/webstore/detail/brotab/mhpeahbikehnfkfnmopaigggliclhmnc/')
print('Link to Chrome (Chromium)/Brave extension: https://chrome.google.com/webstore/detail/brotab/mhpeahbikehnfkfnmopaigggliclhmnc/')


def executejs(args):
Expand Down
7 changes: 7 additions & 0 deletions brotab/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def register_native_manifest_windows_chrome(manifest_filename):
print('Setting registry key "%s" to "%s"' % (key_path, manifest_filename))
windows_registry_set_key(key_path, manifest_filename)

def register_native_manifest_windows_brave(manifest_filename):
key_path = r'Software\BraveSoftware\Brave-Browser\NativeMessagingHosts\brotab_mediator'
manifest_filename = make_windows_path(manifest_filename)
logger.info('Setting registry key "%s" to "%s"', key_path, manifest_filename)
print('Setting registry key "%s" to "%s"' % (key_path, manifest_filename))
windows_registry_set_key(key_path, manifest_filename)


def register_native_manifest_windows_firefox(manifest_filename):
key_path = r'Software\Mozilla\NativeMessagingHosts\brotab_mediator'
Expand Down