Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: calendar infinite loop

Chadpihae140a358de23
diff --git a/src/helpers/policyValidation.js b/src/helpers/policyValidation.js
index 524f9063c..418d16c6d 100644
--- a/src/helpers/policyValidation.js
+++ b/src/helpers/policyValidation.js
@@ -10,9 +10,11 @@ const POLICY_SCOPES = ["transcription", "llm"];
const TRANSCRIPTION_MODES = new Set(["openwhispr", "providers", "local", "self-hosted"]);
const LLM_MODES = new Set([...TRANSCRIPTION_MODES, "enterprise"]);
const TRANSCRIPTION_PROVIDERS = new Set(
- modelRegistryData.transcriptionProviders.map((provider) => provider.id)
+ modelRegistryData.transcriptionProviders.map((provider) => provider.id).concat("custom")
+);
+const LLM_PROVIDERS = new Set(
+ modelRegistryData.cloudProviders.map((provider) => provider.id).concat("custom", "openrouter")
);
-const LLM_PROVIDERS = new Set(modelRegistryData.cloudProviders.map((provider) => provider.id));
const ENTERPRISE_PROVIDERS = new Set(
modelRegistryData.enterpriseProviders.map((provider) => provider.id)
);
diff --git a/src/utils/version.ts b/src/utils/version.ts
index f9e14aef8..5d2d2d04a 100644
--- a/src/utils/version.ts
+++ b/src/utils/version.ts
@@ -1,10 +1,23 @@
-import {
- isCanonicalAppVersion as isCanonicalVersion,
- parseCanonicalAppVersion,
-} from "../helpers/appVersion.js";
+const CANONICAL_APP_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
+
+type AppVersionParts = readonly [number, number, number];
+
+function parseCanonicalAppVersion(value: unknown): AppVersionParts | null {
+ if (typeof value !== "string") return null;
+
+ const match = CANONICAL_APP_VERSION.exec(value);
+ if (!match) return null;
+
+ const parts: AppVersionParts = [
+ Number(match[1]),
+ Number(match[2]),
+ Number(match[3]),
+ ];
+ return parts.every(Number.isSafeInteger) ? parts : null;
+}
export function isCanonicalAppVersion(value: unknown): value is string {
- return isCanonicalVersion(value);
+ return parseCanonicalAppVersion(value) !== null;
}
/** Returns negative when a < b, positive when a > b, and zero when equal. */
diff --git a/test/helpers/appVersion.test.js b/test/helpers/appVersion.test.js
index a8a9a67d6..3cd65531b 100644
--- a/test/helpers/appVersion.test.js
+++ b/test/helpers/appVersion.test.js
@@ -1,8 +1,19 @@
const test = require("node:test");
const assert = require("node:assert/strict");
+const fs = require("node:fs");
+const path = require("node:path");
const load = () => import("../../src/utils/version.ts");
+test("keeps the renderer version utility browser-compatible", () => {
+ const source = fs.readFileSync(
+ path.join(__dirname, "../../src/utils/version.ts"),
+ "utf8",
+ );
+
+ assert.doesNotMatch(source, /helpers\/appVersion\.js/);
+});
+
test("recognizes only canonical three-part app versions", async () => {
const { isCanonicalAppVersion } = await load();
@@ -21,3 +32,31 @@ test("an invalid installed version never satisfies a valid minimum", async () =>
assert.equal(compareAppVersions("1.8.1-beta.1", "1.8.1"), -1);
assert.equal(compareAppVersions("1.9.0", "1.8.1"), 1);
});
+
+test("keeps renderer and main-process validation behavior aligned", async () => {
+ const { isCanonicalAppVersion } = await load();
+ const mainVersion = require("../../src/helpers/appVersion.js");
+ const versions = [
+ undefined,
+ null,
+ 1,
+ "",
+ "0.0.0",
+ "1.8.1",
+ "24.10.300",
+ "1.8",
+ "1.8.1.0",
+ "01.8.1",
+ "1.8.1-beta.1",
+ "required",
+ "1.x.1",
+ ];
+
+ for (const version of versions) {
+ assert.equal(
+ isCanonicalAppVersion(version),
+ mainVersion.isCanonicalAppVersion(version),
+ String(version),
+ );
+ }
+});
diff --git a/test/helpers/policyValidation.test.js b/test/helpers/policyValidation.test.js
index 9941f04e3..6b7c00404 100644
--- a/test/helpers/policyValidation.test.js
+++ b/test/helpers/policyValidation.test.js
@@ -28,6 +28,14 @@ test("accepts a well-formed policy", () => {
assert.equal(isValidPolicyShape(validPolicy()), true);
});
+test("accepts special providers from the API policy contract", () => {
+ const policy = validPolicy();
+ policy.transcription.allowedByokProviders = ["custom"];
+ policy.llm.allowedByokProviders = ["custom", "openrouter"];
+
+ assert.equal(isValidPolicyShape(policy), true);
+});
+
test("ignores stale additive analytics metadata", () => {
const policy = validPolicy();
policy.analytics = {