diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..2c0164fec8ceaed315e20102d4e76bf81001d247 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "python-briar-wrapper"] + path = python-briar-wrapper + url = https://code.briarproject.org/briar/python-briar-wrapper.git diff --git a/README.md b/README.md index 70d5e58a0ac5a796edfa8e55892a194d302e3711..0379d86af9af808bbb44fcaada4454ee9bc2f42d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ Once you've done this, change the path of the Briar headless jar in [src/briar/gtk/define.py](src/briar/gtk/define.py), build it with _meson_ and start Briar GTK. +Don't forget to initialize the python-briar-wrapper submodule: +`git submodule update --init` + ## Design Goals * Intuitive UI, similar to Briar Android client @@ -49,30 +52,8 @@ build it with _meson_ and start Briar GTK. ## FAQ -### I forgot my password. - -In case you forgot your password, there's no other way than to delete your old -account and start from scratch. Call `rm -rf ~/.briar/` to delete your current -account. - -### How can I transfer contacts from my Android device? - -By using [_adb_](https://developer.android.com/studio/command-line/adb), -you can copy the database and keys from a Briar Android installation. -Note that your smartphone needs to be rooted for this. - -You can either use the script at -[tools/copy-db-from-android.sh](tools/copy-db-from-android.sh) or do it manually: - -1. Start _briar-gtk_ and register a dummy account. This will create -the needed directory structure at _~/.briar/_. Close the program afterwards. -2. Enable _adb_ on your smartphone and give it root permissions. -3. Connect via _adb_ and gain root permissions using `adb root`. -4. Copy all important files using `adb pull`: -_/data/data/org.briarproject.briar.android/app_db/db.mv.db_, -_/data/data/org.briarproject.briar.android/app_key/db.key_, -_/data/data/org.briarproject.briar.android/app_key/db.key.bak_ -5. Replace the respecting files in _~/.briar/db_ and _~/.briar/key_. +Take a look at +[the FAQ of python-briar-wrapper](https://code.briarproject.org/briar/python-briar-wrapper/blob/master/README.md#faq). ## License diff --git a/app.briar.gtk.json b/app.briar.gtk.json index 343bb08a9119500646deb7a8a1e261118113eb8c..35411adfe71f1d53b489e2d1de25cdf27ee5f80a 100644 --- a/app.briar.gtk.json +++ b/app.briar.gtk.json @@ -99,6 +99,74 @@ } ] }, + { + "name": "python3-flit", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} flit" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/22/cd/a6aa959dca619918ccb55023b4cb151949c64d4d5d55b3f4ffd7eee0c6e8/docutils-0.15.2-py3-none-any.whl", + "sha256": "6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl", + "sha256": "fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl", + "sha256": "9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl", + "sha256": "017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/a5/47/c7f8a0f210ad18576840922e0b504f0b7f5f73aea4a52ab14c5b58517edf/pytoml-0.1.21-py2.py3-none-any.whl", + "sha256": "57a21e6347049f73bfb62011ff34cd72774c031b9828cb628a752225136dfc33" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl", + "sha256": "a8a318824cc77d1fd4b2bec2ded92646630d7fe8619497b142c84a9e6f5a7293" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/8f/7c/00228e4b1c1a4d118f71157063f35f6dad3150b1a10aca99517ec347726d/flit-2.1.0-py3-none-any.whl", + "sha256": "494e0806840fe896fe31ce2a413583115324f12177ecaf7427f157caa9b9c5b2" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl", + "sha256": "ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/b6/b0/50719ef7d12cd39ccfa4e48abb593764c8e4a6d0d9bdf7815be1949142ff/flit_core-2.1.0-py2.py3-none-any.whl", + "sha256": "c6dff661e9e290d51084cefc38b0971d692290e8a352d0b6cec6006be764b4d1" + } + ] + }, + { + "name": "briar-wrapper", + "buildsystem": "simple", + "build-commands": [ + "PIP_PREFIX=${FLATPAK_DEST} flit install --env", + "pip3 uninstall -y flit" + ], + "sources": [ + { + "type": "dir", + "path": "python-briar-wrapper" + } + ] + }, { "name": "briar-gtk", "buildsystem": "meson", diff --git a/python-briar-wrapper b/python-briar-wrapper new file mode 160000 index 0000000000000000000000000000000000000000..3250571844cab074babf4532fcfb6b9876a21f66 --- /dev/null +++ b/python-briar-wrapper @@ -0,0 +1 @@ +Subproject commit 3250571844cab074babf4532fcfb6b9876a21f66 diff --git a/requirements.txt b/requirements.txt index c2a51743d20d2e6a232992036c47e183dbc70f00..0d8b2b9e3de727f55870b84271fc1b688f9d6bbb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,4 @@ # SPDX-License-Identifier: AGPL-3.0-only # License-Filename: LICENSE.md -requests2>=2.16.0 -websockets>=8.0.2 +briar-wrapper>=0.0.2 diff --git a/src/briar/api/api.py b/src/briar/api/api.py deleted file mode 100644 index cf8357615cb980d7470f00d72d9095af7cd9c1f9..0000000000000000000000000000000000000000 --- a/src/briar/api/api.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -from os.path import isfile -from subprocess import Popen, PIPE, STDOUT -from threading import Thread -from time import sleep -from urllib.error import HTTPError, URLError -from urllib.request import urlopen - -from briar.api.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN, BRIAR_DB -from briar.api.models.socket_listener import SocketListener - - -class Api: - - auth_token = None - socket_listener = None - - _process = None - - def __init__(self, headless_jar): - self._command = ["java", "-jar", headless_jar] - - self.socket_listener = SocketListener(self) - - @staticmethod - def has_account(): - return isfile(BRIAR_DB) - - def is_running(self): - return (self._process is not None) and (self._process.poll() is None) - - def login(self, password, callback): - self._start_and_watch(callback) - startup_thread = Thread(target=self._login, args=(password,), - daemon=True) - startup_thread.start() - - def register(self, credentials, callback): - if len(credentials) != 2: - raise Exception("Can't process credentials") - self._start_and_watch(callback) - startup_thread = Thread(target=self._register, args=(credentials,), - daemon=True) - startup_thread.start() - - def stop(self): - if not self.is_running(): - raise Exception("Nothing to stop") - self._process.terminate() - - def _start_and_watch(self, callback): - if self.is_running(): - raise Exception("API already running") - self._process = Popen(self._command, stdin=PIPE, - stdout=PIPE, stderr=STDOUT) - watch_thread = Thread(target=self._watch_thread, args=(callback,), - daemon=True) - watch_thread.start() - - def _watch_thread(self, callback): - while self.is_running(): - try: - urlopen(BASE_HTTP_URL) - sleep(0.1) - except HTTPError as http_error: - if http_error.code == 404: - self._load_auth_token() - callback(True) - return - except URLError as url_error: - if not isinstance(url_error.reason, ConnectionRefusedError): - raise url_error - callback(False) - - def _login(self, password): - if not self.is_running(): - raise Exception("Can't login; API not running") - self._process.communicate(("%s\n" % password).encode("utf-8")) - - def _register(self, credentials): - if not self.is_running(): - raise Exception("Can't register; API not running") - self._process.communicate((credentials[0] + '\n' + - credentials[1] + '\n' + - credentials[1] + '\n').encode("utf-8")) - - def _load_auth_token(self): - if not Api.has_account(): - raise Exception("Can't load authentication token") - with open(BRIAR_AUTH_TOKEN, 'r') as file: - self.auth_token = file.read() diff --git a/src/briar/api/constants.py b/src/briar/api/constants.py deleted file mode 100644 index 34dd83fbe76fc0c1e5125306cef1156304e9a251..0000000000000000000000000000000000000000 --- a/src/briar/api/constants.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -from os.path import join -from pathlib import Path -from urllib.parse import urljoin - -_BRIAR_DIR_NAME = ".briar" -_HOME = str(Path.home()) -_BRIAR_DIR = join(_HOME, _BRIAR_DIR_NAME) - -_HOST = "%s://localhost:7000" -_VERSION_SUFFIX = "v1/" - -BRIAR_AUTH_TOKEN = join(_BRIAR_DIR, "auth_token") -BRIAR_DB = join(_BRIAR_DIR, "db", "db.mv.db") - -BASE_HTTP_URL = urljoin(_HOST % "http", _VERSION_SUFFIX) -WEBSOCKET_URL = urljoin(_HOST % "ws", "%s/ws" % _VERSION_SUFFIX) diff --git a/src/briar/api/model.py b/src/briar/api/model.py deleted file mode 100644 index f432c2b35570655802329e54a7b5f2e6f0dee746..0000000000000000000000000000000000000000 --- a/src/briar/api/model.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - - -class Model: # pylint: disable=too-few-public-methods - - _headers = {} - - def __init__(self, api): - self._api = api - self._initialize_headers() - - def _initialize_headers(self): - self._headers["Authorization"] = "Bearer %s" % self._api.auth_token diff --git a/src/briar/api/models/contacts.py b/src/briar/api/models/contacts.py deleted file mode 100644 index 6d4f6cf7721b3b7d44e1fec78c24c49c850a88cb..0000000000000000000000000000000000000000 --- a/src/briar/api/models/contacts.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -from urllib.parse import urljoin - -from requests import get as _get -from requests import post as _post - -from briar.api.constants import BASE_HTTP_URL -from briar.api.model import Model - - -class Contacts(Model): - - API_ENDPOINT = "contacts/" - - _on_contact_added_callback = None - - def add_pending(self, link, alias): - url = urljoin(BASE_HTTP_URL, self.API_ENDPOINT + "add/" + "pending/") - _post(url, headers=self._headers, json={"link": link, "alias": alias}) - - def get(self): - url = urljoin(BASE_HTTP_URL, self.API_ENDPOINT) - request = _get(url, headers=self._headers) - return request.json() - - def get_link(self): - url = urljoin(BASE_HTTP_URL, self.API_ENDPOINT + "add/" + "link/") - request = _get(url, headers=self._headers).json() - return request['link'] - - def watch_contacts(self, callback): - self._on_contact_added_callback = callback - self._api.socket_listener.watch("ContactAddedEvent", - self._on_contact_added) - - # pylint: disable=unused-argument - def _on_contact_added(self, event): - self._on_contact_added_callback() diff --git a/src/briar/api/models/private_chat.py b/src/briar/api/models/private_chat.py deleted file mode 100644 index 09e42af0c625adb89a7b3d8518a297f9e3518be1..0000000000000000000000000000000000000000 --- a/src/briar/api/models/private_chat.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -from urllib.parse import urljoin - -from requests import get as _get -from requests import post as _post - -from briar.api.constants import BASE_HTTP_URL -from briar.api.model import Model - - -class PrivateChat(Model): - - API_ENDPOINT = "messages/" - - _contact_id = 0 - _on_message_received_callback = None - - def __init__(self, api, contact_id): - super().__init__(api) - self._contact_id = contact_id - - def get(self): - url = urljoin(BASE_HTTP_URL, - self.API_ENDPOINT + "/%d" % self._contact_id) - request = _get(url, headers=self._headers) - return request.json() - - def watch_messages(self, callback): - self._on_message_received_callback = callback - self._api.socket_listener.watch("ConversationMessageReceivedEvent", - self._on_message_received) - - def _on_message_received(self, event): - self._on_message_received_callback(event['data']) - - def send(self, message): - url = urljoin(BASE_HTTP_URL, - self.API_ENDPOINT + "/%i" % self._contact_id) - _post(url, headers=self._headers, json={"text": message}) diff --git a/src/briar/api/models/socket_listener.py b/src/briar/api/models/socket_listener.py deleted file mode 100644 index c5b39ee7589a538993cfe266f39f395cd7518ed2..0000000000000000000000000000000000000000 --- a/src/briar/api/models/socket_listener.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -import asyncio -import json -from threading import Thread - -import websockets - -from briar.api.constants import WEBSOCKET_URL -from briar.api.model import Model - - -class SocketListener(Model): # pylint: disable=too-few-public-methods - - def watch(self, event, callback): - websocket_thread = Thread(target=self._start_watch_loop, - args=(event, callback), - daemon=True) - websocket_thread.start() - - def _start_watch_loop(self, event, callback): - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) - loop.create_task(self._start_websocket(event, callback)) - loop.run_forever() - loop.close() - - async def _start_websocket(self, event, callback): - async with websockets.connect(WEBSOCKET_URL) as websocket: - await websocket.send(self._api.auth_token) - await self._watch_messages(websocket, event, callback) - - async def _watch_messages(self, websocket, event, callback): - while not websocket.closed and not\ - asyncio.get_event_loop().is_closed(): - message_json = await websocket.recv() - message = json.loads(message_json) - if message['name'] == event: - callback(message) - if not asyncio.get_event_loop().is_closed(): - asyncio.get_event_loop().create_task( - self._watch_messages(websocket, event, callback)) diff --git a/src/briar/gtk/application.py b/src/briar/gtk/application.py index 6aa73db5af02d49abd4013a07a15efe6243692c0..c834d0f3c240e2da8e4870fee05bc93112754f41 100644 --- a/src/briar/gtk/application.py +++ b/src/briar/gtk/application.py @@ -8,7 +8,7 @@ from gi.repository import Gdk, Gio, GLib, Gtk -from briar.api.api import Api +from briar_wrapper.api import Api from briar.gtk.define import APPLICATION_ID, APPLICATION_NAME from briar.gtk.define import APPLICATION_STYLING_PATH, BRIAR_HEADLESS_JAR diff --git a/src/briar/gtk/containers/add_contact.py b/src/briar/gtk/containers/add_contact.py index f0a946af846b007a69da634ee4272506186db6c5..080bce18399af4adaa7a407616aa374b8a49c59b 100644 --- a/src/briar/gtk/containers/add_contact.py +++ b/src/briar/gtk/containers/add_contact.py @@ -6,7 +6,7 @@ from gettext import gettext as _ from gi.repository import GLib -from briar.api.models.contacts import Contacts +from briar_wrapper.models.contacts import Contacts from briar.gtk.container import Container from briar.gtk.define import APP diff --git a/src/briar/gtk/containers/chat.py b/src/briar/gtk/containers/chat.py index b2e00b0abfb146b7efd54591c3c17a3ee8c7c9ee..52ce9a8ca01e9da1ee0b1e102a77adb4df6a2d57 100644 --- a/src/briar/gtk/containers/chat.py +++ b/src/briar/gtk/containers/chat.py @@ -4,7 +4,7 @@ from gi.repository import GLib, Gtk -from briar.api.models.private_chat import PrivateChat +from briar_wrapper.models.private_chat import PrivateChat from briar.gtk.container import Container from briar.gtk.define import APP diff --git a/src/briar/gtk/containers/main.py b/src/briar/gtk/containers/main.py index e6b03e0e45ee34cd14aa0ff1df9bd4274e279ba3..66df9c540030846d762ae1a93a324f526a1fc6c2 100644 --- a/src/briar/gtk/containers/main.py +++ b/src/briar/gtk/containers/main.py @@ -4,7 +4,7 @@ from gi.repository import GLib, Gtk -from briar.api.models.contacts import Contacts +from briar_wrapper.models.contacts import Contacts from briar.gtk.container import Container from briar.gtk.define import APP diff --git a/src/meson.build b/src/meson.build index 744ca3a0236e976cdf711468ad421acee51b62b8..5ee9da684efc5c1676dff0841c635b5794c52d40 100644 --- a/src/meson.build +++ b/src/meson.build @@ -21,5 +21,4 @@ configure_file( install_dir: get_option('bindir') ) -install_subdir('briar/api', install_dir: MODULE_DIR) install_subdir('briar/gtk', install_dir: MODULE_DIR) diff --git a/tests/briar/api/models/test_contacts.py b/tests/briar/api/models/test_contacts.py deleted file mode 100644 index 988a6329273808ba6b8ee5c502195b940bd5e506..0000000000000000000000000000000000000000 --- a/tests/briar/api/models/test_contacts.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -import json - -import requests_mock - -from briar.api.models.contacts import Contacts - -BASE_HTTP_URL = "http://localhost:7000/v1/contacts/" - -TEST_LINK = "briar://wvui4uvhbfv4tzo6xwngknebsxrafainnhldyfj63x6ipp4q2vigy" -TEST_ALIAS = "Alice" - - -@requests_mock.Mocker(kw="requests_mock") -def test_add_pending(api, request_headers, requests_mock): - contacts = Contacts(api) - - requests_mock.register_uri("POST", - BASE_HTTP_URL + "add/pending/", - request_headers=request_headers, - additional_matcher=match_request_add_pending) - contacts.add_pending(TEST_LINK, TEST_ALIAS) - - -@requests_mock.Mocker(kw='requests_mock') -def test_get_empty(api, request_headers, requests_mock): - contacts = Contacts(api) - response = [] - - requests_mock.register_uri("GET", BASE_HTTP_URL, - request_headers=request_headers, - text=json.dumps(response)) - assert contacts.get() == response - - -@requests_mock.Mocker(kw='requests_mock') -def test_get_link(api, request_headers, requests_mock): - contacts = Contacts(api) - response = {"link": TEST_LINK} - - requests_mock.register_uri("GET", BASE_HTTP_URL + "add/link/", - request_headers=request_headers, - text=json.dumps(response)) - assert contacts.get_link() == TEST_LINK - - -def match_request_add_pending(request): - return {"alias": TEST_ALIAS, "link": TEST_LINK} == request.json() diff --git a/tests/briar/api/models/test_private_chat.py b/tests/briar/api/models/test_private_chat.py deleted file mode 100644 index 60222f5ac3155a0c0225b447857ff09ea565075c..0000000000000000000000000000000000000000 --- a/tests/briar/api/models/test_private_chat.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -import json - -import requests_mock - -from briar.api.models.private_chat import PrivateChat - -BASE_HTTP_URL = "http://localhost:7000/v1/messages/%s" - -TEST_CONTACT_ID = 42 -TEST_TEXT = "Hello World" - - -@requests_mock.Mocker(kw="requests_mock") -def test_get_empty(api, request_headers, requests_mock): - private_chat = PrivateChat(api, TEST_CONTACT_ID) - url = BASE_HTTP_URL % TEST_CONTACT_ID - response = [] - - requests_mock.register_uri("GET", url, request_headers=request_headers, - text=json.dumps(response)) - assert private_chat.get() == response - - -@requests_mock.Mocker(kw="requests_mock") -def test_send_message(api, request_headers, requests_mock): - private_chat = PrivateChat(api, TEST_CONTACT_ID) - url = BASE_HTTP_URL % TEST_CONTACT_ID - - requests_mock.register_uri("POST", url, request_headers=request_headers, - additional_matcher=match_request_send_message) - private_chat.send(TEST_TEXT) - - -def match_request_send_message(request): - return {"text": TEST_TEXT} == request.json() diff --git a/tests/briar/api/test_constants.py b/tests/briar/api/test_constants.py deleted file mode 100644 index 45376bcf68ec7fd9ad2d7ee6e52a85026c93c54c..0000000000000000000000000000000000000000 --- a/tests/briar/api/test_constants.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -from os.path import join -from pathlib import Path - -import pytest - -from briar.api.constants import BASE_HTTP_URL, BRIAR_AUTH_TOKEN -from briar.api.constants import BRIAR_DB, WEBSOCKET_URL - - -def test_base_http_url(): - assert BASE_HTTP_URL == "http://localhost:7000/v1/" - - -def test_briar_auth_token(briar_dir): - assert BRIAR_AUTH_TOKEN == join(briar_dir, "auth_token") - - -def test_briar_db(briar_dir): - assert BRIAR_DB == join(briar_dir, "db", "db.mv.db") - - -def test_websocket_url(): - assert WEBSOCKET_URL == "ws://localhost:7000/v1/ws" - - -@pytest.fixture -def briar_dir(): - return join(str(Path.home()), ".briar") diff --git a/tests/briar/gtk/test_application.py b/tests/briar/gtk/test_application.py index f3c375f1287a1a036e0eb57a0f4d8b425b8b3e24..a86f3f2f423361d8a444f81b68eca02fd166cff5 100644 --- a/tests/briar/gtk/test_application.py +++ b/tests/briar/gtk/test_application.py @@ -4,7 +4,7 @@ from unittest.mock import Mock -from briar.api.api import Api +from briar_wrapper.api import Api from briar.gtk.application import Application from briar.gtk.define import APPLICATION_NAME, APPLICATION_STYLING_PATH from briar.gtk.define import BRIAR_HEADLESS_JAR @@ -35,8 +35,8 @@ def test_do_activate(mocker): def test_quit(mocker): - api_mock = mocker.patch("briar.api.api.Api") - api_stop_mock = mocker.patch("briar.api.api.Api.stop") + api_mock = mocker.patch("briar_wrapper.api.Api") + api_stop_mock = mocker.patch("briar_wrapper.api.Api.stop") window_mock = mocker.patch("briar.gtk.window.Window") window_hide_mock = mocker.patch("briar.gtk.window.Window.hide") quit_mock = mocker.patch("gi.repository.Gio.Application.quit") diff --git a/tools/copy-db-from-android.sh b/tools/copy-db-from-android.sh deleted file mode 100755 index 1056cfe4d969fdd3ec6b2104f74a6a23bcd94966..0000000000000000000000000000000000000000 --- a/tools/copy-db-from-android.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -# Script to copy Briar database from Android to Linux devices. -# Note that you must have started Briar GTK beforehand. -# It's also recommend to manually start adb before using this script. - -set -e -x - -# List devices -adb devices - -# Switch to root mode -adb root - -# Copy files -adb pull /data/data/org.briarproject.briar.android/app_db/db.mv.db ~/.briar/db/ -adb pull /data/data/org.briarproject.briar.android/app_key/db.key ~/.briar/key/ -adb pull /data/data/org.briarproject.briar.android/app_key/db.key.bak ~/.briar/key/ diff --git a/tools/release-briar-headless.sh b/tools/release-briar-headless.sh deleted file mode 100755 index 650ec7a6fd9fa91cba9a72938506d5039fc26398..0000000000000000000000000000000000000000 --- a/tools/release-briar-headless.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2019 Nico Alt -# SPDX-License-Identifier: AGPL-3.0-only -# License-Filename: LICENSE.md - -set -e -x - -cd ../briar-android - -./gradlew --configure-on-demand briar-headless:jar - -cd briar-headless/build/libs - -sha256sum briar-headless.jar > sha256sum.txt -git log | head -n 1 > commit.txt - -echo "To sign, call 'for file in \$(ls); do gpg -b \"\$file\"; done'" - -xdg-open .