From 747db01cb5a0bbce950c4810880cd14ce9db21c2 Mon Sep 17 00:00:00 2001 From: idk Date: Sat, 6 Mar 2021 18:42:17 +0000 Subject: [PATCH] App-ify the routerconsole.browser script by stripping away browser UI elements from the underlying firefox. This effectively separates the profile used to browse I2P and the profile used to configure I2P, and reconfigures the "Configuration Profile" to more closely imitate an application UI by hiding the nav bar, back bar, and other potentially confusing elements --- Makefile | 42 ++++++++++++++++++++++++-- src/nsis/i2pbrowser-installer.nsi | 49 +++++++++++++++++++++++++++++-- src/profile/prefs.js | 2 ++ 3 files changed, 88 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 265feca..8b36450 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: profile.tgz install.exe +all: profile.tgz app-profile.tgz install.exe install.exe: profile build/licenses cp src/nsis/*.nsi build @@ -18,8 +18,7 @@ build/licenses: build unix2dos build/licenses/LICENSE.index clean: - rm -rf build profile-*.tgz I2P-Profile-Installer-*.exe - + rm -rf build app-profile-*.tgz profile-*.tgz I2P-Profile-Installer-*.exe build: @echo "creating build directory" @@ -50,6 +49,33 @@ copy-xpi: build/NoScript.xpi build/HTTPSEverywhere.xpi build/i2ppb@eyedeekay.git cp build/HTTPSEverywhere.xpi "build/profile/extensions/https-everywhere-eff@eff.org.xpi" cp build/i2ppb@eyedeekay.github.io.xpi build/profile/extensions/i2ppb@eyedeekay.github.io.xpi +app-profile: build/app-profile/user.js build/app-profile/prefs.js build/app-profile/chrome/userChrome.css build/app-profile/bookmarks.html build/app-profile/storage-sync.sqlite copy-app-xpi + +app-profile.tgz: app-profile + $(eval PROFILE_VERSION := $(shell cat src/app-profile/version.txt)) + @echo "building app-profile tarball $(PROFILE_VERSION)" + install -m755 src/unix/i2pbrowser.sh build/app-profile/i2pbrowser.sh + cd build && tar -czf app-profile-$(PROFILE_VERSION).tgz app-profile && cp app-profile-$(PROFILE_VERSION).tgz ../ + +build/app-profile/user.js: build/app-profile src/app-profile/user.js + cp src/app-profile/user.js build/app-profile/user.js + +build/app-profile/prefs.js: build/app-profile src/app-profile/prefs.js + cp src/app-profile/prefs.js build/app-profile/prefs.js + +build/app-profile/chrome/userChrome.css: build/app-profile/chrome src/app-profile/chrome/userChrome.css + cp src/app-profile/chrome/userChrome.css build/app-profile/chrome/userChrome.css + +build/app-profile/bookmarks.html: build/app-profile src/app-profile/bookmarks.html + cp src/app-profile/bookmarks.html build/app-profile/bookmarks.html + +build/app-profile/storage-sync.sqlite: build/app-profile src/app-profile/storage-sync.sqlite + cp src/app-profile/storage-sync.sqlite build/app-profile/storage-sync.sqlite + +copy-app-xpi: build/NoScript.xpi build/HTTPSEverywhere.xpi build/i2ppb@eyedeekay.github.io.xpi build/app-profile/extensions + cp build/HTTPSEverywhere.xpi "build/app-profile/extensions/https-everywhere-eff@eff.org.xpi" + cp build/i2ppb@eyedeekay.github.io.xpi build/app-profile/extensions/i2ppb@eyedeekay.github.io.xpi + build/i2ppb@eyedeekay.github.io.xpi: curl -L `cat i2psetproxy.url` > build/i2ppb@eyedeekay.github.io.xpi @@ -64,3 +90,13 @@ build/profile/extensions: build/profile build/profile: build mkdir -p build/profile + + +build/app-profile/chrome: build/app-profile + mkdir -p build/app-profile/chrome + +build/app-profile/extensions: build/app-profile + mkdir -p build/app-profile/extensions + +build/app-profile: build + mkdir -p build/app-profile diff --git a/src/nsis/i2pbrowser-installer.nsi b/src/nsis/i2pbrowser-installer.nsi index 7eb1105..97364d0 100644 --- a/src/nsis/i2pbrowser-installer.nsi +++ b/src/nsis/i2pbrowser-installer.nsi @@ -13,9 +13,11 @@ !include i2pbrowser-version.nsi var FFINSTEXE +var FFNONTORINSTEXE var I2PINSTEXE !define FFINSTEXE +!define FFNONTORINSTEXE !define FFINSTEXE32 "$PROGRAMFILES32\Mozilla Firefox\" !define FFINSTEXE64 "$PROGRAMFILES64\Mozilla Firefox\" @@ -125,6 +127,7 @@ PageExEnd PageEx directory dirtext "${FIREFOX_MESSAGE}" dirvar $FFINSTEXE + dirvar $FFNONTORINSTEXE PageCallbacks firefoxDetect PageExEnd PageEx directory @@ -143,8 +146,10 @@ Function .onInit ${If} $0 == 1 ${If} ${FileExists} "${FFINSTEXE64}/firefox.exe" StrCpy $FFINSTEXE "${FFINSTEXE64}" + StrCpy $FFNONTORINSTEXE "${FFINSTEXE64}" ${ElseIf} ${FileExists} "${FFINSTEXE32}/firefox.exe" - StrCpy $FFINSTEXE "${FFINSTEXE32}" + StrCpy $FFINSTEXE "${FFINSTEXE32}" + StrCpy $FFNONTORINSTEXE "${FFINSTEXE32}" ${EndIf} ${If} ${FileExists} "$PROFILE/OneDrive/Desktop/Tor Browser/Browser/firefox.exe" StrCpy $FFINSTEXE "$PROFILE/OneDrive/Desktop/Tor Browser/Browser/" @@ -155,6 +160,7 @@ Function .onInit ${Else} ${If} ${FileExists} "${FFINSTEXE32}/firefox.exe" StrCpy $FFINSTEXE "${FFINSTEXE32}" + StrCpy $FFNONTORINSTEXE "${FFINSTEXE32}" ${EndIf} ${If} ${FileExists} "$PROFILE/OneDrive/Desktop/Tor Browser/Browser/firefox.exe" StrCpy $FFINSTEXE "$PROFILE/OneDrive/Desktop/Tor Browser/Browser/" @@ -218,6 +224,22 @@ Section Install FileWriteByte $0 "10" FileClose $0 + + # Install the launcher scripts: This will need to be it's own section, since + # now I think we just need to let the user select if the user is using a non + # default Firefox path. + FileOpen $0 "$INSTDIR\i2pconfig.bat" w + FileWrite $0 "@echo off" + FileWriteByte $0 "13" + FileWriteByte $0 "10" + FileWrite $0 'start "" "$FFNONTORINSTEXE\firefox.exe" -no-remote -profile "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p" -url %1' + FileWriteByte $0 "13" + FileWriteByte $0 "10" + FileWrite $0 exit + FileWriteByte $0 "13" + FileWriteByte $0 "10" + FileClose $0 + # Install the licenses createDirectory "$INSTDIR\licenses" SetOutPath "$INSTDIR\licenses" @@ -238,6 +260,20 @@ Section Install File profile/extensions/https-everywhere-eff@eff.org.xpi File profile/extensions/i2ppb@eyedeekay.github.io.xpi + # Install the config profile + createDirectory "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p" + SetOutPath "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p" + File app-profile/user.js + File app-profile/prefs.js + File app-profile/bookmarks.html + File app-profile/storage-sync.sqlite + + # Install the config extensions + createDirectory "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\extensions" + SetOutPath "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\extensions" + File profile/extensions/https-everywhere-eff@eff.org.xpi + File profile/extensions/i2ppb@eyedeekay.github.io.xpi + SetOutPath "$INSTDIR" createDirectory "$SMPROGRAMS\${APPNAME}" CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "C:\Windows\system32\cmd.exe" "/c $\"$INSTDIR\i2pbrowser.bat$\" ${CONSOLE_URL}" "$INSTDIR\ui2pbrowser_icon.ico" @@ -259,7 +295,7 @@ Section Install FileSeek $0 0 END FileWriteByte $0 "13" FileWriteByte $0 "10" - FileWrite $0 "routerconsole.browser=$\"$INSTDIR\i2pbrowser.bat$\"" + FileWrite $0 "routerconsole.browser=$\"$INSTDIR\i2pconfig.bat$\"" FileWriteByte $0 "13" FileWriteByte $0 "10" FileClose $0 @@ -281,6 +317,7 @@ Section "uninstall" # Uninstall the launcher scripts Delete $INSTDIR\i2pbrowser.bat + Delete $INSTDIR\i2pconfig.bat Delete $INSTDIR\i2pbrowser-private.bat Delete $INSTDIR\ui2pbrowser_icon.ico @@ -290,11 +327,19 @@ Section "uninstall" Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.i2p\bookmarks.html Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.i2p\storage-sync.sqlite + Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\prefs.js + Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\user.js + Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\bookmarks.html + Delete $LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\storage-sync.sqlite + # Uninstall the extensions Delete "$LOCALAPPDATA\${APPNAME}\firefox.profile.i2p\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi" Delete "$LOCALAPPDATA\${APPNAME}\firefox.profile.i2p\extensions\https-everywhere-eff@eff.org.xpi" Delete "$LOCALAPPDATA\${APPNAME}\firefox.profile.i2p\extensions\i2ppb@eyedeekay.github.io.xpi" + Delete "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\extensions\https-everywhere-eff@eff.org.xpi" + Delete "$LOCALAPPDATA\${APPNAME}\firefox.profile.config.i2p\extensions\i2ppb@eyedeekay.github.io.xpi" + # Remove shortcuts and folders Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" Delete "$SMPROGRAMS\${APPNAME}\Private Browsing-${APPNAME}.lnk" diff --git a/src/profile/prefs.js b/src/profile/prefs.js index b4af9b9..62c8239 100644 --- a/src/profile/prefs.js +++ b/src/profile/prefs.js @@ -43,3 +43,5 @@ user_pref("dom.security.https_only_mode", false); user_pref("keyword.enabled", false); user_pref("extensions.allowPrivateBrowsingByDefault", true); user_pref("extensions.PrivateBrowsing.notification", false); + +