mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 03:37:28 -03:00
Update get-tor.py to use Tor Browser 11.0.4, and improve it. Make sure we run get-tor.py in CI before compiling pluggable transports, so the correct folder will exist
This commit is contained in:
parent
5c24453ddc
commit
549b0eac72
4 changed files with 112 additions and 101 deletions
|
@ -96,6 +96,39 @@ jobs:
|
|||
steps:
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: Install Python 3.9.12
|
||||
command: |
|
||||
choco install python3 --version=3.9.12
|
||||
|
||||
- run:
|
||||
name: Install poetry
|
||||
command: (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
|
||||
|
||||
- restore_cache:
|
||||
key: build-win64-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Install poetry dependencies
|
||||
command: |
|
||||
cd C:\Users\circleci\project\desktop
|
||||
poetry install
|
||||
- save_cache:
|
||||
key: build-win64-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\AppData\Local\pypoetry\Cache\virtualenvs
|
||||
|
||||
- restore_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Get tor binaries from Tor Browser (32-bit)
|
||||
command: |
|
||||
cd desktop
|
||||
poetry run python .\scripts\get-tor.py
|
||||
- save_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\build\tor
|
||||
|
||||
- restore_cache:
|
||||
# NOTE: change when upgrading obfs4proxy
|
||||
key: build-win64-obfs4proxy-v0.0.13-{{ .Environment.CACHE_VERSION }}
|
||||
|
@ -167,40 +200,7 @@ jobs:
|
|||
# NOTE: change when upgrading meek
|
||||
key: build-win64-meek-v0.37.0-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\meek-client.exe
|
||||
|
||||
- run:
|
||||
name: Install Python 3.9.12
|
||||
command: |
|
||||
choco install python3 --version=3.9.12
|
||||
|
||||
- run:
|
||||
name: Install poetry
|
||||
command: (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
|
||||
|
||||
- restore_cache:
|
||||
key: build-win64-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Install poetry dependencies
|
||||
command: |
|
||||
cd C:\Users\circleci\project\desktop
|
||||
poetry install
|
||||
- save_cache:
|
||||
key: build-win64-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\AppData\Local\pypoetry\Cache\virtualenvs
|
||||
|
||||
- restore_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Get tor binaries from Tor Browser (32-bit)
|
||||
command: |
|
||||
cd desktop
|
||||
poetry run .\scripts\get-tor.py
|
||||
- save_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\obfs4proxy.exe
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\meek-client.exe
|
||||
|
||||
- run:
|
||||
name: Build OnionShare
|
||||
|
@ -232,6 +232,39 @@ jobs:
|
|||
steps:
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: Install Python 3.9.12 (32-bit)
|
||||
command: |
|
||||
choco install python3 --params "/InstallDir32:C:\Python-32bit" --version=3.9.12
|
||||
|
||||
- run:
|
||||
name: Install poetry (32-bit)
|
||||
command: C:\Python-32bit\Scripts\pip install poetry
|
||||
|
||||
- restore_cache:
|
||||
key: build-win32-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Install poetry dependencies
|
||||
command: |
|
||||
cd ~\project\desktop
|
||||
C:\Python-32bit\Scripts\poetry install
|
||||
- save_cache:
|
||||
key: build-win32-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\AppData\Local\pypoetry\Cache\virtualenvs
|
||||
|
||||
- restore_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Get tor binaries from Tor Browser (32-bit)
|
||||
command: |
|
||||
cd desktop
|
||||
C:\Python-32bit\Scripts\poetry run python run .\scripts\get-tor.py
|
||||
- save_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\build\tor
|
||||
|
||||
- run:
|
||||
name: Install golang (32-bit)
|
||||
command: |
|
||||
|
@ -310,40 +343,7 @@ jobs:
|
|||
# NOTE: change when upgrading meek
|
||||
key: build-win32-meek-v0.37.0-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\meek-client.exe
|
||||
|
||||
- run:
|
||||
name: Install Python 3.9.12 (32-bit)
|
||||
command: |
|
||||
choco install python3 --params "/InstallDir32:C:\Python-32bit" --version=3.9.12
|
||||
|
||||
- run:
|
||||
name: Install poetry (32-bit)
|
||||
command: C:\Python-32bit\Scripts\pip install poetry
|
||||
|
||||
- restore_cache:
|
||||
key: build-win32-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Install poetry dependencies
|
||||
command: |
|
||||
cd ~\project\desktop
|
||||
C:\Python-32bit\Scripts\poetry install
|
||||
- save_cache:
|
||||
key: build-win32-desktop-poetry-deps-{{ checksum "~/project/desktop/poetry.lock" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\AppData\Local\pypoetry\Cache\virtualenvs
|
||||
|
||||
- restore_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
- run:
|
||||
name: Get tor binaries from Tor Browser (32-bit)
|
||||
command: |
|
||||
cd desktop
|
||||
poetry run .\scripts\get-tor.py
|
||||
- save_cache:
|
||||
key: get-tor-{{ checksum "desktop/scripts/get-tor.py" }}-{{ .Environment.CACHE_VERSION }}
|
||||
paths:
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\obfs4proxy.exe
|
||||
- C:\Users\circleci\project\desktop\onionshare\resources\tor\meek-client.exe
|
||||
|
||||
- run:
|
||||
name: Build OnionShare
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Enable built-in obfs4 bridge
|
||||
Bridge obfs4 144.217.20.138:80 FB70B257C162BF1038CA669D568D76F5B7F0BABB cert=vYIV5MgrghGQvZPIi1tJwnzorMgqgmlKaB77Y3Z9Q/v94wZBOAXkW+fdx4aSxLVnKO+xNw iat-mode=0
|
||||
Bridge obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0
|
||||
Bridge obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1
|
||||
Bridge obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0
|
||||
|
|
|
@ -495,12 +495,12 @@ class GuiCommon:
|
|||
|
||||
if self.common.platform == "Windows":
|
||||
base_path = self.get_resource_path("tor")
|
||||
tor_path = os.path.join(base_path, "Tor", "tor.exe")
|
||||
obfs4proxy_file_path = os.path.join(base_path, "Tor", "obfs4proxy.exe")
|
||||
snowflake_file_path = os.path.join(base_path, "Tor", "snowflake-client.exe")
|
||||
meek_client_file_path = os.path.join(base_path, "Tor", "meek-client.exe")
|
||||
tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip")
|
||||
tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6")
|
||||
tor_path = os.path.join(base_path, "tor.exe")
|
||||
obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy.exe")
|
||||
snowflake_file_path = os.path.join(base_path, "snowflake-client.exe")
|
||||
meek_client_file_path = os.path.join(base_path, "meek-client.exe")
|
||||
tor_geo_ip_file_path = os.path.join(base_path, "geoip")
|
||||
tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
|
||||
elif self.common.platform == "Darwin":
|
||||
base_path = self.get_resource_path("tor")
|
||||
tor_path = os.path.join(base_path, "tor")
|
||||
|
@ -601,7 +601,9 @@ class ToggleCheckbox(QtWidgets.QCheckBox):
|
|||
x = (
|
||||
rect.width() - rect.x() - self.w + 20
|
||||
) # 20 is the padding between text and toggle
|
||||
y = self.height() / 2 - self.h / 2 + 16 # 16 is the padding top for the checkbox
|
||||
y = (
|
||||
self.height() / 2 - self.h / 2 + 16
|
||||
) # 16 is the padding top for the checkbox
|
||||
self.toggleRect = QtCore.QRect(x, y, self.w, self.h)
|
||||
painter.setBrush(QtGui.QColor(self.bg_color))
|
||||
painter.drawRoundedRect(x, y, self.w, self.h, self.h / 2, self.h / 2)
|
||||
|
|
|
@ -2,32 +2,24 @@
|
|||
import platform
|
||||
import inspect
|
||||
import os
|
||||
from re import M
|
||||
import sys
|
||||
import hashlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import requests
|
||||
|
||||
# Windows
|
||||
exe_url = (
|
||||
"https://dist.torproject.org/torbrowser/11.0.9/torbrowser-install-11.0.9_en-US.exe"
|
||||
)
|
||||
exe_filename = "torbrowser-install-11.0.9_en-US.exe"
|
||||
expected_exe_sha256 = "e938433028b6ffb5d312db6268b19e419626b071f08209684c8e5b9f3d3df2bc"
|
||||
torbrowser_version = "11.0.14"
|
||||
expected_exe_sha256 = "c14b979c81310ad039985e047dbb5b8058662bb3105b9022f7b9e0d18a29d0d6"
|
||||
expected_dmg_sha256 = "558ae5ab188f62feb04c6b2e7f43eae2361e8ec1718e0f4f927801411d911e22"
|
||||
expected_txz_sha256 = "b606924fdf8237e697cf95c229189da5875c190875d729769655c7b67aeb9aa6"
|
||||
|
||||
# macOS
|
||||
dmg_url = (
|
||||
"https://dist.torproject.org/torbrowser/11.0.9/TorBrowser-11.0.9-osx64_en-US.dmg"
|
||||
)
|
||||
dmg_filename = "TorBrowser-11.0.9-osx64_en-US.dmg"
|
||||
expected_dmg_sha256 = "e34629a178a92983924a5a89c7a988285d2d27f21832413a7f7e33af7871c8d6"
|
||||
|
||||
# Linux
|
||||
tarball_url = "https://dist.torproject.org/torbrowser/11.0.9/tor-browser-linux64-11.0.9_en-US.tar.xz"
|
||||
tarball_filename = "tor-browser-linux64-11.0.9_en-US.tar.xz"
|
||||
expected_tarball_sha256 = (
|
||||
"baa5ccafb5c68f1c46f9ae983b9b0a0419f66d41e0483ba5aacb3462fa0a8032"
|
||||
)
|
||||
exe_url = f"https://dist.torproject.org/torbrowser/{torbrowser_version}/torbrowser-install-{torbrowser_version}_en-US.exe"
|
||||
exe_filename = f"torbrowser-install-{torbrowser_version}_en-US.exe"
|
||||
dmg_url = f"https://dist.torproject.org/torbrowser/{torbrowser_version}/TorBrowser-{torbrowser_version}-osx64_en-US.dmg"
|
||||
dmg_filename = f"TorBrowser-{torbrowser_version}-osx64_en-US.dmg"
|
||||
tarball_url = f"https://dist.torproject.org/torbrowser/{torbrowser_version}/tor-browser-linux64-{torbrowser_version}_en-US.tar.xz"
|
||||
tarball_filename = f"tor-browser-linux64-{torbrowser_version}_en-US.tar.xz"
|
||||
|
||||
|
||||
# Common paths
|
||||
|
@ -53,6 +45,7 @@ def get_tor_windows():
|
|||
open(exe_path, "wb").write(r.content)
|
||||
exe_sha256 = hashlib.sha256(r.content).hexdigest()
|
||||
else:
|
||||
print("Already downloaded: {}".format(exe_path))
|
||||
exe_data = open(exe_path, "rb").read()
|
||||
exe_sha256 = hashlib.sha256(exe_data).hexdigest()
|
||||
|
||||
|
@ -89,10 +82,27 @@ def get_tor_windows():
|
|||
if os.path.exists(dist_path):
|
||||
shutil.rmtree(dist_path)
|
||||
os.makedirs(dist_path)
|
||||
shutil.copytree(os.path.join(working_path, "Tor"), os.path.join(dist_path, "Tor"))
|
||||
shutil.copytree(
|
||||
os.path.join(working_path, "Data"), os.path.join(dist_path, "Data", "Tor")
|
||||
)
|
||||
for filename in [
|
||||
"libcrypto-1_1.dll",
|
||||
"libevent-2-1-7.dll",
|
||||
"libevent_core-2-1-7.dll",
|
||||
"libevent_extra-2-1-7.dll",
|
||||
"libgcc_s_dw2-1.dll",
|
||||
"libssl-1_1.dll",
|
||||
"libssp-0.dll",
|
||||
"libwinpthread-1.dll",
|
||||
"tor.exe",
|
||||
"zlib1.dll",
|
||||
]:
|
||||
shutil.copyfile(
|
||||
os.path.join(working_path, "Tor", filename),
|
||||
os.path.join(dist_path, filename),
|
||||
)
|
||||
for filename in ["geoip", "geoip6"]:
|
||||
shutil.copyfile(
|
||||
os.path.join(working_path, "Data", filename),
|
||||
os.path.join(dist_path, filename),
|
||||
)
|
||||
|
||||
# Fetch the built-in bridges
|
||||
update_tor_bridges()
|
||||
|
@ -195,9 +205,9 @@ def get_tor_linux():
|
|||
tarball_sha256 = hashlib.sha256(tarball_data).hexdigest()
|
||||
|
||||
# Compare the hash
|
||||
if tarball_sha256 != expected_tarball_sha256:
|
||||
if tarball_sha256 != expected_txz_sha256:
|
||||
print("ERROR! The sha256 doesn't match:")
|
||||
print("expected: {}".format(expected_tarball_sha256))
|
||||
print("expected: {}".format(expected_txz_sha256))
|
||||
print(" actual: {}".format(tarball_sha256))
|
||||
sys.exit(-1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue