From 2ae62b6c6ee00470f16a7e441314ee5124cbae2d Mon Sep 17 00:00:00 2001 From: Apfelwurm Date: Tue, 5 May 2020 08:18:12 +0200 Subject: [PATCH] Added Brave Browser support (#29) --- DEVELOPMENT.md | 8 ++++++++ README.md | 6 +++++- brotab/main.py | 7 ++++++- brotab/platform.py | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d3ea10d..5f0fb84 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -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 diff --git a/README.md b/README.md index 0978587..bb70bcd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/brotab/main.py b/brotab/main.py index 8868ef7..e1ac56b 100644 --- a/brotab/main.py +++ b/brotab/main.py @@ -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 @@ -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: @@ -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): diff --git a/brotab/platform.py b/brotab/platform.py index 54c9a46..0689653 100644 --- a/brotab/platform.py +++ b/brotab/platform.py @@ -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'