Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

feat: implement email masking for test result labels and refactor sidebar route matching logic

diegosouzapwe7c2998cf933
diff --git a/.env.example b/.env.example
index d356c7a123..ec7a157df8 100644
--- a/.env.example
+++ b/.env.example
@@ -335,7 +335,21 @@ GITHUB_OAUTH_CLIENT_ID=Iv1.b507a08c87ecfe98
# ── Qoder ──
QODER_OAUTH_CLIENT_SECRET=4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW
-# ── Qoder (URLs — set these to enable Qoder OAuth login) ──
+# ── Qoder Browser OAuth (experimental) ──
+# OmniRoute only enables the browser OAuth flow when ALL 5 variables below are set:
+# - QODER_OAUTH_AUTHORIZE_URL
+# - QODER_OAUTH_TOKEN_URL
+# - QODER_OAUTH_USERINFO_URL
+# - QODER_OAUTH_CLIENT_ID
+# - QODER_OAUTH_CLIENT_SECRET
+#
+# Redirect URI to register in the Qoder OAuth app:
+# - Localhost dev with PORT=20128: http://localhost:20128/callback
+# - LAN access (example): http://192.168.0.15:20128/callback
+# - Public domain (recommended): https://omniroute.example.com/callback
+#
+# Behind reverse proxy / public domain, also set NEXT_PUBLIC_BASE_URL to the same public origin.
+# If these values are not available, prefer QODER_PERSONAL_ACCESS_TOKEN below.
# QODER_OAUTH_AUTHORIZE_URL=
# QODER_OAUTH_TOKEN_URL=
# QODER_OAUTH_USERINFO_URL=
diff --git a/src/app/(dashboard)/dashboard/combos/page.tsx b/src/app/(dashboard)/dashboard/combos/page.tsx
index 5425f80f88..a94d9b7576 100644
--- a/src/app/(dashboard)/dashboard/combos/page.tsx
+++ b/src/app/(dashboard)/dashboard/combos/page.tsx
@@ -1632,6 +1632,8 @@ function ComboCard({
// Test Results View
// ─────────────────────────────────────────────
function TestResultsView({ results }) {
+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);
+
if (results.error) {
return (
<div className="flex items-center gap-2 text-red-500 text-sm">
@@ -1686,7 +1688,9 @@ function TestResultsView({ results }) {
{r.status === "ok" ? "check_circle" : r.status === "skipped" ? "skip_next" : "error"}
</span>
<div className="min-w-0 flex-1">
- <code className="font-mono block truncate">{r.label || r.model}</code>
+ <code className="font-mono block truncate">
+ {pickDisplayValue([r.label], emailsVisible, r.model)}
+ </code>
{r.connectionId || r.stepId ? (
<div className="mt-0.5 text-[10px] text-text-muted">
{r.connectionId ? `acct ${r.connectionId.slice(0, 8)}` : "dynamic account"}
diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
index ed730d519c..55ba8d2d4b 100644
--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx
@@ -915,6 +915,7 @@ export default function ProviderDetailPage() {
const [headerImgError, setHeaderImgError] = useState(false);
const { copied, copy } = useCopyToClipboard();
const t = useTranslations("providers");
+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);
const notify = useNotificationStore();
const [proxyTarget, setProxyTarget] = useState(null);
const [proxyConfig, setProxyConfig] = useState(null);
@@ -1338,7 +1339,6 @@ export default function ProviderDetailPage() {
}
};
-
const [cpaProviderEnabled, setCpaProviderEnabled] = useState(false);
// Load upstream proxy config for this provider on mount
@@ -2713,11 +2713,7 @@ export default function ProviderDetailPage() {
setProxyTarget({
level: "key",
id: conn.id,
- label: pickDisplayValue(
- [conn.name, conn.email],
- useEmailPrivacyStore.getState().emailsVisible,
- conn.id
- ),
+ label: pickDisplayValue([conn.name, conn.email], emailsVisible, conn.id),
})
}
hasProxy={!!connProxyMap[conn.id]?.proxy}
@@ -2828,7 +2824,7 @@ export default function ProviderDetailPage() {
id: conn.id,
label: pickDisplayValue(
[conn.name, conn.email],
- useEmailPrivacyStore.getState().emailsVisible,
+ emailsVisible,
conn.id
),
})
@@ -3003,7 +2999,9 @@ export default function ProviderDetailPage() {
{r.valid ? "check_circle" : "error"}
</span>
<div className="flex-1 min-w-0">
- <span className="font-medium">{r.connectionName}</span>
+ <span className="font-medium">
+ {pickDisplayValue([r.connectionName], emailsVisible, r.connectionName)}
+ </span>
</div>
{r.latencyMs !== undefined && (
<span className="text-text-muted font-mono tabular-nums">
@@ -4845,9 +4843,10 @@ function ConnectionRow({
? "bg-indigo-500/15 text-indigo-500 hover:bg-indigo-500/25"
: "bg-black/[0.03] dark:bg-white/[0.03] text-text-muted/50 hover:text-text-muted hover:bg-black/[0.06] dark:hover:bg-white/[0.06]"
}`}
- title={cliproxyapiDeepMode
- ? "Using CLIProxyAPI for deeper Claude Code emulation (uTLS, multi-account, device profiles)"
- : "Enable CLIProxyAPI backend for deeper Claude Code OAuth emulation"
+ title={
+ cliproxyapiDeepMode
+ ? "Using CLIProxyAPI for deeper Claude Code emulation (uTLS, multi-account, device profiles)"
+ : "Enable CLIProxyAPI backend for deeper Claude Code OAuth emulation"
}
>
<span className="material-symbols-outlined text-[13px]">swap_horiz</span>
diff --git a/src/app/(dashboard)/dashboard/providers/page.tsx b/src/app/(dashboard)/dashboard/providers/page.tsx
index adc326e3b8..ada2b317bb 100644
--- a/src/app/(dashboard)/dashboard/providers/page.tsx
+++ b/src/app/(dashboard)/dashboard/providers/page.tsx
@@ -23,6 +23,8 @@ import {
} from "@/shared/constants/providers";
import Link from "next/link";
import { getErrorCode, getRelativeTime } from "@/shared/utils";
+import { pickDisplayValue } from "@/shared/utils/maskEmail";
+import useEmailPrivacyStore from "@/store/emailPrivacyStore";
import { useNotificationStore } from "@/store/notificationStore";
import ModelAvailabilityBadge from "./components/ModelAvailabilityBadge";
import { useTranslations } from "next-intl";
@@ -1569,6 +1571,7 @@ AddCcCompatibleModal.propTypes = {
function ProviderTestResultsView({ results }) {
const t = useTranslations("providers");
const tc = useTranslations("common");
+ const emailsVisible = useEmailPrivacyStore((s) => s.emailsVisible);
// Guard: never crash on malformed/null results (would trigger error boundary)
if (!results || typeof results !== "object") {
@@ -1636,7 +1639,9 @@ function ProviderTestResultsView({ results }) {
{r.valid ? "check_circle" : "error"}
</span>
<div className="flex-1 min-w-0">
- <span className="font-medium">{r.connectionName}</span>
+ <span className="font-medium">
+ {pickDisplayValue([r.connectionName], emailsVisible, r.connectionName)}
+ </span>
<span className="text-text-muted ml-1.5">({r.provider})</span>
</div>
{r.latencyMs !== undefined && (
diff --git a/src/shared/components/Sidebar.tsx b/src/shared/components/Sidebar.tsx
index 2a69041e72..098878eb98 100644
--- a/src/shared/components/Sidebar.tsx
+++ b/src/shared/components/Sidebar.tsx
@@ -5,6 +5,7 @@ import PropTypes from "prop-types";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/shared/utils/cn";
+import { getActiveSidebarHref } from "@/shared/utils/sidebarRouteMatch";
import { APP_CONFIG } from "@/shared/constants/config";
import OmniRouteLogo from "./OmniRouteLogo";
import Button from "./Button";
@@ -91,13 +92,6 @@ export default function Sidebar({
};
}, []);
- const isActive = (href, exact) => {
- if (exact) {
- return pathname === href;
- }
- return pathname.startsWith(href);
- };
-
const handleShutdown = async () => {
setIsShuttingDown(true);
try {
@@ -140,9 +134,13 @@ export default function Sidebar({
.filter((item) => !hiddenSidebarSet.has(item.id)),
}))
.filter((section) => section.items.length > 0);
+ const activeHref = getActiveSidebarHref(
+ pathname,
+ visibleSections.flatMap((section) => section.items)
+ );
const renderNavLink = (item) => {
- const active = !item.external && isActive(item.href, item.exact);
+ const active = !item.external && activeHref === item.href;
const className = cn(
"flex items-center gap-3 rounded-lg transition-all group",
collapsed ? "justify-center px-2 py-2.5" : "px-4 py-2",
@@ -305,9 +303,7 @@ export default function Sidebar({
collapsed ? "p-2 flex flex-col gap-1" : "p-3 flex gap-2"
)}
style={{
- paddingBottom: isMacElectron
- ? "calc(0.75rem + var(--desktop-safe-bottom))"
- : undefined,
+ paddingBottom: isMacElectron ? "calc(0.75rem + var(--desktop-safe-bottom))" : undefined,
}}
>
<button
diff --git a/src/shared/utils/sidebarRouteMatch.ts b/src/shared/utils/sidebarRouteMatch.ts
new file mode 100644
index 0000000000..86feeee779
--- /dev/null
+++ b/src/shared/utils/sidebarRouteMatch.ts
@@ -0,0 +1,43 @@
+type SidebarLikeItem = {
+ href: string;
+ exact?: boolean;
+ external?: boolean;
+};
+
+export function matchesSidebarHref(
+ pathname: string | null | undefined,
+ href: string,
+ exact = false
+): boolean {
+ if (!pathname) return false;
+ if (exact) return pathname === href;
+ return pathname === href || pathname.startsWith(`${href}/`);
+}
+
+export function getActiveSidebarHref(
+ pathname: string | null | undefined,
+ items: SidebarLikeItem[]
+): string | null {
+ let bestMatch: SidebarLikeItem | null = null;
+
+ for (const item of items) {
+ if (item.external) continue;
+ if (!matchesSidebarHref(pathname, item.href, item.exact === true)) continue;
+
+ if (!bestMatch) {
+ bestMatch = item;
+ continue;
+ }
+
+ if (item.href.length > bestMatch.href.length) {
+ bestMatch = item;
+ continue;
+ }
+
+ if (item.href.length === bestMatch.href.length && item.exact && !bestMatch.exact) {
+ bestMatch = item;
+ }
+ }
+
+ return bestMatch?.href || null;
+}
diff --git a/tests/integration/integration-wiring.test.mjs b/tests/integration/integration-wiring.test.mjs
index 1ccaa9bf55..1e62d54b1b 100644
--- a/tests/integration/integration-wiring.test.mjs
+++ b/tests/integration/integration-wiring.test.mjs
@@ -323,4 +323,37 @@ describe("Page Integration — combos page empty state", () => {
assert.match(src, /pickDisplayValue/);
assert.match(src, /emailVisibilityTooltip/);
});
+
+ it("should mask combo test result labels with the global email privacy toggle", () => {
+ assert.match(src, /function TestResultsView/);
+ assert.match(src, /pickDisplayValue\(\[r\.label\], emailsVisible, r\.model\)/);
+ });
+});
+
+describe("Page Integration — provider test results privacy", () => {
+ const providersSrc = readProjectFile("src/app/(dashboard)/dashboard/providers/page.tsx");
+ const providerDetailSrc = readProjectFile(
+ "src/app/(dashboard)/dashboard/providers/[id]/page.tsx"
+ );
+
+ it("should mask provider test batch names with the global email privacy toggle", () => {
+ assert.ok(providersSrc, "src/app/(dashboard)/dashboard/providers/page.tsx should exist");
+ assert.match(providersSrc, /useEmailPrivacyStore/);
+ assert.match(
+ providersSrc,
+ /pickDisplayValue\(\[r\.connectionName\], emailsVisible, r\.connectionName\)/
+ );
+ });
+
+ it("should mask provider detail test result names with the global email privacy toggle", () => {
+ assert.ok(
+ providerDetailSrc,
+ "src/app/(dashboard)/dashboard/providers/[id]/page.tsx should exist"
+ );
+ assert.match(providerDetailSrc, /const emailsVisible = useEmailPrivacyStore/);
+ assert.match(
+ providerDetailSrc,
+ /pickDisplayValue\(\s*\[r\.connectionName\],\s*emailsVisible,\s*r\.connectionName\s*\)/
+ );
+ });
});
diff --git a/tests/unit/sidebar-route-match.test.mjs b/tests/unit/sidebar-route-match.test.mjs
new file mode 100644
index 0000000000..8efa3ed770
--- /dev/null
+++ b/tests/unit/sidebar-route-match.test.mjs
@@ -0,0 +1,25 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+
+const { getActiveSidebarHref, matchesSidebarHref } =
+ await import("../../src/shared/utils/sidebarRouteMatch.ts");
+
+test("matchesSidebarHref respects exact routes and segment boundaries", () => {
+ assert.equal(matchesSidebarHref("/dashboard", "/dashboard", true), true);
+ assert.equal(matchesSidebarHref("/dashboard/cache", "/dashboard", true), false);
+ assert.equal(matchesSidebarHref("/dashboard/cache/media", "/dashboard/cache"), true);
+ assert.equal(matchesSidebarHref("/dashboard/cachex", "/dashboard/cache"), false);
+});
+
+test("getActiveSidebarHref prefers the most specific sidebar entry", () => {
+ const items = [
+ { href: "/dashboard/cache" },
+ { href: "/dashboard/cache/media" },
+ { href: "/dashboard/limits" },
+ ];
+
+ assert.equal(getActiveSidebarHref("/dashboard/cache/media", items), "/dashboard/cache/media");
+ assert.equal(getActiveSidebarHref("/dashboard/cache", items), "/dashboard/cache");
+ assert.equal(getActiveSidebarHref("/dashboard/cache/entries", items), "/dashboard/cache");
+ assert.equal(getActiveSidebarHref("/dashboard/limits", items), "/dashboard/limits");
+});