commit 7ca38d2f38f4bb904d7483c21d1ce5b4bf62f4c3 Author: Philipp Winter phw@nymity.ch Date: Thu Aug 1 22:04:32 2019 -0700
Fetch latest Tor Browser version from JSON.
This fixes https://bugs.torproject.org/31313. --- scripts/add_links_to_db | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/scripts/add_links_to_db b/scripts/add_links_to_db index 9891d43..c272e4e 100755 --- a/scripts/add_links_to_db +++ b/scripts/add_links_to_db @@ -10,10 +10,13 @@
import os import sys +import json import sqlite3 import argparse from urllib import request
+TOR_BROWSER_DOWNLOADS = "https://aus1.torproject.org/torbrowser/update_3/release/downloads.json" + def print_header(): header = """ __ __ @@ -53,9 +56,13 @@ def main(): args = parser.parse_args() abs_filename = os.path.abspath(args.filename)
- webFile = request.urlopen("https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions/") - versions = webFile.read().decode('utf-8').translate({ord(c): None for c in '[]\n" '}) - version = versions.split(",")[-12] + webFile = request.urlopen(TOR_BROWSER_DOWNLOADS) + content = webFile.read() + jsonObj = json.loads(content) + version = jsonObj.get("version", None) + if version is None: + print("Could not fetch version from {}.".format(TOR_BROWSER_DOWNLOADS)) + sys.exit(1)
providers = { "gitlab": "https://gitlab.com/thetorproject/gettorbrowser/raw/releases/",
tor-commits@lists.torproject.org