From 6a9b710b185bf7dc58d13a03ded5a9fc846e0e87 Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Fri, 3 Apr 2026 22:21:38 -0700 Subject: [PATCH] Restore NSIS bootstrap installer page Co-Authored-By: Claude Opus 4.6 --- contrib/nsis/setup.nsi | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/contrib/nsis/setup.nsi b/contrib/nsis/setup.nsi index 51ded57..fc24283 100644 --- a/contrib/nsis/setup.nsi +++ b/contrib/nsis/setup.nsi @@ -32,6 +32,9 @@ RequestExecutionLevel user !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY +; Bootstrap page +Page custom BootstrapPage + !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH @@ -40,6 +43,34 @@ RequestExecutionLevel user !insertmacro MUI_LANGUAGE "English" +; Bootstrap selection variable +Var BootstrapChoice + +; Bootstrap page function +Function BootstrapPage + !insertmacro MUI_HEADER_TEXT "Blockchain Sync" "Choose how to synchronize the blockchain" + + nsDialogs::Create 1018 + Pop $0 + + ${NSD_CreateLabel} 0 10u 100% 20u "The Triangles blockchain requires ~1GB of data. Choose sync method:" + Pop $0 + + ${NSD_CreateRadioButton} 10u 40u 100% 12u "Download bootstrap (~1.3GB) — Recommended (fast)" + Pop $1 + ${NSD_Check} $1 + + ${NSD_CreateRadioButton} 10u 60u 100% 12u "Sync from network — Slow (may take days)" + Pop $2 + + ${NSD_CreateLabel} 10u 80u 100% 30u "Bootstrap will download a recent blockchain snapshot, saving hours or days of sync time. Network bandwidth required: ~1.3GB." + Pop $0 + + nsDialogs::Show + + ${NSD_GetState} $1 $BootstrapChoice +FunctionEnd + Section "Install" SetOutPath "$INSTDIR" @@ -53,6 +84,25 @@ Section "Install" ; Create data directory CreateDirectory "$APPDATA\Triangles" + ; Download blockchain bootstrap if selected + ${If} $BootstrapChoice == ${BST_CHECKED} + DetailPrint "Downloading blockchain bootstrap..." + inetc::get /CAPTION "Downloading Blockchain" /CANCELTEXT "Skip" \ + "http://bootstrap.cryptographic-triangles.org/tri-blockchain.tar.gz" \ + "$TEMP\tri-blockchain.tar.gz" /END + Pop $0 + ${If} $0 == "OK" + DetailPrint "Extracting blockchain..." + nsExec::ExecToLog '"$INSTDIR\7z.exe" x "$TEMP\tri-blockchain.tar.gz" -o"$TEMP" -y' + nsExec::ExecToLog '"$INSTDIR\7z.exe" x "$TEMP\tri-blockchain.tar" -o"$APPDATA\Triangles" -y' + Delete "$TEMP\tri-blockchain.tar.gz" + Delete "$TEMP\tri-blockchain.tar" + DetailPrint "Blockchain bootstrap installed!" + ${Else} + DetailPrint "Bootstrap download failed or skipped — will sync from network" + ${EndIf} + ${EndIf} + ; Uninstaller WriteUninstaller "$INSTDIR\uninstall.exe"