This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.2.0esr-12.0-2 in repository tor-browser.
commit 659fbc98b77a57a208e7b78fd31f482c3a9bb5db Author: Richard Pospesel richard@torproject.org AuthorDate: Mon Aug 1 17:56:45 2022 +0000
Bug 41089: Add tor-browser build scripts + Makefile to tor-browser --- .gitignore | 3 ++ tools/torbrowser/Makefile | 44 ++++++++++++++++++++++++++ tools/torbrowser/bridges.js | 77 +++++++++++++++++++++++++++++++++++++++++++++ tools/torbrowser/build.sh | 7 +++++ tools/torbrowser/clobber.sh | 6 ++++ tools/torbrowser/config.sh | 6 ++++ tools/torbrowser/deploy.sh | 23 ++++++++++++++ tools/torbrowser/fetch.sh | 30 ++++++++++++++++++ tools/torbrowser/ide.sh | 7 +++++ tools/torbrowser/jslint.sh | 7 +++++ 10 files changed, 210 insertions(+)
diff --git a/.gitignore b/.gitignore index b409ec583766d..b2b8b720c1787 100644 --- a/.gitignore +++ b/.gitignore @@ -193,3 +193,6 @@ config/external/icu4x # Ignore Storybook generated files browser/components/storybook/node_modules/ browser/components/storybook/storybook-static/ + +# Ignore binary base of tor browser +.binaries diff --git a/tools/torbrowser/Makefile b/tools/torbrowser/Makefile new file mode 100644 index 0000000000000..92650151560ec --- /dev/null +++ b/tools/torbrowser/Makefile @@ -0,0 +1,44 @@ +.DEFAULT_GOAL := all + +# https://stackoverflow.com/questions/18136918/how-to-get-current-relative-dir... +mkfile_path := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +DEV_ROOT = $(mkfile_path)/../.. +BINARIES = $(DEV_ROOT)/.binaries +BUILD_OUTPUT = $(DEV_ROOT)/obj-x86_64-pc-linux-gnu + +config: + ./config.sh $(DEV_ROOT) + +ide-vscode: + ./ide.sh vscode $(DEV_ROOT) + +ide-eclipse: + ./ide.sh eclipse $(DEV_ROOT) + +ide-visualstudio: + ./ide.sh visualstudio $(DEV_ROOT) + +fetch: + ./fetch.sh $(BINARIES) + +build: + ./build.sh $(DEV_ROOT) + +deploy: + ./deploy.sh $(BINARIES) $(BUILD_OUTPUT) + +all: build deploy + +run: + $(BINARIES)/dev/Browser/start-tor-browser -v + +jslint: + ./jslint.sh $(DEV_ROOT) $(JS) + +clobber: + ./clobber.sh $(DEV_ROOT) + +clean: + rm -rf $(BUILD_OUTPUT) + diff --git a/tools/torbrowser/bridges.js b/tools/torbrowser/bridges.js new file mode 100644 index 0000000000000..e8f11a36c401d --- /dev/null +++ b/tools/torbrowser/bridges.js @@ -0,0 +1,77 @@ +pref("extensions.torlauncher.default_bridge_recommended_type", "obfs4"); + +// Default bridges. +pref( + "extensions.torlauncher.default_bridge.obfs4.1", + "obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.2", + "obfs4 38.229.1.78:80 C8CBDB2464FC9804A69531437BCF2BE31FDD2EE4 cert=Hmyfd2ev46gGY7NoVxA9ngrPF2zCZtzskRTzoWXbxNkzeVnGFPWmrTtILRyqCTjHR+s9dg iat-mode=1" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.3", + "obfs4 38.229.33.83:80 0BAC39417268B96B9F514E7F63FA6FBA1A788955 cert=VwEFpk9F/UN9JED7XpG1XOjm/O8ZCXK80oPecgWnNDZDv5pdkhq1OpbAH0wNqOT6H6BmRQ iat-mode=1" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.4", + "obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.5", + "obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.6", + "obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.7", + "obfs4 144.217.20.138:80 FB70B257C162BF1038CA669D568D76F5B7F0BABB cert=vYIV5MgrghGQvZPIi1tJwnzorMgqgmlKaB77Y3Z9Q/v94wZBOAXkW+fdx4aSxLVnKO+xNw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.8", + "obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.9", + "obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.10", + "obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.11", + "obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.12", + "obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.13", + "obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.14", + "obfs4 [2a0c:4d80:42:702::1]:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.15", + "obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0" +); +pref( + "extensions.torlauncher.default_bridge.obfs4.16", + "obfs4 185.100.87.30:443 5B403DFE34F4872EB027059CECAE30B0C864B3A2 cert=bWUdFUe8io9U6JkSLoGAvSAUDcB779/shovCYmYAQb/pW/iEAMZtO/lCd94OokOF909TPA iat-mode=2" +); + +pref( + "extensions.torlauncher.default_bridge.meek-azure.1", + "meek_lite 192.0.2.2:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com" +); + +pref( + "extensions.torlauncher.default_bridge.snowflake.1", + "snowflake 192.0.2.3:1 2B280B23E1107BB62ABFC40DDCC8824814F80A72" +); diff --git a/tools/torbrowser/build.sh b/tools/torbrowser/build.sh new file mode 100755 index 0000000000000..e53dbc5000bc7 --- /dev/null +++ b/tools/torbrowser/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +DEV_ROOT=$1 + +cd $DEV_ROOT +./mach build +./mach build stage-package diff --git a/tools/torbrowser/clobber.sh b/tools/torbrowser/clobber.sh new file mode 100755 index 0000000000000..5073454b23c10 --- /dev/null +++ b/tools/torbrowser/clobber.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +DEV_ROOT=$1 + +cd $DEV_ROOT +./mach clobber diff --git a/tools/torbrowser/config.sh b/tools/torbrowser/config.sh new file mode 100755 index 0000000000000..d353119613792 --- /dev/null +++ b/tools/torbrowser/config.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +DEV_ROOT=$1 + +cd $DEV_ROOT +./mach configure diff --git a/tools/torbrowser/deploy.sh b/tools/torbrowser/deploy.sh new file mode 100755 index 0000000000000..9f2ebd58cbe3a --- /dev/null +++ b/tools/torbrowser/deploy.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e +BINARIES=$1 +BUILD_OUTPUT=$2 + +SCRIPT_DIR=$(realpath "$(dirname "$0")") + +# Add built-in bridges +mkdir -p $BUILD_OUTPUT/_omni/defaults/preferences +cat $BUILD_OUTPUT/dist/bin/browser/defaults/preferences/000-tor-browser.js $SCRIPT_DIR/bridges.js >> $BUILD_OUTPUT/_omni/defaults/preferences/000-tor-browser.js +cd $BUILD_OUTPUT/_omni && zip -Xmr $BUILD_OUTPUT/dist/firefox/browser/omni.ja defaults/preferences/000-tor-browser.js +rm -rf $BUILD_OUTPUT/_omni + +# Repackage the manual +# rm -rf $BUILD_OUTPUT/_omni +# mkdir $BUILD_OUTPUT/_omni +# unzip $BINARIES/dev/Browser/browser/omni.ja -d $BUILD_OUTPUT/_omni +# cd $BUILD_OUTPUT/_omni && zip -Xmr $BUILD_OUTPUT/dist/firefox/browser/omni.ja chrome/browser/content/browser/manual +# rm -rf $BUILD_OUTPUT/_omni + +# copy binaries +cp -r $BUILD_OUTPUT/dist/firefox/* $BINARIES/dev/Browser +rm -rf $BINARIES/dev/Browser/TorBrowser/Data/Browser/profile.default/startupCache diff --git a/tools/torbrowser/fetch.sh b/tools/torbrowser/fetch.sh new file mode 100755 index 0000000000000..5b5c627c0c343 --- /dev/null +++ b/tools/torbrowser/fetch.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -e + +BINARIES_DIR=$1 + +# download the current downloads.json +wget https://aus1.torproject.org/torbrowser/update_3/alpha/downloads.json +# get url for latest alpha linux en_US package +TOR_BROWSER_VERSION=$(grep -Eo ""version":"[0-9.a]+"" downloads.json | grep -Eo "[0-9.a]+") +TOR_BROWSER_PACKAGE="tor-browser-linux64-${TOR_BROWSER_VERSION}_en-US.tar.xz" +TOR_BROWSER_PACKAGE_URL="https://dist.torproject.org/torbrowser/$%7BTOR_BROWSER_VERSION%7D/$%7BTOR_BR..." + +# remove download manifest +rm downloads.json + +# clear out previous tor-browser and previous package +rm -rf "${BINARIES_DIR}/dev" +rm -f "${TOR_BROWSER_PACKAGE}" + +# download +rm -f "${TOR_BROWSER_PACKAGE}" +wget "${TOR_BROWSER_PACKAGE_URL}" +mkdir -p "${BINARIES_DIR}" + +# and extract +tar -xf ${TOR_BROWSER_PACKAGE} -C "${BINARIES_DIR}" +mv "${BINARIES_DIR}/tor-browser_en-US" "${BINARIES_DIR}/dev" + +# cleanup +rm -f "${TOR_BROWSER_PACKAGE}" diff --git a/tools/torbrowser/ide.sh b/tools/torbrowser/ide.sh new file mode 100755 index 0000000000000..5da0c670d8c5b --- /dev/null +++ b/tools/torbrowser/ide.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +IDE=$1 +DEV_ROOT=$2 + +cd $DEV_ROOT +./mach ide $IDE diff --git a/tools/torbrowser/jslint.sh b/tools/torbrowser/jslint.sh new file mode 100755 index 0000000000000..be1016275c289 --- /dev/null +++ b/tools/torbrowser/jslint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +DEV_ROOT=$1 +JS_FILE=$2 + +cd $DEV_ROOT +./mach lint -l eslint --fix $JS_FILE