Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

chore(release): lock the update path across renames + win32 test fix

purpled549e7aa7ce9
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index fa2a500a..98e49f97 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -64,12 +64,16 @@
"entitlements": "./Entitlements.plist"
},
"windows": {
+ "wix": {
+ "upgradeCode": "a32db5c6-2c3c-5e92-a20a-2464954554f9"
+ },
"nsis": {
"installMode": "both",
"displayLanguageSelector": true,
"installerIcon": "icons/icon.ico",
"headerImage": "icons/nsis-header.bmp",
- "sidebarImage": "icons/nsis-sidebar.bmp"
+ "sidebarImage": "icons/nsis-sidebar.bmp",
+ "installerHooks": "./windows/installer-hooks.nsh"
}
},
"linux": {
diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json
new file mode 100644
index 00000000..b9663567
--- /dev/null
+++ b/src-tauri/tauri.linux.conf.json
@@ -0,0 +1,4 @@
+{
+ "$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
+ "productName": "Locally Uncensored"
+}
diff --git a/src-tauri/windows/installer-hooks.nsh b/src-tauri/windows/installer-hooks.nsh
new file mode 100644
index 00000000..43c439b4
--- /dev/null
+++ b/src-tauri/windows/installer-hooks.nsh
@@ -0,0 +1,104 @@
+; Guard rail for a Windows productName change, dormant today.
+;
+; tauri.windows.conf.json deliberately pins productName to "Locally Uncensored"
+; (only the window title says "LU") because the stock NSIS template discovers a
+; previous install ONLY under the CURRENT product name's registry key. If a
+; future release ever ships a different Windows productName without migration,
+; every updating user ends up with TWO entries in Apps & Features and stale
+; shortcuts that keep launching the old build (which re-offers the update,
+; forever). The 2.5.7 rebrand nearly did exactly that.
+;
+; The !if below compiles this hook away while the name is unchanged. The moment
+; a build uses a new productName, the hook turns live: it finds the old-name
+; install and removes it silently before the new files land. The old
+; uninstaller only deletes app data when its confirm-page checkbox is ticked -
+; that page never shows in silent mode - so chats, settings, and models under
+; the com.purpledoubled.locally-uncensored app-data folders survive untouched
+; (the bundle identifier must never change).
+
+!macro LU_REMOVE_OLD_NSIS ROOT
+ ClearErrors
+ ReadRegStr $R7 ${ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\Locally Uncensored" "UninstallString"
+ ReadRegStr $R8 ${ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\Locally Uncensored" "InstallLocation"
+ ${If} $R7 != ""
+ ; both values are written quoted by the old installer - strip the quotes
+ StrCpy $R9 $R7 1
+ ${If} $R9 == '"'
+ StrCpy $R7 $R7 "" 1
+ StrCpy $R9 $R7 1 -1
+ ${If} $R9 == '"'
+ StrCpy $R7 $R7 -1
+ ${EndIf}
+ ${EndIf}
+ StrCpy $R9 $R8 1
+ ${If} $R9 == '"'
+ StrCpy $R8 $R8 "" 1
+ StrCpy $R9 $R8 1 -1
+ ${If} $R9 == '"'
+ StrCpy $R8 $R8 -1
+ ${EndIf}
+ ${EndIf}
+
+ ; the old app can still be running (manual installs while 2.5.6 is open);
+ ; stop it and its children (sidecars) so no file stays locked. Older
+ ; releases shipped the exe under the cargo name, newer ones under the
+ ; product name - kill both spellings.
+ nsExec::Exec '"$SYSDIR\taskkill.exe" /F /T /IM "locally-uncensored.exe"'
+ Pop $R9
+ nsExec::Exec '"$SYSDIR\taskkill.exe" /F /T /IM "Locally Uncensored.exe"'
+ Pop $R9
+
+ ${If} ${FileExists} "$R7"
+ ${If} $R8 != ""
+ ; _?= keeps the uninstaller running in place so ExecWait really waits;
+ ; it then can't delete itself, so we sweep the leftovers ourselves
+ ExecWait '"$R7" /S _?=$R8' $R9
+ Delete "$R7"
+ ; only remove the folder when it really is the old install dir
+ StrCpy $R9 $R8 "" -18
+ ${If} $R9 == "Locally Uncensored"
+ RMDir /r "$R8"
+ ${EndIf}
+ ${Else}
+ ; no recorded location: let it uninstall from its temp copy
+ ExecWait '"$R7" /S' $R9
+ Sleep 2000
+ ${EndIf}
+ ${EndIf}
+
+ ; belt and braces - harmless when the uninstaller already cleaned these
+ DeleteRegKey ${ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\Locally Uncensored"
+ DeleteRegKey ${ROOT} "Software\PurpleDoubleD\Locally Uncensored"
+ DeleteRegKey /ifempty ${ROOT} "Software\PurpleDoubleD"
+ ${EndIf}
+!macroend
+
+!macro NSIS_HOOK_PREINSTALL
+!if "${PRODUCTNAME}" != "Locally Uncensored"
+ !insertmacro LU_REMOVE_OLD_NSIS HKCU
+ !insertmacro LU_REMOVE_OLD_NSIS HKLM
+
+ ; orphaned shortcuts of the old name in the active shell context (the old
+ ; uninstaller removes its own; this only catches leftovers)
+ Delete "$DESKTOP\Locally Uncensored.lnk"
+ Delete "$SMPROGRAMS\Locally Uncensored.lnk"
+
+ ; an old per-machine MSI (WiX) install lives under a {GUID} key; match it by
+ ; display name + publisher and remove it quietly. Best effort: without
+ ; elevation msiexec fails and we are simply no worse off than before.
+ StrCpy $R5 0
+ lu_wix_scan:
+ EnumRegKey $R6 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" $R5
+ StrCmp $R6 "" lu_wix_done
+ IntOp $R5 $R5 + 1
+ StrCpy $R9 $R6 1
+ StrCmp $R9 "{" 0 lu_wix_scan
+ ReadRegStr $R7 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$R6" "DisplayName"
+ ReadRegStr $R8 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$R6" "Publisher"
+ StrCmp "$R7$R8" "Locally UncensoredPurpleDoubleD" 0 lu_wix_scan
+ nsExec::Exec '"$SYSDIR\msiexec.exe" /x $R6 /qn'
+ Pop $R9
+ Goto lu_wix_scan
+ lu_wix_done:
+!endif
+!macroend
diff --git a/src/api/__tests__/build-llama-script.test.ts b/src/api/__tests__/build-llama-script.test.ts
index 8ee3bc9b..400840ca 100644
--- a/src/api/__tests__/build-llama-script.test.ts
+++ b/src/api/__tests__/build-llama-script.test.ts
@@ -24,8 +24,17 @@ function callFn(fn: string, ...args: string[]): { code: number; out: string } {
describe('build-llama.sh', () => {
it('exists and is executable', () => {
expect(existsSync(SCRIPT)).toBe(true)
- // owner-executable bit set
- expect(statSync(SCRIPT).mode & 0o100).toBeTruthy()
+ // owner-executable bit set - checked via the git index on Windows, where
+ // NTFS has no unix mode bits (node only synthesizes X for .exe/.bat/.cmd)
+ if (process.platform === 'win32') {
+ const mode = execFileSync('git', ['ls-files', '-s', 'scripts/build-llama.sh'], {
+ cwd: resolve(__dirname, '../../..'),
+ encoding: 'utf8',
+ }).split(' ')[0]
+ expect(mode).toBe('100755')
+ } else {
+ expect(statSync(SCRIPT).mode & 0o100).toBeTruthy()
+ }
})
it('emits Metal + embedded-library flags for both mac triples', () => {