Skip to content
TypeScript

fix(desktop): stop unsolicited Messages code autofill (#19118)

Wout Stiens380bba368a90
diff --git a/apps/desktop/scripts/electron-launcher.mjs b/apps/desktop/scripts/electron-launcher.mjs
index 48f66ab76b5..b355650f841 100644
--- a/apps/desktop/scripts/electron-launcher.mjs
+++ b/apps/desktop/scripts/electron-launcher.mjs
@@ -20,7 +20,7 @@ const APP_BUNDLE_ID = isDevelopment
? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}`
: "com.t3tools.t3code";
const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"];
-const LAUNCHER_VERSION = 19;
+const LAUNCHER_VERSION = 20;
const developmentMacIconPngPath = NodePath.join(
repoRoot,
"assets",
@@ -280,6 +280,8 @@ function patchMainBundleInfoPlist(appBundlePath, iconPath, executableName) {
for (const [key, value] of Object.entries(resolveMacBundleInfoPlistStrings(executableName))) {
setPlistString(infoPlistPath, key, value);
}
+ // macOS 26 offers Messages/Mail codes in every text field unless opted out.
+ setPlistJson(infoPlistPath, "NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac", true);
setPlistJson(infoPlistPath, "CFBundleURLTypes", [
{
CFBundleURLName: APP_BUNDLE_ID,
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 2d86a9c89d5..0ec6f72eb56 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -726,6 +726,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
]);
// macOS lists a default browser only when it also opens web pages as documents.
const macInfo = (mac.mac as { extendInfo: Record<string, unknown> }).extendInfo;
+ assert.strictEqual(macInfo.NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac, true);
assert.deepStrictEqual(macInfo.CFBundleDocumentTypes, [
{
CFBundleTypeName: "Web page",
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 618aec4d6bb..5dd431bc4d9 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -2821,6 +2821,8 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
icon: "icon.icns",
category: "public.app-category.developer-tools",
extendInfo: {
+ // macOS 26 offers Messages/Mail codes in every text field unless opted out.
+ NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac: true,
NSLocalNetworkUsageDescription:
"T3 Code connects to devices on your local network for remote environments and commands run by terminals and coding agents.",
NSScreenCaptureUsageDescription: