AIDO white-label overlay for Onyx Community Edition
Thin-overlay white-label: branding driven by a single config, applied into onyx/web by apply-branding.mjs; only the web image is built locally while all other services use official Onyx images. - branding/branding.config.json: single source of truth (name, assets, links) - branding/apply-branding.mjs: asset fetch + logo swap + favicon repoint + codemod - docker-compose.branding.yml + Makefile: build only livtec/aido-web, pull the rest - .env/.env.nginx examples + README (update-branding & upgrade-Onyx workflows) Community Edition only; no EE/commercial features used.
This commit is contained in:
commit
c6e3776617
14 changed files with 611 additions and 0 deletions
34
.env.example
Normal file
34
.env.example
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Deployment environment for the AIDO (Onyx CE) white-label.
|
||||||
|
# Copy to `.env` (same directory) and fill in real secrets: cp .env.example .env
|
||||||
|
#
|
||||||
|
# NOTE: Branding (name/logo/favicon/links) is NOT configured here — it is baked
|
||||||
|
# into the web image at build time from branding/branding.config.json. This file
|
||||||
|
# only holds DEPLOYMENT settings (secrets, auth, image version).
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
# Pin BOTH the upstream image tag and the ./onyx checkout to the same release for
|
||||||
|
# a reproducible, version-matched deployment. `latest` follows upstream main.
|
||||||
|
IMAGE_TAG=latest
|
||||||
|
|
||||||
|
# Branded web image tag (built locally; any value is fine).
|
||||||
|
AIDO_TAG=local
|
||||||
|
|
||||||
|
# ── Object storage (MinIO) — REQUIRED, the compose refuses to start otherwise ──
|
||||||
|
MINIO_ROOT_USER=aido_minio_admin
|
||||||
|
MINIO_ROOT_PASSWORD=change-me-strong-password
|
||||||
|
S3_AWS_ACCESS_KEY_ID=aido_minio_admin
|
||||||
|
S3_AWS_SECRET_ACCESS_KEY=change-me-strong-password
|
||||||
|
|
||||||
|
# ── Auth ──
|
||||||
|
# Easiest first-run option is `disabled` (no login wall) to verify branding.
|
||||||
|
# For production use `oidc` / `google_oauth` / `basic` and add the matching vars
|
||||||
|
# from Onyx's docs. See onyx/deployment/docker_compose/.env.* examples upstream.
|
||||||
|
AUTH_TYPE=disabled
|
||||||
|
|
||||||
|
# Public URL the app is served from (used for callbacks / absolute links).
|
||||||
|
WEB_DOMAIN=http://localhost:3000
|
||||||
|
|
||||||
|
# ── Postgres ── (defaults work for a local run; change for production)
|
||||||
|
POSTGRES_USER=postgres
|
||||||
|
POSTGRES_PASSWORD=password
|
||||||
17
.env.nginx.example
Normal file
17
.env.nginx.example
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# nginx environment for the AIDO (Onyx CE) white-label.
|
||||||
|
# Copy to `.env.nginx` (same directory): cp .env.nginx.example .env.nginx
|
||||||
|
#
|
||||||
|
# This is Onyx's standard nginx config (not branding-specific). The DOMAIN is used
|
||||||
|
# to render the server_name; the SSL_* names point at cert files you place in
|
||||||
|
# onyx/deployment/data/sslcerts/ for the no-letsencrypt profile.
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
DOMAIN=localhost
|
||||||
|
|
||||||
|
# For the prod-no-letsencrypt profile, drop your cert + key in
|
||||||
|
# onyx/deployment/data/sslcerts/ and name them here. For a quick local test you
|
||||||
|
# can self-sign: openssl req -x509 -newkey rsa:2048 -nodes -days 365 \
|
||||||
|
# -keyout onyx/deployment/data/sslcerts/ssl.key \
|
||||||
|
# -out onyx/deployment/data/sslcerts/ssl.crt -subj "/CN=localhost"
|
||||||
|
SSL_CERT_FILE_NAME=ssl.crt
|
||||||
|
SSL_CERT_KEY_FILE_NAME=ssl.key
|
||||||
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Upstream Onyx checkout — cloned by `make setup`, not part of this overlay repo.
|
||||||
|
# The branding overlay regenerates into it via `make apply`.
|
||||||
|
/onyx/
|
||||||
|
|
||||||
|
# Local deployment secrets (copy from the *.example templates)
|
||||||
|
.env
|
||||||
|
.env.nginx
|
||||||
|
|
||||||
|
# OS / editor noise
|
||||||
|
.DS_Store
|
||||||
|
*.log
|
||||||
61
Makefile
Normal file
61
Makefile
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# AIDO white-label of Onyx Community Edition — operator shortcuts.
|
||||||
|
#
|
||||||
|
# make rebrand apply branding + build the web image + (re)start the stack
|
||||||
|
# make apply only re-run the branding overlay into ./onyx/web
|
||||||
|
# make build only (re)build the branded web image
|
||||||
|
# make up / down start / stop the full stack
|
||||||
|
# make logs follow the web container logs
|
||||||
|
# make verify sanity-check that branding was applied (no stray "Onyx")
|
||||||
|
#
|
||||||
|
# The --project-directory . flag pins the Compose project dir to this repo root so
|
||||||
|
# the override's `./onyx/web` context and the root-level `.env` both resolve, while
|
||||||
|
# every other service is pulled unchanged from Onyx's official images.
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
# Use the no-letsencrypt prod compose by default (no TLS/domain needed). Override
|
||||||
|
# with `make COMPOSE_BASE=onyx/deployment/docker_compose/docker-compose.prod.yml`.
|
||||||
|
COMPOSE_BASE ?= onyx/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml
|
||||||
|
COMPOSE = docker compose --project-directory . -f $(COMPOSE_BASE) -f docker-compose.branding.yml
|
||||||
|
|
||||||
|
.PHONY: setup rebrand apply build up down restart logs verify config
|
||||||
|
|
||||||
|
# Clone the upstream Onyx checkout at the pinned commit (only if ./onyx is absent).
|
||||||
|
# Reads upstream.repo / upstream.pinnedCommit from branding/branding.config.json.
|
||||||
|
ONYX_REPO = $(shell node -e "console.log(require('./branding/branding.config.json').upstream.repo)")
|
||||||
|
ONYX_COMMIT = $(shell node -e "console.log(require('./branding/branding.config.json').upstream.pinnedCommit)")
|
||||||
|
setup:
|
||||||
|
@if [ -d onyx/.git ] || [ -d onyx/web ]; then \
|
||||||
|
echo "onyx/ already present — skipping clone."; \
|
||||||
|
else \
|
||||||
|
echo "Cloning $(ONYX_REPO) @ $(ONYX_COMMIT) into ./onyx ..."; \
|
||||||
|
git clone $(ONYX_REPO) onyx && git -C onyx checkout $(ONYX_COMMIT); \
|
||||||
|
fi
|
||||||
|
|
||||||
|
rebrand: apply build up
|
||||||
|
|
||||||
|
apply:
|
||||||
|
node branding/apply-branding.mjs
|
||||||
|
|
||||||
|
build:
|
||||||
|
$(COMPOSE) build web_server
|
||||||
|
|
||||||
|
up:
|
||||||
|
$(COMPOSE) up -d
|
||||||
|
|
||||||
|
down:
|
||||||
|
$(COMPOSE) down
|
||||||
|
|
||||||
|
restart:
|
||||||
|
$(COMPOSE) up -d --force-recreate web_server
|
||||||
|
|
||||||
|
logs:
|
||||||
|
$(COMPOSE) logs -f web_server
|
||||||
|
|
||||||
|
config:
|
||||||
|
$(COMPOSE) config
|
||||||
|
|
||||||
|
verify:
|
||||||
|
@echo "Stray standalone 'Onyx' in shipping web source (expect 0):"
|
||||||
|
@grep -rnE '\bOnyx\b' onyx/web/src --include='*.ts' --include='*.tsx' \
|
||||||
|
| grep -vE '\.test\.|\.spec\.|\.stories\.|__tests__|__mocks__' | wc -l
|
||||||
174
README.md
Normal file
174
README.md
Normal file
|
|
@ -0,0 +1,174 @@
|
||||||
|
# AIDO — Onyx Community Edition White-Label (Livtec AG)
|
||||||
|
|
||||||
|
A clean, upgrade-friendly white-label of [Onyx](https://github.com/onyx-dot-app/onyx)
|
||||||
|
**Community Edition**. The logo, product name (**AIDO**), favicon, documentation
|
||||||
|
links and every user-visible "Onyx" reference are rebranded — while every backend
|
||||||
|
and infrastructure service still runs the **official** Onyx Docker images.
|
||||||
|
|
||||||
|
> **Community Edition only.** This rebrands at the open-source default level. It does
|
||||||
|
> **not** enable or depend on Onyx's Enterprise white-label feature (the
|
||||||
|
> `enterprise-settings` / `ee` code paths). No commercial features are used.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## How it works (the approach)
|
||||||
|
|
||||||
|
Onyx bakes its branding into the **web frontend build** — the name is a hardcoded
|
||||||
|
`|| "Onyx"` fallback, the logo is an inline SVG React component, and ~180 UI strings
|
||||||
|
are compiled into the JS bundle. Pure runtime injection (env vars / volume mounts)
|
||||||
|
therefore can't fully rebrand it. So we use a **thin-overlay** model:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ branding/branding.config.json ← single source of truth (you edit) │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ node branding/apply-branding.mjs │
|
||||||
|
│ onyx/web ← branding baked in (logo, favicon, name, links) │
|
||||||
|
│ │ │
|
||||||
|
│ ▼ docker compose build web_server │
|
||||||
|
│ livtec/aido-web:local ← the ONLY image we build │
|
||||||
|
└─────────────────────────────────────────────────────────────────────┘
|
||||||
|
backend · model-server · code-interpreter · postgres · redis ·
|
||||||
|
opensearch · minio · nginx → ALL pulled from official images
|
||||||
|
```
|
||||||
|
|
||||||
|
Because everything except the web image comes straight from upstream, taking a new
|
||||||
|
Onyx release is a re-checkout + re-run, not a fork to maintain (see
|
||||||
|
[Upgrading Onyx](#upgrading-onyx)).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
| Path | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `branding/branding.config.json` | **Single source of truth** — name, assets, links, emails, rename rules. |
|
||||||
|
| `branding/apply-branding.mjs` | Applies the overlay into `onyx/web` (fetch assets, swap logos, repoint favicon, codemod strings). |
|
||||||
|
| `branding/templates/` | Logo React components (filled from the config at apply time). |
|
||||||
|
| `branding/assets/` | Offline fallback copies of the fetched brand images. |
|
||||||
|
| `docker-compose.branding.yml` | Thin override: build **only** `web_server` from `./onyx/web`, pull the rest. |
|
||||||
|
| `Makefile` | `make rebrand` / `apply` / `build` / `up` / `down` / `verify`. |
|
||||||
|
| `.env.example`, `.env.nginx.example` | Deployment env templates (Onyx's standard vars — **not** branding). |
|
||||||
|
| `onyx/` | Upstream Onyx checkout (pinned — see `branding.config.json → upstream`). |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 0a. one-time: fetch the upstream Onyx checkout at the pinned commit
|
||||||
|
make setup
|
||||||
|
|
||||||
|
# 0b. one-time: copy the env templates and set real secrets
|
||||||
|
cp .env.example .env
|
||||||
|
cp .env.nginx.example .env.nginx
|
||||||
|
# edit .env → set MINIO_ROOT_PASSWORD / S3_AWS_SECRET_ACCESS_KEY, AUTH_TYPE, WEB_DOMAIN
|
||||||
|
# (for the no-letsencrypt profile, also place TLS certs — see .env.nginx.example)
|
||||||
|
|
||||||
|
# 1. apply branding, build the branded web image, start the whole stack
|
||||||
|
make rebrand
|
||||||
|
|
||||||
|
# …or step by step:
|
||||||
|
make apply # bake branding into ./onyx/web
|
||||||
|
make build # build livtec/aido-web:local
|
||||||
|
make up # start the stack (web branded, everything else official)
|
||||||
|
|
||||||
|
make logs # follow the web container
|
||||||
|
make verify # assert no stray "Onyx" remains in the shipping source
|
||||||
|
make down # stop
|
||||||
|
```
|
||||||
|
|
||||||
|
Requires Docker + Docker Compose v2 and Node ≥ 18 (for the apply script). The app is
|
||||||
|
served via nginx on ports 80/443.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Updating the branding
|
||||||
|
|
||||||
|
Everything is driven by **`branding/branding.config.json`** — you never hand-edit
|
||||||
|
files under `onyx/`.
|
||||||
|
|
||||||
|
| To change… | Edit in `branding.config.json` |
|
||||||
|
|------------|--------------------------------|
|
||||||
|
| Product name | `brand.name` |
|
||||||
|
| Logo / wordmark / favicon | `assets.*.url` (remote) — fetched on next `apply`. Or drop files in `branding/assets/` and run with `--no-fetch`. |
|
||||||
|
| Documentation / help / legal links | `links.*` and `rename.literals` |
|
||||||
|
| A specific phrase swap | `rename.literals` (exact string) |
|
||||||
|
| The global name swap | `rename.word` (whole-word, case-sensitive) |
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make apply && make build && make restart
|
||||||
|
```
|
||||||
|
|
||||||
|
The codemod is **surgical**: it replaces whole-word, capitalised `Onyx` only — it
|
||||||
|
never touches code identifiers (`OnyxDocument`, `SvgOnyxLogo`, `OnyxBot`), lowercase
|
||||||
|
package refs (`@onyx/…`, `onyx.app`, `onyx.ico`), tests or stories. `make verify`
|
||||||
|
confirms the result.
|
||||||
|
|
||||||
|
### Swapping assets without network access
|
||||||
|
|
||||||
|
The apply script fetches the asset URLs and also caches them into `branding/assets/`.
|
||||||
|
If you're offline, run `node branding/apply-branding.mjs --no-fetch` and it uses those
|
||||||
|
cached files. To use brand-new files, drop them into `branding/assets/` (matching the
|
||||||
|
`dest` basenames: `mark.png`, `wordmark.png`, `favicon.png`) and run `--no-fetch`.
|
||||||
|
|
||||||
|
> The AIDO wordmark already contains the symbol, so the composed "logo + wordmark"
|
||||||
|
> component renders the wordmark **only** to avoid a duplicated mark. If you supply a
|
||||||
|
> text-less wordmark later, restore the upstream composition in
|
||||||
|
> `branding/templates/onyx-logo-typed.tsx`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Upgrading Onyx
|
||||||
|
|
||||||
|
Because we don't fork, upgrading is mechanical:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. check out the new upstream release into ./onyx
|
||||||
|
cd onyx
|
||||||
|
git fetch --all --tags
|
||||||
|
git checkout <new-tag-or-commit> # e.g. a tagged release
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# 2. bump the pin in branding/branding.config.json → upstream.pinnedCommit
|
||||||
|
# 3. re-apply + rebuild
|
||||||
|
make apply && make build && make restart
|
||||||
|
|
||||||
|
# 4. sanity check
|
||||||
|
make verify
|
||||||
|
```
|
||||||
|
|
||||||
|
Pin **`IMAGE_TAG`** in `.env` to the **same** release so the official backend/model
|
||||||
|
images match the web build you're compiling. Two things to watch after an upgrade:
|
||||||
|
|
||||||
|
1. **Logo component paths** — if upstream moves the logo files, `make apply` prints a
|
||||||
|
`logo target missing` warning. Update the paths in `apply-branding.mjs → logoInstalls`.
|
||||||
|
2. **New unbranded strings** — if upstream adds new "Onyx" copy, the global word rule
|
||||||
|
catches it automatically; review `make verify` output and the apply summary.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What gets rebranded (touchpoints)
|
||||||
|
|
||||||
|
- **Product name** — the `|| "Onyx"` resolution fallbacks (`settings/hooks.ts`,
|
||||||
|
`settings/lib.ts`) → `AIDO`; this also drives the browser tab title.
|
||||||
|
- **All UI strings** — ~180 user-visible "Onyx" references across ~96 files
|
||||||
|
(chat, onboarding, admin panels, modals, auth screen, error pages…).
|
||||||
|
- **Logo** — the in-app symbol + wordmark components render the AIDO assets.
|
||||||
|
- **Favicon** — `public/onyx.ico` replaced and `DynamicMetadata` repointed to
|
||||||
|
`/branding/favicon.png`.
|
||||||
|
- **Documentation links** — `DOCS_BASE_URL` and `docs.onyx.app` → Livtec portal.
|
||||||
|
|
||||||
|
### Known limitations / notes
|
||||||
|
|
||||||
|
- **Deep doc paths** (e.g. `/admins`, `/deployment/...`) consolidate onto the single
|
||||||
|
Livtec help URL you provided; sub-pages won't exist there unless you publish them.
|
||||||
|
- **Theme colors** from the old Lobe config are **not** applied (they were outside the
|
||||||
|
agreed logo/name/favicon/links scope and Onyx's theming differs). The AIDO logo
|
||||||
|
already carries the brand colors. Color theming can be added as a follow-up.
|
||||||
|
- **Tests / stories** intentionally keep the literal "Onyx" (they assert the upstream
|
||||||
|
default). They are excluded from the production Docker build, so this is harmless.
|
||||||
|
- **Backend/API** identifiers, cookies (`onyx_tid`) and internal names are unchanged —
|
||||||
|
they are not user-visible and renaming them would risk breaking the official images.
|
||||||
165
branding/apply-branding.mjs
Normal file
165
branding/apply-branding.mjs
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
// Livtec / AIDO white-label overlay for Onyx Community Edition.
|
||||||
|
//
|
||||||
|
// Applies all branding to a clean upstream Onyx checkout, driven entirely by
|
||||||
|
// branding/branding.config.json. Re-runnable and deterministic: to upgrade Onyx,
|
||||||
|
// check out the new upstream tag into ./onyx and run this script again, then
|
||||||
|
// rebuild the web image.
|
||||||
|
//
|
||||||
|
// Usage: node branding/apply-branding.mjs [--dry-run] [--no-fetch]
|
||||||
|
//
|
||||||
|
// CE-ONLY: this rebrands at the open-source default level (the `|| "Onyx"`
|
||||||
|
// fallbacks, hardcoded strings, logo components and favicon). It does NOT enable
|
||||||
|
// or depend on Onyx's Enterprise white-label feature (enterprise-settings).
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
import { readFile, writeFile, copyFile, mkdir, readdir, stat } from "node:fs/promises";
|
||||||
|
import { existsSync } from "node:fs";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const ROOT = path.resolve(__dirname, ".."); // project root
|
||||||
|
const BRANDING = __dirname; // branding/
|
||||||
|
const CONFIG = JSON.parse(await readFile(path.join(BRANDING, "branding.config.json"), "utf8"));
|
||||||
|
|
||||||
|
const argv = process.argv.slice(2);
|
||||||
|
const DRY = argv.includes("--dry-run");
|
||||||
|
const NO_FETCH = argv.includes("--no-fetch");
|
||||||
|
|
||||||
|
const WEB = path.join(ROOT, CONFIG.upstream.webSrcRoot); // onyx/web
|
||||||
|
const PUBLIC = path.join(WEB, "public");
|
||||||
|
const PUBLIC_BRANDING = path.join(PUBLIC, "branding");
|
||||||
|
const SRC = path.join(WEB, "src");
|
||||||
|
const OPAL_LOGOS = path.join(WEB, "lib/opal/src/logos");
|
||||||
|
const OPAL_ICONS = path.join(WEB, "lib/opal/src/icons");
|
||||||
|
|
||||||
|
const c = { gray: "\x1b[90m", green: "\x1b[32m", yellow: "\x1b[33m", red: "\x1b[31m", bold: "\x1b[1m", reset: "\x1b[0m" };
|
||||||
|
const log = (m) => console.log(m);
|
||||||
|
const ok = (m) => log(`${c.green}✓${c.reset} ${m}`);
|
||||||
|
const warn = (m) => log(`${c.yellow}!${c.reset} ${m}`);
|
||||||
|
const step = (m) => log(`\n${c.bold}${m}${c.reset}`);
|
||||||
|
|
||||||
|
let filesChanged = 0;
|
||||||
|
let totalReplacements = 0;
|
||||||
|
|
||||||
|
if (!existsSync(WEB)) {
|
||||||
|
console.error(`${c.red}✗ Onyx web source not found at ${WEB}. Clone/checkout Onyx into ./onyx first.${c.reset}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
log(`${c.bold}Livtec white-label → ${CONFIG.brand.name}${c.reset} ${c.gray}(${DRY ? "dry-run" : "apply"}${NO_FETCH ? ", no-fetch" : ""})${c.reset}`);
|
||||||
|
log(`${c.gray}web source: ${WEB}${c.reset}`);
|
||||||
|
|
||||||
|
// ── 1. Assets: fetch brand images, repoint favicon ──────────────────────────
|
||||||
|
step("1/4 Assets");
|
||||||
|
if (!DRY) await mkdir(PUBLIC_BRANDING, { recursive: true });
|
||||||
|
|
||||||
|
async function placeAsset(key) {
|
||||||
|
const a = CONFIG.assets[key];
|
||||||
|
const destPublic = path.join(PUBLIC, a.dest); // onyx/web/public/branding/<file>
|
||||||
|
const cache = path.join(BRANDING, "assets", path.basename(a.dest));
|
||||||
|
if (!NO_FETCH) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(a.url, { signal: AbortSignal.timeout(20000) });
|
||||||
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||||
|
const buf = Buffer.from(await res.arrayBuffer());
|
||||||
|
if (buf.length < 100) throw new Error("suspiciously small");
|
||||||
|
if (!DRY) {
|
||||||
|
await writeFile(destPublic, buf);
|
||||||
|
await writeFile(cache, buf); // refresh offline fallback
|
||||||
|
}
|
||||||
|
ok(`${key}: fetched ${buf.length}b → public/${a.dest}`);
|
||||||
|
return;
|
||||||
|
} catch (e) {
|
||||||
|
warn(`${key}: fetch failed (${e.message}); trying committed fallback`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (existsSync(cache)) {
|
||||||
|
if (!DRY) await copyFile(cache, destPublic);
|
||||||
|
ok(`${key}: copied committed fallback → public/${a.dest}`);
|
||||||
|
} else {
|
||||||
|
warn(`${key}: NO asset available (no network + no fallback in branding/assets/). Drop a file at ${cache} and re-run.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const key of Object.keys(CONFIG.assets)) { if (key.startsWith("$")) continue; await placeAsset(key); }
|
||||||
|
|
||||||
|
// Repoint the default favicon: overwrite /onyx.ico so even un-patched refs work,
|
||||||
|
// and update DynamicMetadata's fallback to the branded PNG.
|
||||||
|
const favSrc = path.join(PUBLIC, CONFIG.assets.favicon.dest);
|
||||||
|
if (existsSync(favSrc) && !DRY) {
|
||||||
|
await copyFile(favSrc, path.join(PUBLIC, "onyx.ico"));
|
||||||
|
ok("favicon: overwrote public/onyx.ico with branded icon");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── 2. Logo components ──────────────────────────────────────────────────────
|
||||||
|
step("2/4 Logo components");
|
||||||
|
const MARK_SRC = "/" + CONFIG.assets.mark.dest;
|
||||||
|
const WORDMARK_SRC = "/" + CONFIG.assets.wordmark.dest;
|
||||||
|
function fillTemplate(tpl) {
|
||||||
|
return tpl
|
||||||
|
.replaceAll("__BRAND_NAME__", CONFIG.brand.name)
|
||||||
|
.replaceAll("__MARK_SRC__", MARK_SRC)
|
||||||
|
.replaceAll("__WORDMARK_SRC__", WORDMARK_SRC);
|
||||||
|
}
|
||||||
|
const logoInstalls = [
|
||||||
|
["onyx-logo.tsx", path.join(OPAL_LOGOS, "onyx-logo.tsx")],
|
||||||
|
["onyx-typed.tsx", path.join(OPAL_LOGOS, "onyx-typed.tsx")],
|
||||||
|
["onyx-logo-typed.tsx", path.join(OPAL_LOGOS, "onyx-logo-typed.tsx")],
|
||||||
|
["onyx-logo.tsx", path.join(OPAL_ICONS, "onyx-logo.tsx")], // 16px icon → brand mark
|
||||||
|
];
|
||||||
|
for (const [tplName, dest] of logoInstalls) {
|
||||||
|
if (!existsSync(dest)) { warn(`logo target missing (upstream moved it?): ${path.relative(WEB, dest)}`); continue; }
|
||||||
|
const filled = fillTemplate(await readFile(path.join(BRANDING, "templates", tplName), "utf8"));
|
||||||
|
if (!DRY) await writeFile(dest, filled);
|
||||||
|
ok(`installed ${tplName} → ${path.relative(WEB, dest)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── 3. String codemod (user-visible references) ─────────────────────────────
|
||||||
|
step("3/4 String codemod");
|
||||||
|
const literals = Object.entries(CONFIG.rename.literals);
|
||||||
|
const wordPairs = Object.entries(CONFIG.rename.word);
|
||||||
|
const ASSET_PATH_EDITS = [["/onyx.ico", `/${CONFIG.assets.favicon.dest}`]]; // favicon ref in DynamicMetadata
|
||||||
|
|
||||||
|
const SKIP = /(\.test\.|\.spec\.|\.stories\.|__tests__|__mocks__|\/node_modules\/)/;
|
||||||
|
const EXT = /\.(ts|tsx)$/;
|
||||||
|
// Never rebrand these whole files (logos handled above; types declare identifiers).
|
||||||
|
const SKIP_FILES = new Set(logoInstalls.map(([, d]) => path.resolve(d)));
|
||||||
|
|
||||||
|
async function* walk(dir) {
|
||||||
|
for (const e of await readdir(dir, { withFileTypes: true })) {
|
||||||
|
const p = path.join(dir, e.name);
|
||||||
|
if (e.isDirectory()) { yield* walk(p); continue; }
|
||||||
|
if (EXT.test(e.name) && !SKIP.test(p)) yield p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for await (const file of walk(SRC)) {
|
||||||
|
if (SKIP_FILES.has(path.resolve(file))) continue;
|
||||||
|
const before = await readFile(file, "utf8");
|
||||||
|
let after = before;
|
||||||
|
let n = 0;
|
||||||
|
|
||||||
|
// 3a. exact-string literals (URLs etc.) — applied first
|
||||||
|
for (const [from, to] of [...literals, ...ASSET_PATH_EDITS]) {
|
||||||
|
if (after.includes(from)) { const parts = after.split(from); n += parts.length - 1; after = parts.join(to); }
|
||||||
|
}
|
||||||
|
// 3b. whole-word, case-sensitive brand name. \bOnyx\b never matches camelCase
|
||||||
|
// identifiers (OnyxDocument, SvgOnyxLogo) or lowercase refs (@onyx, onyx.app).
|
||||||
|
for (const [from, to] of wordPairs) {
|
||||||
|
const re = new RegExp(`\\b${from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "g");
|
||||||
|
after = after.replace(re, () => { n++; return to; });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 0) {
|
||||||
|
if (!DRY) await writeFile(file, after);
|
||||||
|
filesChanged++; totalReplacements += n;
|
||||||
|
if (DRY || process.env.VERBOSE) log(` ${c.gray}${path.relative(WEB, file)} (${n})${c.reset}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ok(`${totalReplacements} replacement(s) across ${filesChanged} file(s)`);
|
||||||
|
|
||||||
|
// ── 4. Summary ──────────────────────────────────────────────────────────────
|
||||||
|
step("4/4 Done");
|
||||||
|
log(`${c.green}White-label applied for ${c.bold}${CONFIG.brand.name}${c.reset}${c.green} (${CONFIG.brand.legalName}).${c.reset}`);
|
||||||
|
log(`${c.gray}Next: docker compose build web_server && docker compose up -d${c.reset}`);
|
||||||
|
if (DRY) warn("dry-run: no files were written.");
|
||||||
BIN
branding/assets/favicon.png
Normal file
BIN
branding/assets/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
branding/assets/mark.png
Normal file
BIN
branding/assets/mark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
BIN
branding/assets/wordmark.png
Normal file
BIN
branding/assets/wordmark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
60
branding/branding.config.json
Normal file
60
branding/branding.config.json
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"$comment": "SINGLE SOURCE OF TRUTH for the Livtec / AIDO white-label of Onyx Community Edition. Edit values here, then run `node branding/apply-branding.mjs` and rebuild the web image. Values mirror the AIDO/Lobe white-label so the two products stay visually identical.",
|
||||||
|
|
||||||
|
"brand": {
|
||||||
|
"name": "AIDO",
|
||||||
|
"legalName": "Livtec AG",
|
||||||
|
"poweredByHtml": "Powered by Livtec",
|
||||||
|
"ogDescription": "Ein KI-Assistent, der genau auf Ihre Unternehmensdokumente abgestimmt ist."
|
||||||
|
},
|
||||||
|
|
||||||
|
"upstream": {
|
||||||
|
"$comment": "Pin the exact Onyx commit/tag this overlay was authored against. Bump together with branding.apply when upgrading. Used only for documentation/verification.",
|
||||||
|
"repo": "https://github.com/onyx-dot-app/onyx",
|
||||||
|
"pinnedCommit": "d0f3b66",
|
||||||
|
"webSrcRoot": "onyx/web"
|
||||||
|
},
|
||||||
|
|
||||||
|
"assets": {
|
||||||
|
"$comment": "Remote source URLs are fetched at apply time into onyx/web/public/branding/. If a fetch fails (e.g. offline), the apply script keeps any existing committed file in branding/assets/ as a fallback.",
|
||||||
|
"mark": {
|
||||||
|
"url": "https://crm.livtec.cloud/hubfs/Logos/AIDO/favicon_aido_48x48_rand.png",
|
||||||
|
"dest": "branding/mark.png",
|
||||||
|
"note": "Square symbol used as the in-app logo icon (sidebar, loaders, compact placements)."
|
||||||
|
},
|
||||||
|
"wordmark": {
|
||||||
|
"url": "https://crm.livtec.cloud/hubfs/Logos/AIDO/aido_465x170.png",
|
||||||
|
"dest": "branding/wordmark.png",
|
||||||
|
"note": "Full lockup (symbol + AIDO text) used wherever the typed logo appears (auth screen, headers)."
|
||||||
|
},
|
||||||
|
"favicon": {
|
||||||
|
"url": "https://crm.livtec.cloud/hubfs/Logos/AIDO/favicon_aido.png",
|
||||||
|
"dest": "branding/favicon.png",
|
||||||
|
"note": "Browser tab icon. Replaces the default /onyx.ico reference."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"links": {
|
||||||
|
"$comment": "Maps Onyx's hardcoded link constants to Livtec destinations. DOCS_BASE_URL drives most in-app documentation links; deep sub-paths (e.g. /admins) consolidate to this root.",
|
||||||
|
"docsBaseUrl": "https://portal.livtec.cloud",
|
||||||
|
"website": "https://livtec.cloud/",
|
||||||
|
"help": "https://portal.livtec.cloud/",
|
||||||
|
"privacy": "https://livtec.cloud/terms/",
|
||||||
|
"terms": "https://livtec.cloud/terms/",
|
||||||
|
"blog": "https://livtec.cloud/blog/",
|
||||||
|
"changelog": "https://livtec.cloud/"
|
||||||
|
},
|
||||||
|
|
||||||
|
"emails": {
|
||||||
|
"business": "hello@livtec.cloud",
|
||||||
|
"support": "support@livtec.cloud"
|
||||||
|
},
|
||||||
|
|
||||||
|
"rename": {
|
||||||
|
"$comment": "Drives the user-visible string codemod. `word` replaces standalone, capitalised whole-word matches of \\bOnyx\\b only — camelCase identifiers (OnyxDocument, SvgOnyxLogo), lowercase package refs (@onyx, onyx.app, onyx.ico) are never touched. `literals` are exact-string replacements applied before the word pass for multi-word brand terms.",
|
||||||
|
"word": { "Onyx": "AIDO" },
|
||||||
|
"literals": {
|
||||||
|
"https://docs.onyx.app": "https://portal.livtec.cloud"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
branding/templates/onyx-logo-typed.tsx
Normal file
21
branding/templates/onyx-logo-typed.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import SvgOnyxTyped from "@opal/logos/onyx-typed";
|
||||||
|
import { cn } from "@opal/utils";
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
// WHITE-LABEL OVERRIDE — generated by branding/apply-branding.mjs. Do not edit by
|
||||||
|
// hand; edit branding/branding.config.json and re-run the apply script instead.
|
||||||
|
// Upstream composed <mark/> + <wordmark/> side by side. The AIDO wordmark image
|
||||||
|
// already contains the symbol, so we render only the wordmark here to avoid a
|
||||||
|
// duplicated mark, keeping the SvgOnyxLogoTyped export + props unchanged.
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
interface OnyxLogoTypedProps {
|
||||||
|
size?: number;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SvgOnyxLogoTyped = ({ size, className }: OnyxLogoTypedProps) => (
|
||||||
|
<div className={cn("flex flex-row items-center", className)}>
|
||||||
|
<SvgOnyxTyped size={size} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
export default SvgOnyxLogoTyped;
|
||||||
21
branding/templates/onyx-logo.tsx
Normal file
21
branding/templates/onyx-logo.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import type { IconProps } from "@opal/types";
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
// WHITE-LABEL OVERRIDE — generated by branding/apply-branding.mjs. Do not edit by
|
||||||
|
// hand; edit branding/branding.config.json and re-run the apply script instead.
|
||||||
|
// Renders the brand symbol (square mark) in place of the original Onyx SVG, while
|
||||||
|
// keeping the SvgOnyxLogo export + IconProps signature so all call sites are
|
||||||
|
// unchanged.
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
const SvgOnyxLogo = ({ size, className }: IconProps) => (
|
||||||
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
|
<img
|
||||||
|
src="__MARK_SRC__"
|
||||||
|
alt="__BRAND_NAME__"
|
||||||
|
height={size}
|
||||||
|
width={size}
|
||||||
|
className={className}
|
||||||
|
style={{ height: size, width: size, objectFit: "contain" }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
export default SvgOnyxLogo;
|
||||||
19
branding/templates/onyx-typed.tsx
Normal file
19
branding/templates/onyx-typed.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import type { IconProps } from "@opal/types";
|
||||||
|
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
// WHITE-LABEL OVERRIDE — generated by branding/apply-branding.mjs. Do not edit by
|
||||||
|
// hand; edit branding/branding.config.json and re-run the apply script instead.
|
||||||
|
// Renders the full brand lockup (symbol + wordmark) image. Height is driven by
|
||||||
|
// `size`; width auto-scales to preserve aspect ratio.
|
||||||
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
const SvgOnyxTyped = ({ size, className }: IconProps) => (
|
||||||
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
|
<img
|
||||||
|
src="__WORDMARK_SRC__"
|
||||||
|
alt="__BRAND_NAME__"
|
||||||
|
height={size}
|
||||||
|
className={className}
|
||||||
|
style={{ height: size, width: "auto", objectFit: "contain" }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
export default SvgOnyxTyped;
|
||||||
28
docker-compose.branding.yml
Normal file
28
docker-compose.branding.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Livtec / AIDO white-label override for Onyx Community Edition.
|
||||||
|
#
|
||||||
|
# This is a THIN OVERLAY on top of Onyx's own upstream compose file. Every service
|
||||||
|
# (backend, model servers, postgres, opensearch, redis, minio, nginx, …) is pulled
|
||||||
|
# UNCHANGED from the official images. The only thing we build locally is the web
|
||||||
|
# frontend — from ./onyx/web, into which branding/apply-branding.mjs has baked the
|
||||||
|
# AIDO logo, favicon, name and links.
|
||||||
|
#
|
||||||
|
# It is always used together with an upstream base file, e.g.:
|
||||||
|
# docker compose --project-directory . \
|
||||||
|
# -f onyx/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml \
|
||||||
|
# -f docker-compose.branding.yml build web_server
|
||||||
|
#
|
||||||
|
# (The Makefile in this directory wraps that for you: `make rebrand`.)
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
services:
|
||||||
|
web_server:
|
||||||
|
# Tag the branded image under our own name so it never clobbers the official
|
||||||
|
# onyxdotapp/onyx-web-server image in the local cache.
|
||||||
|
image: livtec/aido-web:${AIDO_TAG:-local}
|
||||||
|
build:
|
||||||
|
# Project directory is the repo root (--project-directory .), so point the
|
||||||
|
# build context at the branded source. Everything else inherits from the
|
||||||
|
# upstream base file (Dockerfile, NEXT_PUBLIC build args).
|
||||||
|
context: ./onyx/web
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
pull_policy: never
|
||||||
Loading…
Add table
Reference in a new issue