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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(signing): read the installer mark of a real build
purple1cbb5aec56ab
diff --git a/scripts/windows-signpath.mjs b/scripts/windows-signpath.mjsindex a9be3a01..59be8437 100644--- a/scripts/windows-signpath.mjs+++ b/scripts/windows-signpath.mjs@@ -68,12 +68,19 @@ export function patchBundleType(binary, variant) {return patched}-/** Which installer type a binary is marked for: "nsis", "msi", or null. */+/**+ * Which installer type a binary is marked for: "nsis", "msi", or null.+ *+ * A real build carries every ..._NSS and ..._MSI value once already, as the+ * literals the app compares its marker against. Marking overwrites the one+ * ..._UNK with a second copy of a value, so the marked type is the value that+ * occurs more often than the other, with no ..._UNK left.+ */export function bundleTypeOf(binary) {- for (const [variant, value] of Object.entries(VARIANTS)) {- if (offsetsOf(binary, value).length > 0) return variant- }- return null+ if (offsetsOf(binary, UNPATCHED).length > 0) return null+ const counts = Object.entries(VARIANTS).map(([variant, value]) => [variant, offsetsOf(binary, value).length])+ counts.sort((a, b) => b[1] - a[1])+ return counts[0][1] > counts[1][1] ? counts[0][0] : null}/**diff --git a/src/lib/__tests__/windows-signpath.test.ts b/src/lib/__tests__/windows-signpath.test.tsindex 62d7eb0c..8de703ca 100644--- a/src/lib/__tests__/windows-signpath.test.ts+++ b/src/lib/__tests__/windows-signpath.test.ts@@ -65,6 +65,15 @@ describe('the installer type marker', () => {expect(bundleTypeOf(UNPATCHED)).toBeNull()})+ it('reads the mark of a real build, which carries every value once as a literal', () => {+ // The app compares its marker against the NSS and MSI values, so both are+ // in every build. The first probe run on GitHub read each copy as "nsis".+ const real = fakeExe('__TAURI_BUNDLE_TYPE_VAR_NSS __TAURI_BUNDLE_TYPE_VAR_MSI code __TAURI_BUNDLE_TYPE_VAR_UNK end')+ expect(bundleTypeOf(real)).toBeNull()+ expect(bundleTypeOf(patchBundleType(real, 'nsis'))).toBe('nsis')+ expect(bundleTypeOf(patchBundleType(real, 'msi'))).toBe('msi')+ })+it('does not modify the buffer it was given', () => {const before = Buffer.from(UNPATCHED)patchBundleType(UNPATCHED, 'nsis')