mirror of
https://github.com/onionshare/onionshare.git
synced 2025-04-29 14:19:30 -04:00
Update get-tor.py script to use platform-specific json files
This commit is contained in:
parent
fe65b97656
commit
c420f4c0aa
2 changed files with 8 additions and 8 deletions
|
@ -39,7 +39,7 @@ poetry install
|
||||||
- Download and install [7-Zip (x64)](https://7-zip.org/). Add `C:\Program Files\7-Zip` to your path.
|
- Download and install [7-Zip (x64)](https://7-zip.org/). Add `C:\Program Files\7-Zip` to your path.
|
||||||
- Download and install [gpg4win](https://gpg4win.org/). Add `C:\Program Files (x86)\GnuPG\bin` to your path.
|
- Download and install [gpg4win](https://gpg4win.org/). Add `C:\Program Files (x86)\GnuPG\bin` to your path.
|
||||||
|
|
||||||
Download Tor Browser and extract the binaries for your platform. The platform must be `win64`, `macos`, or `linux-x86_64`.
|
Download Tor Browser and extract the binaries for your platform. The platform must be `windows-x86_64`, `macos`, or `linux-x86_64`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
poetry run python ./scripts/get-tor.py [platform]
|
poetry run python ./scripts/get-tor.py [platform]
|
||||||
|
|
|
@ -12,7 +12,7 @@ import tempfile
|
||||||
import gnupg
|
import gnupg
|
||||||
|
|
||||||
torbrowser_latest_url = (
|
torbrowser_latest_url = (
|
||||||
"https://aus1.torproject.org/torbrowser/update_3/release/downloads.json"
|
"https://aus1.torproject.org/torbrowser/update_3/release"
|
||||||
)
|
)
|
||||||
tor_dev_fingerprint = "EF6E286DDA85EA2A4BA7DE684E2C6E8793298290"
|
tor_dev_fingerprint = "EF6E286DDA85EA2A4BA7DE684E2C6E8793298290"
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ working_path = os.path.join(root_path, "build", "tor")
|
||||||
|
|
||||||
|
|
||||||
def get_latest_tor_version_urls(platform):
|
def get_latest_tor_version_urls(platform):
|
||||||
r = requests.get(torbrowser_latest_url)
|
r = requests.get(f"{torbrowser_latest_url}/download-{platform}.json")
|
||||||
if r.status_code != 200 or platform not in r.json()["downloads"]:
|
if r.status_code != 200:
|
||||||
print("Tor browser latest version url not working")
|
print("Tor browser latest version url not working")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
platform_url = r.json()["downloads"][platform]["ALL"]["binary"]
|
platform_url = r.json()["binary"]
|
||||||
platform_sig_url = r.json()["downloads"][platform]["ALL"]["sig"]
|
platform_sig_url = r.json()["sig"]
|
||||||
platform_filename = platform_url.split("/")[-1]
|
platform_filename = platform_url.split("/")[-1]
|
||||||
|
|
||||||
return platform_url, platform_filename, platform_sig_url
|
return platform_url, platform_filename, platform_sig_url
|
||||||
|
@ -320,7 +320,7 @@ def main(platform):
|
||||||
"""
|
"""
|
||||||
Download Tor Browser and extract tor binaries
|
Download Tor Browser and extract tor binaries
|
||||||
"""
|
"""
|
||||||
valid_platforms = ["win64", "macos", "linux-x86_64"]
|
valid_platforms = ["windows-x86_64", "macos", "linux-x86_64"]
|
||||||
if platform not in valid_platforms:
|
if platform not in valid_platforms:
|
||||||
click.echo(f"platform must be one of: {valid_platforms}")
|
click.echo(f"platform must be one of: {valid_platforms}")
|
||||||
return
|
return
|
||||||
|
@ -337,7 +337,7 @@ def main(platform):
|
||||||
)
|
)
|
||||||
print(f"Imported Tor GPG key: {torkey.fingerprints}")
|
print(f"Imported Tor GPG key: {torkey.fingerprints}")
|
||||||
|
|
||||||
if platform == "win64":
|
if platform == "windows-x86_64":
|
||||||
get_tor_windows(
|
get_tor_windows(
|
||||||
gpg, torkey, platform_url, platform_filename, expected_platform_sig
|
gpg, torkey, platform_url, platform_filename, expected_platform_sig
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue