Upgrade to Onyx v4.7.2; drop temporary i18n overlay

- Pin upstream to v4.7.2 and use its official next-intl i18n (German
  included); disable the temporary react-i18next backport.
- Extend the string codemod to rebrand Onyx->AIDO inside the official
  next-intl message catalogs (web/src/i18n/messages/*.json).
- Re-sync the SMB UI overlay patch onto v4.7.2 (path-copy for cited SMB
  documents + the ingestion_api "Initial Indexing" status fix).
- Re-add notification-hide-for-non-admins and de/en language limiting as
  string-based targeted patches in apply-branding.mjs, so they survive
  future version bumps (no more brittle patch files for these).
- DHI base-image swap is now a no-op: v4.7.2 defaults to public node
  images (DHI is a CI-only build-arg override).
This commit is contained in:
Naeem Dosh 2026-09-16 17:00:30 +05:00
parent f3ab7f4cee
commit 7297f18d15
3 changed files with 120 additions and 17 deletions

View file

@ -297,6 +297,85 @@ await patchFile("components/icons/icons.tsx", [{
replace: onyxTypeIcon.endsWith("\n") ? onyxTypeIcon : onyxTypeIcon + "\n",
}]);
// (a2) Whitelabel: the notification centre is admin-facing only. Hide the bell,
// panel and unread badge for non-admin end users; admins keep the full centre.
// Gate on hasAdminAccess (admins + curators) from useUser().
await patchFile("sections/sidebar/AccountPopover.tsx", [
{
desc: "expose hasAdminAccess from useUser (both popovers)",
done: "userResolution, hasAdminAccess }",
find: "const { user, userResolution } = useUser();",
replace: "const { user, userResolution, hasAdminAccess } = useUser();",
},
{
desc: "hide Notifications menu item for non-admins",
done: "// AIDO: the notification centre is admin-facing only",
find: ` </div>,
<LineItemButton
key="notifications"
sizePreset="main-ui"
variant="section"
rounding={2}
icon={SvgBell}
title={t("notifications.label")}
onClick={onOpenNotifications}
rightChildren={
undismissedCount ? (
<SvgNotificationBubble count={undismissedCount} />
) : undefined
}
/>,`,
replace: ` </div>,
// AIDO: the notification centre is admin-facing only. Hide the bell for
// non-admin end users; admins keep the full notification centre.
hasAdminAccess ? (
<LineItemButton
key="notifications"
sizePreset="main-ui"
variant="section"
rounding={2}
icon={SvgBell}
title={t("notifications.label")}
onClick={onOpenNotifications}
rightChildren={
undismissedCount ? (
<SvgNotificationBubble count={undismissedCount} />
) : undefined
}
/>
) : null,`,
},
{
desc: "hide unread badge on the account button for non-admins",
done: "hasAdminAccess && undismissedCount ?",
find: ` rightChildren={
undismissedCount ? (
<Section padding={2}>`,
replace: ` rightChildren={
hasAdminAccess && undismissedCount ? (
<Section padding={2}>`,
},
{
desc: "do not render the Notifications popover for non-admins",
done: `"Notifications" && hasAdminAccess`,
find: `{popupState === "Notifications" && (`,
replace: `{popupState === "Notifications" && hasAdminAccess && (`,
},
]);
// (a3) Whitelabel: limit the UI language selector to German + English (client
// requirement). Filter the selector's option list; the Locale type and backend
// enum stay untouched, so nothing else needs to change.
await patchFile("views/SettingsPage.tsx", [
{
desc: "limit language selector to de + en",
done: `["en", "de"].includes(l)`,
find: `{SUPPORTED_LOCALES.map((locale) => (`,
replace: `{SUPPORTED_LOCALES.filter((l) => ["en", "de"].includes(l)).map(
(locale) => (`,
},
]);
// (b) Notifications: their text is generated by the backend (official image we do
// NOT rebuild), so rebrand/suppress it at render time. Generate a tiny runtime
// helper from config, then route the notifications list through it.
@ -399,6 +478,31 @@ for await (const file of walk(SRC)) {
}
ok(`${totalReplacements} replacement(s) across ${filesChanged} file(s)`);
// 3c-official. Rebrand Onyx's OWN next-intl message catalogs (v4.7+):
// web/src/i18n/messages/<lang>.json. The product name lives in these translated
// strings now, so rebrand every language here too. Text-based (preserves the
// JSON as-is); whole-word \bOnyx\b never hits lowercase keys. No-op if absent.
{
const OFFICIAL_MSGS = path.join(SRC, "i18n/messages");
if (existsSync(OFFICIAL_MSGS)) {
let mN = 0, mFiles = 0;
for (const name of await readdir(OFFICIAL_MSGS)) {
if (!name.endsWith(".json")) continue;
const fp = path.join(OFFICIAL_MSGS, name);
let s = await readFile(fp, "utf8"); let m = 0;
for (const [from, to] of literals) {
if (s.includes(from)) { const parts = s.split(from); m += parts.length - 1; s = parts.join(to); }
}
for (const [from, to] of wordPairs) {
const re = new RegExp(`\\b${from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "g");
s = s.replace(re, () => { m++; return to; });
}
if (m > 0) { if (!DRY) await writeFile(fp, s); mN += m; mFiles++; }
}
ok(`rebranded official i18n catalogs: ${mN} replacement(s) across ${mFiles} file(s)`);
}
}
// 3c. Rebrand the bundled i18n dictionaries (Onyx->AIDO in every language) so the
// translated UI is branded too. Only when the i18n backport is active.
if (CONFIG.i18n && CONFIG.i18n.enabled && CONFIG.i18n.rebrandLocales) {

View file

@ -7,14 +7,14 @@
"ogDescription": "Ein KI-Assistent, der genau auf Ihre Unternehmensdokumente abgestimmt ist."
},
"upstream": {
"$comment": "Pin the exact Onyx release tag this overlay is authored against. `make setup` checks this out. Locked to a release NUMBER (e.g. v4.5.2), not a raw commit. The i18n patch below is re-synced against this exact tag, so it applies cleanly (see i18n). To move to a newer Onyx: re-sync the i18n patch onto the new tag, then bump this. When Onyx ships official i18n, bump this and set i18n.enabled=false.",
"$comment": "Pin the exact Onyx release tag this overlay is authored against. `make setup` checks this out. Locked to a release NUMBER (e.g. v4.7.2), not a raw commit. As of v4.7.2 Onyx ships OFFICIAL i18n (next-intl, incl. German), so the temporary i18n backport is disabled (i18n.enabled=false) and the codemod rebrands Onyx->AIDO inside the official message catalogs instead. To move to a newer Onyx: re-sync the smbUi patch onto the new tag (targeted patches in apply-branding.mjs are string-based and usually survive), then bump this.",
"repo": "https://github.com/onyx-dot-app/onyx",
"pinnedCommit": "v4.5.2",
"pinnedCommit": "v4.7.2",
"webSrcRoot": "web"
},
"i18n": {
"$comment": "TEMPORARY end-user internationalization, backported from Onyx PR #12558 (react-i18next; user UI only, Admin stays English) until the official feature ships. apply-branding.mjs git-applies `patch` onto the pinned checkout BEFORE the branding string codemod, then the codemod also rebrands Onyx->AIDO inside the bundled locale dictionaries. Fill/refine translations in web/public/locales/<lang>/common.json. Set enabled=false to drop it once official i18n lands.",
"enabled": true,
"$comment": "DISABLED as of the v4.7.2 upgrade. This was a TEMPORARY end-user i18n backport of Onyx PR #12558 (react-i18next) used on v4.5.2 before Onyx shipped official i18n. v4.7.2 has official next-intl i18n (German included), so this whole overlay is off. Kept here only for reference/rollback; the patch and dictionaries are no longer applied. Language limiting to de+en and the codemod rebrand of the official catalogs are handled directly in apply-branding.mjs (steps 2b + 3c-official). Do not re-enable against v4.7+.",
"enabled": false,
"patch": "branding/i18n/end-user-i18n.patch",
"baseCommit": "v4.5.2",
"defaultLanguage": "de",
@ -28,13 +28,13 @@
"$dictionaries_comment": "Client-editable source dictionaries. After the patch is applied, apply-branding.mjs copies dictionaries/<lang>.json over web/public/locales/<lang>/common.json — so edits here PERSIST across `make setup` (they're the source of truth, not the patch). Edit branding/i18n/locales/de.json to add/refine German (see MISSING-de.md for untranslated keys), then `make apply && make build`."
},
"smbUi": {
"$comment": "Phase 2 of the SMB connector (smb-connector/): a tiny frontend overlay so documents synced from SMB/network shares (source=ingestion_api) don't present a broken, dead file-preview. Clicking a cited SMB document copies its logical network path (\\\\company\\share\\...) to the clipboard instead, so the user can open it on the share. Applied on top of the i18n patch, before the branding codemod. Independent of the connector itself; set enabled=false to drop it.",
"$comment": "Phase 2 of the SMB connector (smb-connector/): a tiny frontend overlay so documents synced from SMB/network shares (source=ingestion_api) don't present a broken, dead file-preview. Clicking a cited SMB document copies its logical network path (\\\\company\\share\\...) to the clipboard instead, so the user can open it on the share. The same patch also fixes the connector status badge (ingestion_api never runs the classic indexer, so it would stay stuck on 'Initial Indexing'). Applied before the branding codemod; re-synced onto v4.7.2. Independent of the connector itself; set enabled=false to drop it.",
"enabled": true,
"patch": "branding/smb/smb-ui.patch"
},
"build": {
"$comment": "As of 2026-07, Onyx's web Dockerfile bases on Docker Hardened Images (dhi.io/node:*), a paid Docker offering that requires a DHI subscription + `docker login dhi.io` — so `make build` fails with a registry login error for anyone without DHI access. The apply step rewrites those FROM lines to the equivalent PUBLIC Docker Hub node images (Debian 13 / glibc, matching the DHI variant the Dockerfile targets), so the branded image builds with no login. Keys = the dhi.io image ref (the trailing @sha256 digest, if any, is stripped automatically); values = the public replacement. No-op (with a warning) if the DHI lines are absent, so this stays safe across upstream changes.",
"$comment": "NO-OP on v4.7.2 (kept for older tags / safety). v4.5.2's web Dockerfile hardcoded Docker Hardened Images (dhi.io/node:*, paid, needs `docker login dhi.io`), so `make build` failed without DHI access; the apply step rewrote those FROM lines to public Docker Hub node images. v4.7.2 instead uses build ARGs (NODE_BUILDER_IMAGE / NODE_RUNTIME_IMAGE) that DEFAULT to public `docker.io/library/node:24-trixie-slim` — DHI is only a CI-time override — so a plain `docker build` needs no login and no swap. This map now matches nothing and logs a harmless 'nothing to swap'. Keys = the dhi.io image ref (trailing @sha256 digest stripped automatically); values = the public replacement.",
"baseImageReplacements": {
"dhi.io/node:24-debian13-dev": "docker.io/library/node:24-trixie",
"dhi.io/node:24-debian13": "docker.io/library/node:24-trixie-slim"
@ -89,7 +89,7 @@
}
},
"notifications": {
"$comment": "Notification centre is now admin-only (hidden for non-admins via the i18n patch). Admins want full, unmodified visibility, so filtering is OFF: sanitize=false + empty suppressTypes => apply-branding.mjs skips patching useNotifications entirely and notifications render straight from the backend. To re-enable rebrand/suppression, set sanitize=true and/or list suppressTypes.",
"$comment": "Notification centre is admin-only. The bell, panel and unread badge are hidden for non-admins via a targeted patch in apply-branding.mjs (step 2b, AccountPopover.tsx, gated on hasAdminAccess). Admins want full, unmodified visibility, so content filtering is OFF: sanitize=false + empty suppressTypes => apply-branding.mjs skips patching useNotifications entirely and notifications render straight from the backend. To re-enable rebrand/suppression, set sanitize=true and/or list suppressTypes.",
"sanitize": false,
"suppressTypes": []
}

View file

@ -1,8 +1,8 @@
diff --git a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
index 39061740..04cf8794 100644
index 0f61ede9..2dcb8e7e 100644
--- a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
+++ b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
@@ -175,7 +175,13 @@ function ConnectorRow({
@@ -179,7 +179,13 @@ function ConnectorRow({
<TableCell>
<CCPairStatus
ccPairStatus={
@ -18,18 +18,17 @@ index 39061740..04cf8794 100644
: ccPairsIndexingStatus.last_status == "not_started"
? ConnectorCredentialPairStatus.SCHEDULED
diff --git a/web/src/lib/search/utils.ts b/web/src/lib/search/utils.ts
index bdb98931..14aa85eb 100644
index ce7eab36..2711f0b6 100644
--- a/web/src/lib/search/utils.ts
+++ b/web/src/lib/search/utils.ts
@@ -6,6 +6,7 @@ import {
SourceMetadata,
} from "./interfaces";
import { DateRangePickerValue } from "@/components/dateRangeSelectors/AdminDateRangeSelector";
@@ -1,5 +1,6 @@
import { ValidSources } from "@/lib/types";
import { MinimalOnyxDocument, OnyxDocument } from "@/lib/search/interfaces";
+import { toast } from "@opal/layouts";
export const buildFilters = (
sources: SourceMetadata[],
@@ -32,6 +33,20 @@ export const openDocument = (
// If we have a link, open it in a new tab (including if it's a file)
// If above fails and we have a file, update the presenting document
@@ -7,6 +8,20 @@ export const openDocument = (
document: OnyxDocument,
updatePresentingDocument?: (document: MinimalOnyxDocument) => void
) => {