Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

chore: use default nsis template

Minh14112053707a5083ef
diff --git a/.github/workflows/template-tauri-build-windows-x64.yml b/.github/workflows/template-tauri-build-windows-x64.yml
index 958b7c9f7..a074d2e56 100644
--- a/.github/workflows/template-tauri-build-windows-x64.yml
+++ b/.github/workflows/template-tauri-build-windows-x64.yml
@@ -95,8 +95,8 @@ jobs:
# Update tauri.conf.json
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = true' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
- jq '.bundle.windows.nsis.template = "tauri.bundle.windows.nsis.template"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
- mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
+ # jq '.bundle.windows.nsis.template = "tauri.bundle.windows.nsis.template"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
+ # mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
mv /tmp/package.json web-app/package.json
diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json
index 023c2a567..0af599f9a 100644
--- a/src-tauri/tauri.windows.conf.json
+++ b/src-tauri/tauri.windows.conf.json
@@ -4,10 +4,12 @@
"resources": ["resources/pre-install/**/*"],
"externalBin": ["resources/bin/bun", "resources/bin/uv"],
"windows": {
- "signCommand": "powershell -ExecutionPolicy Bypass -File ./sign.ps1 %1",
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
+ },
+ "nsis": {
+ "installerHooks": "./windows/hooks.nsh"
}
}
}
diff --git a/src-tauri/windows/hooks.nsh b/src-tauri/windows/hooks.nsh
new file mode 100644
index 000000000..a4801f040
--- /dev/null
+++ b/src-tauri/windows/hooks.nsh
@@ -0,0 +1,30 @@
+!macro NSIS_HOOK_POSTINSTALL
+ ; Check if Visual C++ 2019 Redistributable is installed (via Windows Registry)
+ ReadRegDWord $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
+
+ ${If} $0 == 1
+ DetailPrint "Visual C++ Redistributable already installed"
+ Goto vcredist_done
+ ${EndIf}
+
+ ; Install from bundled MSI if not installed
+ ${If} ${FileExists} "$INSTDIR\resources\vc_redist.x64.msi"
+ DetailPrint "Installing Visual C++ Redistributable..."
+ ; Copy to TEMP folder and then execute installer
+ CopyFiles "$INSTDIR\resources\vc_redist.x64.msi" "$TEMP\vc_redist.x64.msi"
+ ExecWait 'msiexec /i "$TEMP\vc_redist.x64.msi" /passive /norestart' $0
+
+ ; Check wether installation process exited successfully (code 0) or not
+ ${If} $0 == 0
+ DetailPrint "Visual C++ Redistributable installed successfully"
+ ${Else}
+ MessageBox MB_ICONEXCLAMATION "Visual C++ installation failed. Some features may not work."
+ ${EndIf}
+
+ ; Clean up setup files from TEMP and your installed app
+ Delete "$TEMP\vc_redist.x64.msi"
+ Delete "$INSTDIR\resources\vc_redist.x64.msi"
+ ${EndIf}
+
+ vcredist_done:
+!macroend
\ No newline at end of file