Files
BetterDesk/docs/important/agent-client-lib-modules.md
UNITRONIX 1508c739b2 fix(api): Go :21114 default API and Node :21121 compat proxy (#160)
RustDesk clients could not log in after v3 when handlers moved to Go but
nothing listened on :21121 (API_ENABLED off) or Go bound the wrong port.
Go serves /api/login on 21114; the console proxies legacy :21121 URLs to
Go. Installers repair .env/systemd, Docker publishes both ports, and
firewall rules allow 21114 and 21121 on full installs.

Also includes betterdesk-support-agent (Fyne desktop helper) and
docs/important/ operator notes (API ports, update flow, agent roadmap).
2026-06-03 02:16:24 +02:00

3.6 KiB

Agent/MGMT client src/lib/ gotcha

Root .gitignore originally had lib/ + lib64/ (Python distutils remnants) which silently excluded BOTH betterdesk-agent-client/src/lib/ and betterdesk-mgmt/src/lib/.

These directories contain i18n.ts and logger.ts that ~13 TSX components import. They were never committed → fresh clones cannot build (vite: "Could not resolve ./lib/logger").

Fixed 2026-05-27 by changing rule to /lib/ + /lib64/ (root-anchored only). Created betterdesk-agent-client/src/lib/{i18n.ts,logger.ts} from scratch. betterdesk-mgmt/src/lib/ still missing — same fix applies when that client is next built.

API contracts

  • i18n.ts: initI18n(), t(key, params?), setLocale(code), getLocale(), getAvailableLocales(), getLocaleDisplayName(code), onLocaleChange(cb). Bundles loaded via static JSON imports from ../locales/{en,pl,zh-TW}.json. Locale persisted to localStorage key betterdesk-agent-locale.
  • logger.ts: frontendLog(level, scope, message, data?) and installFrontendErrorLogging(). Forwards via Tauri IPC command log_frontend_event (defined in src-tauri/src/commands.rs). Payload: {level, scope, message, data} where data may be null.

Build deps on Fedora

  • nodejs + npm (dnf install nodejs npm — installs nodejs22)
  • libxdo-devel (enigo crate for input injection)
  • gtk3/webkit2gtk-4.1/libappindicator-gtk3/librsvg2/libsoup3 devel
  • @tauri-apps/api must match tauri Rust crate minor version (mismatch errors out at build start; pin in package.json)

Build commands

cd betterdesk-agent-client
npm install
npm run tauri -- build --bundles rpm   # Fedora
# Output: src-tauri/target/release/bundle/rpm/BetterDesk Agent-*.rpm
sudo dnf install -y ./BetterDesk\ Agent-*.rpm
/usr/bin/betterdesk-agent-client       # launches with tray icon
```# Agent/MGMT client `src/lib/` gotcha

Root `.gitignore` originally had `lib/` + `lib64/` (Python distutils
remnants) which silently excluded BOTH
`betterdesk-agent-client/src/lib/` and `betterdesk-mgmt/src/lib/`.

These directories contain `i18n.ts` and `logger.ts` that ~13 TSX
components import. They were never committed → fresh clones cannot
build (vite: "Could not resolve ./lib/logger").

Fixed 2026-05-27 by changing rule to `/lib/` + `/lib64/` (root-anchored
only). Created `betterdesk-agent-client/src/lib/{i18n.ts,logger.ts}`
from scratch. `betterdesk-mgmt/src/lib/` still missing — same fix
applies when that client is next built.

## API contracts
- `i18n.ts`: `initI18n()`, `t(key, params?)`, `setLocale(code)`,
  `getLocale()`, `getAvailableLocales()`, `getLocaleDisplayName(code)`,
  `onLocaleChange(cb)`. Bundles loaded via static JSON imports from
  `../locales/{en,pl,zh-TW}.json`. Locale persisted to localStorage
  key `betterdesk-agent-locale`.
- `logger.ts`: `frontendLog(level, scope, message, data?)` and
  `installFrontendErrorLogging()`. Forwards via Tauri IPC command
  `log_frontend_event` (defined in `src-tauri/src/commands.rs`).
  Payload: `{level, scope, message, data}` where data may be null.

## Build deps on Fedora
- `nodejs` + `npm` (dnf install nodejs npm — installs nodejs22)
- `libxdo-devel` (enigo crate for input injection)
- gtk3/webkit2gtk-4.1/libappindicator-gtk3/librsvg2/libsoup3 devel
- @tauri-apps/api must match tauri Rust crate minor version
  (mismatch errors out at build start; pin in package.json)

## Build commands

cd betterdesk-agent-client npm install npm run tauri -- build --bundles rpm # Fedora

Output: src-tauri/target/release/bundle/rpm/BetterDesk Agent-*.rpm

sudo dnf install -y ./BetterDesk\ Agent-*.rpm /usr/bin/betterdesk-agent-client # launches with tray icon