1217 Commits

Author SHA1 Message Date
UNITRONIX db46242023 Preserve DB config, PG compatibility & logging
Preserve existing DB config during update/repair and add PostgreSQL compatibility and reliability fixes. Added preserve_database_config()/Preserve-DatabaseConfig and invoked them before console reinstall in betterdesk.sh and betterdesk.ps1 to avoid unintentionally switching PostgreSQL → SQLite. Fixed folder/user route responses to use result.id (Postgres-compatible) in web-nodejs routes. Added automatic TOTP column migrations for both SQLite and Postgres in web-nodejs/services/dbAdapter.js. Improved relay error logging and write-error handling in betterdesk-server/relay (server.go, ws.go). Updated docs and tooling: added SELinux troubleshooting (DOCKER_TROUBLESHOOTING.md), Windows build/usage notes for the migrate tool (README.md), and updated changelog/instructions (.github/copilot-instructions.md) and last-updated date.
2026-03-13 23:14:06 +01:00
UNITRONIX 447c22af48 SELinux volume helper, folder fixes, Synology docs
Add create_data_directory helper to prepare Docker data volumes with proper permissions and optional SELinux (svirt_sandbox_file_t) support, and use it in install/migrate flows with user guidance on failures. Add comprehensive SYNOLOGY_INSTALLATION.md with Synology/Portainer/container-manager/docker-compose setup, firewall, troubleshooting and update instructions. Update DB adapters (SQLite/Postgres) to treat device_folder_assignments as the single source of truth: clear assignments on folder delete, stop writing folder_id into peer table, and make getUnassignedDeviceCount resilient by trying 'peers' then 'peer' schemas and returning -1 on error. Minor UI tweaks: add console.error on folder assignment failure and add WIP banners/margin adjustments to remote viewer pages.
2026-03-13 00:45:53 +01:00
UNITRONIX e20c7663e5 docs: enhance Nginx HTTPS & WebSocket setup
Expand Nginx example and docs to properly support WebSocket and large uploads. Adds an Upgrade map, increases client_max_body_size, separates /ws/ location with WebSocket upgrade headers, disables proxy_buffering, enables long timeouts and keepalive, and preserves proxy headers for standard HTTP routes. Also adds nginx -t validation, troubleshooting steps (curl test, logs, agent reachability), and optional proxy blocks and notes for BetterDesk Go WebSocket ports (21118/21119). These changes improve reliability for the Web Remote Client and clarify deployment guidance.
2026-03-10 22:54:34 +01:00
UNITRONIX d717331041 Save credentials, handle paths, track folders
Multiple updates to improve cross-platform path handling, credential persistence, and folder assignment tracking.

- betterdesk.ps1: Check both console and RustDesk credential locations when backing up; save reset admin password to both console and RustDesk locations, create console data dir if missing, and print info messages.
- web-nodejs/reset-password.js & scripts/reset-password.js: Use platform-aware default DB/data paths (Windows/Linux), consider extra env vars, and default to a data subdirectory when not found.
- web-nodejs/routes/rustdesk-api.routes.js: Await async generateAccessToken calls to ensure tokens are generated before continuing.
- web-nodejs/services/dbAdapter.js: Update assignDeviceToFolder for SQLite and Postgres to maintain a device_folder_assignments table (insert/update or delete as appropriate) and remove assignments when folders are deleted; also fix a Postgres JSONB cast.

These changes unify credential storage, improve Windows support, fix an async bug, and add explicit folder assignment tracking used by getAllFolderAssignments.
2026-03-09 23:30:33 +01:00
UNITRONIX e981bbefb0 Merge branch 'main' of https://github.com/UNITRONIX/BetterDesk 2026-03-08 12:51:26 +01:00
UNITRONIX d2faa79477 Allow fallthrough for /api/users and /api/peers
Detect absent Bearer tokens in RustDesk API handlers and fall through to panel routes. Updated rustdesk-api.routes.js to accept next(), extract the Bearer token, call next('route') when no token is present so session-cookie-based panel requests reach their intended handlers, and return a clearer error for invalid tokens. Also updated .github/copilot-instructions.md changelog to record the fix (Phase 10) and update the last-modified date.
2026-03-08 12:51:23 +01:00
UNITRONIX 19ff24d3e1 Update README.md 2026-03-07 22:09:06 +01:00
UNITRONIX fbe46ec30a Update README.md 2026-03-07 22:08:09 +01:00
UNITRONIX 36365b4573 Docs: rename HBBS to BetterDesk, add client API
Rename HBBS configuration and docs to BETTERDESK (HBBS_API_URL/HBBS_API_KEY -> BETTERDESK_API_URL/BETTERDESK_API_KEY) and update web-nodejs README to use the new env var and API client name (hbbsApi.js -> betterdeskApi.js). Add a RustDesk Client Endpoints section documenting compatibility endpoints (login, ab, heartbeat, sysinfo, etc.) served on the management API port (21114). Clarify project status as a clean-room implementation, document the archive/ directory policy (AGPL legacy code excluded from releases), include a trademark notice for RustDesk, and add a commercial licensing note.
2026-03-06 23:54:28 +01:00
UNITRONIX 113be92e0b Merge branch 'main' of https://github.com/UNITRONIX/Rustdesk-FreeConsole 2026-03-06 23:45:49 +01:00
UNITRONIX 6f5c6b09bb Switch to Apache-2.0, update docs & Dockerfiles
Replace AGPL-3.0 with Apache License 2.0 across the repository and update related documentation and metadata. Remove legacy RustDesk-specific architecture docs, delete deprecated Dockerfile.hbbr, rename Dockerfile.hbbs → Dockerfile.server and update docker-compose / install scripts to use it. Add Apache license headers to protobuf defs, remove obsolete web service (hbbsApi.js), and adjust README, CONTRIBUTING and PROJECT_STRUCTURE to reflect the license and commercial/clean-room notices. Includes a small formatting tweak in client_api_handlers.go.
2026-03-06 23:45:46 +01:00
UNITRONIX eb0e48807e Add files via upload 2026-03-06 23:18:26 +01:00
UNITRONIX 7605261a80 Add fallback for color sanitization
Add a _sanitizeColorFallback to provide a safe default ('#808080') when Utils.sanitizeColor is missing (older utils.js on server). Update folder rendering to use (Utils.sanitizeColor || _sanitizeColorFallback) to avoid runtime errors and ensure invalid or missing colors are handled gracefully.
2026-03-06 21:16:51 +01:00
UNITRONIX 35542b6088 Add folder device counts and tweak RustDesk API
• UI: Ensure folder counts update correctly — call updateFolderCounts after devices load, fix unassigned filtering, and compute per-folder counts from the devices array (web-nodejs/public/js/devices.js).
• API: Enrich folder objects with device_count by aggregating folder assignments (web-nodejs/routes/folders.routes.js).
• RustDesk compatibility: Add missing "grp" field to RustDesk user payloads in Go and JS, change /api/login-options responses to an empty string, and register POST /api/currentUser alongside GET to support client expectations (betterdesk-server and web-nodejs/rustdesk routes).
• Minor: Small comment formatting tweaks in server handlers.

These changes fix folder count display bugs in the web UI and align server responses with RustDesk client expectations.
2026-03-06 20:50:55 +01:00
UNITRONIX 4ed5888344 Expose peer platform and normalize status/os
Add a Platform field to peer JSON responses (list and get) so the frontend can read p.OS. Update serverBackend to overlay sysinfo from auth.db onto peers (hostname, platform, os, version) so richer client-reported data is available. Update frontend (deviceDetail.js, devices.js) to prefer platform or fallback to os, use that for platform icons/labels, and normalize status_tier to lowercase for consistent CSS classes and i18n keys (including status badge re-rendering). These changes ensure platform info is shown reliably and status styling/labels are consistent.
2026-03-06 02:06:51 +01:00
UNITRONIX 0496b1dbc4 Add client API, sysinfo endpoints and Docker
Add RustDesk-compatible client API and telemetry support and introduce a single-container Docker build. New client_api_handlers.go implements /api/login, /api/login-options, /api/logout, /api/currentUser, /api/ab, /api/heartbeat, /api/sysinfo and /api/sysinfo_ver with TOTP flow and an in-memory TFA session store; auth middleware and Server registration updated accordingly. Database interface and SQLite/Postgres implementations gain UpdatePeerSysinfo (with tests), audit actions for sysinfo, and handleGetPeer now returns live_online/live_status. Also add Dockerfile, docker-compose.single.yml, supervisord entrypoint, UI fixes (QR color inversion, 403 error view), labels file, README updates, and other ancillary changes.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
Co-Authored-By: marcosacramento <marcosacramento@gmail.com>
Co-Authored-By: Charles Olivier Savignac <1275666+sircharlo@users.noreply.github.com>
2026-03-06 01:08:10 +01:00
UNITRONIX f3ad154e7a Force admin password update and CSRF fixes
Ensure freshly generated admin passwords are actually applied on reinstall and make CSRF handling more robust. Install scripts (Docker, POSH, sh) now remove stale auth.db from the console_data/data volume or data dir and create a .force_password_update sentinel (Docker also sets FORCE_PASSWORD_UPDATE=true) so the Node.js console will force-update the admin password. web-nodejs/services/authService.js adds checkForcePasswordUpdate() (env var or sentinel) and will forcibly update the admin bcrypt hash when requested; sentinel files are removed after detection. CSRF middleware now only generates tokens for safe methods (GET/HEAD/OPTIONS), avoids interfering with state-changing requests, and clears corrupt cookies using consistent options (httpOnly, sameSite: 'lax', secure based on config) to prevent spurious 403s. server.js mounts rustdeskApiRoutes before CSRF so bearer-token desktop clients are not blocked by cookie-based CSRF. Also unified the health check path from /api/health to /health in diagnostics checks and added required fs/path imports.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
2026-03-05 22:42:14 +01:00
UNITRONIX 3f8e731db8 Add LAN relay, peer sync, QR & SSL updates
Multiple improvements across server, scripts and console:

- DB: add totp_recovery_codes column to users (Postgres + SQLite) and migration entries.
- Signal server: implement LAN-aware logic (isSameNetwork), detect LAN IP, add getLANRelayServer, use LAN relay for punchhole/relay flows, and enhance RelayResponse handling (IP-based sender lookup). Matches Rust hbbs behavior for local /24 detection.
- Node.js console: add server config QR generation (rustdesk://config/<b64-json>), fix address-book endpoints to safely return JSON strings, and implement Go↔Node peer sync bridges for both SQLite and Postgres (sync peers from Go 'peers' table into console 'peer' table with fallbacks).
- Scripts: update firewall port lists and add SSL-aware .env handling (switch HBBS/BETTERDESK API URLs to https when enabling TLS, set NODE_EXTRA_CA_CERTS for self-signed certs), and restart both server and console services after changes.

These changes improve LAN connectivity, keep the web console in sync with the Go signal server, and ensure console/server URLs and firewall rules match TLS configuration.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
2026-03-05 21:43:32 +01:00
UNITRONIX f239f791fd Enhance diagnostics, API checks, TOTP updates
betterdesk.sh: Improve diagnostics and DB visibility by detecting DB type (SQLite vs PostgreSQL), masking passwords in DATABASE_URL, and reporting PostgreSQL counts via psql when available. Add clearer messages when SQLite file is missing and list DB type in diagnostics. Detect Go server TLS via systemd service args, switch API health checks to /api/health, default API port to 21114, and warn about TLS/HTTP mismatches between server and console. Also update service identifier strings in port definitions.

web-nodejs/middleware/security.js: Add browsing-topics to Permissions-Policy header to suppress Chrome warnings.

web-nodejs/routes/auth.routes.js: Fix async handling by awaiting authService methods (verifyRecoveryCode, verifyTotpCode, isTotpEnabled, verifyAndEnableTotp, disableTotp) and replace direct bcrypt compare with authService.verifyPassword to support multiple hash schemes. Make TOTP status endpoint async with error handling.

Overall: adds better runtime diagnostics, TLS mismatch detection, and fixes asynchronous/auth verification bugs.
Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
2026-03-05 01:22:40 +01:00
UNITRONIX edba7c5da6 Improve password reset, auth logging, and i18n
Rework password reset flow and diagnostics: change reset-password.js argument order (password first, optional username) and update Docker/CLI scripts to call it accordingly; persist DEFAULT_ADMIN_PASSWORD to .env and restart betterdesk-console after resets to avoid overwrites. Add translations for an "invalid_credentials" message across supported locales. Harden reset-password.js with a bcrypt self-test, log hash info, and add additional data directory candidates. Enhance authService with detailed auth/logging (hash type, failures/success), safer admin-hash migration logic (avoid overwriting if admin has logged in), and self-tests when creating/updating admin password hashes to detect/retry corrupted hashes.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
2026-03-05 00:55:58 +01:00
UNITRONIX aa9424845a Support Postgres, API key sync, and auth migration
Add PostgreSQL support for the web console password reset and install scripts, and improve cross-language auth handling.

Key changes:
- Introduce a unified reset-password.js that supports SQLite and PostgreSQL (reads DB_TYPE / DATABASE_URL) and make shell/PowerShell/Docker helpers prefer it with fallbacks.
- Update betterdesk-server to load an API key from API_KEY or .api_key (key/db dirs) and sync it into the database so Go server and Node console share the same key.
- Adjust docker-compose default command to run the all-in-one mode and point at the bundled DB/key paths.
- Improve dashboard health checks to avoid raw TCP probes in single-binary BetterDesk mode and derive signal/relay status from the API health; allow /api/currentUser to accept POST as well as GET.
- Enhance authService to recognize Go-style PBKDF2 hashes, verify them, auto-migrate verified PBKDF2 hashes to bcrypt, and migrate default admin if needed.

These changes improve interoperability between the Go server and Node console (shared API key and DB modes), add Postgres support for admin tooling, and provide a smooth auth migration path from the Go server's hashing scheme to bcrypt.

Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
2026-03-05 00:21:56 +01:00
UNITRONIX bc45956bb7 TCP/WS signaling fixes; branding & DB refactor
Make TCP and WebSocket signal handling consistent with UDP by sending immediate PunchHoleResponse/RelayResponse (including signed PK, socket_addr, relay server and NAT type) to initiators; add ForceRelay/AlwaysUseRelay handling and ensure WS uses TCP handler. Sign peer PKs for E2E verification and keep TCP keep-alive behavior for later updates.

Refactor web-nodejs branding and backup/database code: introduce async branding cache (loadBranding) and async save/reset/import APIs, add branding_config table and DB adapter methods (SQLite/Postgres) plus backup helper methods (getAllUsersForBackup, getAllAddressBooks, restoreUsers, getBackupStats). Update routes/services to use new async DB APIs, warm branding cache at server startup, and adjust heartbeat/register flows to use db helpers. Minor server error page i18n fallbacks and hbbs backend compatibility guard updated.

Also update docs (.github/copilot-instructions.md) to record the TCP signaling fix and Phase 7 resolution.

Co-Authored-By: Charles Olivier Savignac <1275666+sircharlo@users.noreply.github.com>
2026-03-04 22:58:35 +01:00
UNITRONIX 00451634c7 Await DB operations in route handlers
Convert many Express route handlers and helper functions to async and await database calls (e.g. getAccessToken, touchAccessToken, getPeerById, getDevice, getPeerSysinfo, upsertPeerSysinfo, logAction, insertAudit*, getAll*/count* etc.). Also made identifyDevice and several route callbacks async, adjusted session.regenerate callback to use async logging, and replaced db.getDatabase() usage with db.getDb() where applicable. These changes ensure DB operations complete before responding and reduce race conditions/unhandled-promise behavior across numerous route files (activity, auth, automation, bd-api, devices, folders, i18n, inventory, registration, remote, rustdesk-api, and related route handlers).

Co-Authored-By: Charles Olivier Savignac <1275666+sircharlo@users.noreply.github.com>
2026-03-03 22:57:10 +01:00
UNITRONIX 751c73a39d Add rebuild & deploy flow for Go server
Introduce an interactive Build & Deploy submenu in both PowerShell and Bash scripts to rebuild the Go server from source and safely deploy it. Adds three options: rebuild & deploy (compile → backup → stop → replace → start → verify with automatic rollback on failure), compile-only, and legacy Rust build. Implements new functions (Do-RebuildGoServer / do_rebuild_go_server, Do-CompileGoOnly / do_compile_go_only, Do-BuildLegacyRust / do_build_legacy_rust), adds backups, service stop/start and verification steps, improved messages, and small UX updates to the main build menu labels. This enables safe on-host compilation and deployment of the betterdesk server across both shells.
2026-03-03 00:05:27 +01:00
UNITRONIX 2411ae66d6 fix: add incremental column migrations for legacy databases
Fixes 'table users has no column named totp_secret' error when upgrading
from older database schemas. The existing Migrate() used CREATE TABLE IF
NOT EXISTS which is a no-op when the table already exists with a different
schema.

SQLite (db/sqlite.go):
- Added hasColumn() helper using PRAGMA table_info
- Added column migration loop after CREATE TABLE statements:
  - users: totp_secret, totp_enabled (v2.3.0)
  - peers: banned, ban_reason, banned_at (v2.1.0)
  - peers: tags (v2.2.0)
  - peers: heartbeat_seq (v2.3.0)
- Moved idx_peers_banned index creation to deferred section (after
  column migrations, to avoid 'no such column' on legacy schemas)
- Column existence check prevents errors on repeat migrations

PostgreSQL (db/postgres.go):
- Added equivalent column migrations using native
  ADD COLUMN IF NOT EXISTS syntax

Tests (db/sqlite_test.go):
- TestMigrateUpgradesLegacySchema: creates a minimal legacy schema
  (no totp/ban/tags columns), runs Migrate(), then verifies CreateUser
  and BanPeer work correctly with the newly added columns.
  Also verifies idempotency (second Migrate() is safe).
2026-03-02 22:51:42 +01:00
UNITRONIX 5784fc5365 fix: enforce ban across all connection paths (signal, relay, WS, Client API)
Critical security fix  banning a device in the web console now actually
blocks that device from:

Go Server (signal/handler.go):
- handleRegisterPeer: reject banned peers on UDP heartbeat
- handleRegisterPeer: check DB IsPeerBanned for new peer registration
- handlePunchHoleRequestTCP: reject connections to banned targets
- handleRequestRelay (UDP): reject relay to banned targets
- handleRequestRelayTCP: reject relay to banned targets

Go Server (signal/ws.go):
- handleRegisterPeerWS: reject banned peers on WS heartbeat
- handleRegisterPeerWS: check DB for new WS registrations

Go Server (api/server.go):
- handleBanPeer: remove peer from memory map (immediate disconnect)
- handleBanPeer: update DB peer status to OFFLINE

Node.js Client API (rustdesk-api.routes.js):
- POST /api/heartbeat: reject heartbeats from banned devices
- POST /api/sysinfo: reject sysinfo from banned devices
- POST /api/login: reject login from banned devices

Root cause: ban flag (entry.Banned / is_banned) was correctly stored in
database and memory but never checked in any signal handler. The signal
handler only checked the separate blocklist system (IsIPBlocked/IsIDBlocked)
which is a completely different feature. Banned peers continued to register,
heartbeat, and participate in PunchHole/Relay operations normally.

Added test: TestBanRemovesPeerFromMap verifies end-to-end that banning via
API removes the peer from the in-memory map and sets OFFLINE status.
2026-03-02 22:46:31 +01:00
UNITRONIX eaa7089185 docs: add Pro features activation guide to RustDesk client configuration
Adds a new 'Enabling Pro Features' section explaining how to configure
the RustDesk desktop client to activate Pro-level features via the
BetterDesk API Server (port 21121). Includes:

- Step-by-step activation instructions
- Feature comparison table (Without API vs With API + Login): address
  book sync, device/user groups, audit trail, heartbeat, sysinfo,
  metrics, file transfer audit, security alarms, access strategies,
  multi-device login, TOTP 2FA
- Verification steps to confirm Pro mode is active
- Mass deployment instructions with config string and CLI flag
- Updated Table of Contents with new subsection
2026-03-02 22:16:34 +01:00
UNITRONIX 3ca1df0706 fix: arithmetic crash kills script before start_services, broken self-signed cert detection
CRITICAL BUG #1: ((total++)) with total=0 returns exit code 1 in bash.
With set -e, this kills the entire script at configure_firewall_rules()
before start_services() is ever reached. Services stay 'inactive' because
they were never started. Affects betterdesk.sh and betterdesk-docker.sh.

Fix: Replace all ((var++)) with var=\  safe assignment form
that never returns non-zero exit code. Fixed 30+ occurrences across both
bash scripts (firewall rules, diagnostics, timer loops, validation).

CRITICAL BUG #2: Self-signed cert detection in setup_services() is
completely non-functional on OpenSSL 3.x (Ubuntu 24.04):
- openssl -issuer outputs 'issuer=CN = ...' and -subject outputs
  'subject=CN = ...'  the prefixes differ so they can NEVER be equal
- grep 'O=BetterDesk' fails because OpenSSL 3.x outputs 'O = BetterDesk'
  with spaces around the equals sign
Both detection methods fail  -force-https is ALWAYS added  Go API
rejects HTTP from Node.js console  all API calls fail.

Fix: Strip issuer=/subject= prefix with sed before comparison, and use
case-insensitive grep for 'BetterDesk' without assuming O= format.

Additional improvements:
- Post-install verification: after start_services, check systemctl state
  of both services and show clear error/debug instructions if not active
- Tooltips for database selection: detailed descriptions for SQLite vs
  PostgreSQL including capacity guidance and requirements
- Added DIM color variable for tooltip text styling
2026-03-02 21:59:31 +01:00
UNITRONIX a06e9e70fb fix: TLS self-signed cert breaking services + npm error handling + status diagnostics
Critical fixes for fresh installation reliability:

betterdesk.sh:
- Remove -force-https for auto-generated self-signed certificates
  (was breaking Node.js <-> Go API communication on fresh installs)
- Keep -tls-signal and -tls-relay for client encryption
- Add self-signed cert detection (issuer==subject or O=BetterDesk)
- Add NODE_EXTRA_CA_CERTS to console service for self-signed cert trust
- Fix npm install: proper exit code checking instead of pipe (silently failed)
- Improve status display: show Failed/Starting states with journalctl hints
- Add diagnostic info when service start fails (state + journalctl command)
- Better console failure messages with probable causes

betterdesk.ps1:
- Same TLS fix: no -force-https for self-signed certs
- X509Certificate2 analysis to detect self-signed vs proper certs
- Add NODE_EXTRA_CA_CERTS to NSSM console environment
- Fix npm install: check LASTEXITCODE and fail properly
- Improve status display: show Stopped state with log file hints
- Refactor NSSM env vars to array for maintainability
2026-03-02 17:55:09 +01:00
UNITRONIX 3ea69424d1 fix: 10 critical/high/medium installation bugs across all scripts
CRITICAL fixes:
- PS1: Start-Services and Start-ServicesWithVerification now start
  BetterDeskServer (Go) instead of legacy BetterDeskSignal/Relay (hbbs/hbbr).
  Go server was NEVER started after installation.
- PS1: Stop-AllServices now kills betterdesk-server process (was only
  killing legacy hbbs/hbbr)
- Docker: Dockerfile.hbbs CMD replaced invalid -dir flag (Go server has
  no -dir) with correct -mode all -db -key-file flags. Container was
  crashing immediately on startup.

HIGH fixes:
- All scripts: Generate .api_key file and inject into Go server DB
  (server_config table) after startup. Node.js <-> Go API communication
  was completely broken (empty X-API-Key header).
- All scripts: Pass -init-admin-pass to Go server with same password as
  Node.js console. Previously two separate admin accounts with different
  passwords were created.
- betterdesk.sh: API_PORT default changed from 21120 to 21114 to match
  Go server default and be consistent with PS1/Docker/docs.

MEDIUM fixes:
- PS1: Test-ServiceHealth updated to detect betterdesk-server and node
  processes (was hardcoded to hbbs/hbbr/python)
- Docker: Added RELAY_SERVERS env var to compose (clients need relay
  address for connections)
- Docker: Removed legacy ENCRYPTED_ONLY=1 env var (Go server ignores it)
- Docker: Added DEFAULT_ADMIN_PASSWORD + KEYS_PATH to console env vars
- Docker: Added sqlite package to runtime image for API key injection
2026-03-02 17:17:52 +01:00
UNITRONIX 9aa9112781 fix: replace invalid -relay flag with -relay-servers in ExecStart
The Go server does not have a -relay flag (that was old hbbs syntax).
It has -relay-servers for comma-separated relay addresses. The invalid
flag caused flag.Parse() to fail with exit code 2 (INVALIDARGUMENT),
printing the help text and crashing the service.

Fixed in: betterdesk.sh (systemd ExecStart), betterdesk.ps1 (NSSM args
+ ScheduledTask args).
2026-03-02 11:17:37 +01:00
UNITRONIX 98ef0fb061 feat: enhance firewall config, diagnostics & install summary in Docker/PS1 scripts
betterdesk-docker.sh:
- Add configure_firewall_rules() function (ufw/firewalld/iptables)
- Replace basic diagnostics with comprehensive version:
  port diagnostics with conflict detection, firewall status checks,
  API connectivity test, diagnostics sub-menu (F=firewall, P=port test)
- Enhanced install summary: public key, required ports, RustDesk client
  configuration section, auto-configure firewall during install

betterdesk.ps1:
- Fix Do-Diagnostics: replace legacy hbbs/hbbr process checks with
  betterdesk-server (with legacy fallback + warning)
- Update port Expected values: hbbs/hbbr -> betterdesk-server
- Update API label: HBBS API -> Server API
- Enhanced install summary: required ports list, RustDesk client
  configuration section, auto-configure Windows Firewall during install
2026-03-02 11:05:15 +01:00
UNITRONIX dd47b6c5b7 Fix database validation: support PostgreSQL and pre-start SQLite detection
- detect_installation(): Read DB_TYPE from .env to detect PostgreSQL
- do_validate() (sh): Full PostgreSQL validation with table checks
- Do-Validate (ps1): Fix binary check (Go server instead of hbbs/hbbr)
- Do-Validate (ps1): Support PostgreSQL in database validation
- SQLite: Downgrade to warning when file not yet created (Go creates on start)
2026-03-02 08:22:32 +01:00
UNITRONIX 78b6f252a5 Bump Go version to 1.25.0 in installers (match go.mod) 2026-03-02 08:06:31 +01:00
UNITRONIX ecd82d5975 Merge branch 'main' of https://github.com/UNITRONIX/Rustdesk-FreeConsole 2026-03-02 07:59:26 +01:00
UNITRONIX 8d952e4ba1 Add password auth helpers; remove legacy dev scripts
Add a new auth package implementing password hashing/verification (PBKDF2-HMAC-SHA256), a random-string generator, and unit tests. Update .gitignore to catch additional sensitive filenames and to ignore legacy dev scripts, migrations, templates and build artifacts. Remove many legacy/dev helper scripts (dev_modules/, scripts/legacy/, build_windows.sh, migrations/, templates/) and add web-nodejs reset-password scripts and a session secret placeholder. Changes consolidate authentication utilities and clean up old/unused development tooling and noise in the repo.
2026-03-02 07:59:24 +01:00
UNITRONIX cd9d94619e Add files via upload 2026-03-02 00:45:07 +01:00
UNITRONIX e855f5786d Add Go server and security audit; update web console
Add a new betterdesk-server Go codebase (server, api, auth, db, relay, signal, metrics, audit, ratelimit, proto, tools, tests) and related deployment/migration scripts. Add a comprehensive SECURITY_AUDIT_2026-03-01 report and .gitattributes; update copilot-instructions (ALL-IN-ONE v2.4.0), README, VERSION, Dockerfiles, scripts, docker-compose and entrypoint. Large updates to web-nodejs (translations, routes, services, frontend assets and middleware) and numerous new utilities; remove legacy Flask web files and archive hbbs-patch-v2 artifacts. Prepares repository for PostgreSQL support, DB migration tooling and the new Go server as the production backend.
2026-03-02 00:43:04 +01:00
UNITRONIX 49241ed20e Bump server to v2.1.3 and add firewall checks
Release-related update to v2.1.3: replace hbbs/hbbr binaries and update all SHA256 checksums and CHECKSUMS.md. Add robust firewall/port diagnostics and auto-configuration: implements firewall rule checks and creation in betterdesk.ps1 and betterdesk.sh, enhances diagnostics (port conflict detection, external port test) and introduces Check-PortStatus/Configure-Firewall helpers. Make HBBS API key path flexible in Rust (env var / Windows-friendly .api_key fallback) and persist permissions correctly. Node.js console: load .env as a fallback for Windows NSSM, make KEYS_PATH default to C:\BetterDesk on Windows, improve JSON parsing for login/TOTP responses, ensure API routes return JSON on errors, and add periodic HBBS online-status sync. Misc: update server/client API port to include 21121 (client API), adjust docs, and minor service/env environment improvements for NSSM/systemd.

Co-Authored-By: PlasmPlayer <153363510+PlasmPlayer@users.noreply.github.com>
Co-Authored-By: boruto79 <176351662+boruto79@users.noreply.github.com>
Co-Authored-By: MrBrodacz - Design <215021251+MrBrodacz2025@users.noreply.github.com>
2026-02-24 00:01:44 +01:00
UNITRONIX 6ccf7c6130 Add Docker migration and branding UI
Introduce an interactive Docker migration flow and branding/theme support. Adds automatic/manual RustDesk-to-BetterDesk migration logic and menu option (betterdesk-docker.sh), plus a full migration guide (docs/DOCKER_MIGRATION.md) and README updates. Switches project license references to AGPL-3.0 and updates LICENSE locations for hbbs patches. Web console enhancements: new branding service and default theme, i18n middleware now injects branding, extended translations (en/pl), settings UI/JS and CSS for branding/theming, and login JS updated to include CSRF token. Also includes various view/template updates to surface branding across the UI.
2026-02-22 15:22:44 +01:00
UNITRONIX 12d195ff78 Release v2.3.0: Node.js console & security
Bump to v2.3.0 and switch to Node.js web console as the primary console (Flask deprecated). Add comprehensive security and feature updates: CSRF protection, session-fixation prevention, timing-safe auth, WebSocket auth, TOTP 2FA, operator/admin roles, address-book sync, desktop connect (URI handler), and SSL certificate configuration in installers. Introduce a dedicated RustDesk Client API (WAN port 21121) and related web-nodejs middleware, routes, views, protos, and client JS (rdclient) plus vendor libs. Add developer tooling and scripts (dev_modules), update hbbs-patch-v2 Rust sources, README and changelog/docs, and ignore Node.js artifacts in .gitignore.
2026-02-22 03:44:00 +01:00
UNITRONIX fd217bc385 Bump to v2.2.1: Node.js console env/admin fixes
Bump release to v2.2.1 and fix Node.js web-console installation and update flow. Changes include: generate and persist a random DEFAULT_ADMIN_PASSWORD for the Node.js console, always write a .env with corrected path variables (RUSTDESK_DIR/KEYS_PATH/DB_PATH/DATA_DIR/HBBS_API_URL), save admin creds to .admin_credentials and display them after install/update, load .env from systemd using EnvironmentFile and expose needed envs in the service unit, and ensure Do-Update installs services and creates the admin. The create_admin_user logic now detects Node.js vs Flask consoles (reading stored Node.js creds or creating Flask DB user). Also update web-nodejs config to accept multiple env var names and use a safe default for KEYS_PATH, and refresh project docs/version metadata.
2026-02-17 21:53:24 +01:00
UNITRONIX 32e29723e4 Add Node.js web console and update to v2.2.0
Introduce a new Node.js-based web console (Express + EJS + better-sqlite3) under web-nodejs/ and add installer support to choose between Node.js and the legacy Flask console. Update interactive ALL-IN-ONE installers (betterdesk.sh, betterdesk.ps1) with flags/options for --nodejs/--flask, automatic Node.js installation, migration logic, enhanced service handling and diagnostics. Bump VERSION to 2.2.0 and update README and project docs (.github/copilot-instructions.md) to reflect the new console, usage examples, and Docker/docs changes. Many new web-nodejs files and supporting middleware/services/routes/views/static assets were added to support the new console.
2026-02-17 10:59:46 +01:00
UNITRONIX bdadbe592b v2.1.2: update checksums and add relay server
Bump release to v2.1.2: update version strings and SHA256 checksums in docs and installer scripts (betterdesk.sh, betterdesk.ps1, CHECKSUMS.md). Replace several hbbs/hbbr binaries under hbbs-patch-v2. Add a new relay_server.rs implementing the relay logic: websocket support, blacklist/blocklist, per-device ban check (fixes banning whole IPs), bandwidth limiting, usage metrics, admin commands via loopback, and runtime tuning via environment variables. Minor metadata/date updates included.
2026-02-13 06:46:06 +01:00
UNITRONIX 991fa0fcfb Add non-interactive auto mode for migrations
Enable unattended migrations and safer install flow.

- Export BETTERDESK_AUTO=1 from betterdesk.sh when AUTO_MODE is enabled, and unset it after running migrations so migration scripts can run in automatic (non-interactive) mode.
- Make migration runner capture command output and emit a warning if a migration returns a non-zero exit code instead of silently ignoring stderr.
- Stop existing services briefly during install to avoid "Text file busy" errors.
- Update migration scripts (v1.0.1, v1.1.0, v1.4.0, v1.4.1, v1.5.0) to add is_auto_mode helpers and branch prompts/backup handling when BETTERDESK_AUTO is set, allowing confirmation prompts and backup overwrites to proceed automatically.

These changes make automated installations/migrations more robust and provide clearer feedback when migrations behave unexpectedly.
2026-02-12 20:50:00 +01:00
UNITRONIX c11b5af5ab feat(i18n): Complete i18n integration across all web templates
- Add data-i18n attributes to index.html (Dashboard, Public Key, Settings, User Management, About, Modals)
- Add data-i18n attributes to login.html
- Add data-i18n attributes to client_generator.html (sidebar, header)
- Add i18n.js initialization to client_generator.html
- Update en.json with missing auth keys (sign_in, enter_username, enter_password)
- Update pl.json with complete Polish translations

All UI elements now support dynamic language switching.
2026-02-12 00:13:47 +01:00
UNITRONIX 16706bd03f fix(i18n): Pass csrf to i18n.init_app for upload/delete endpoints 2026-02-11 23:58:57 +01:00
UNITRONIX 3125d2a69d feat(i18n): Add internationalization system with language settings
- Add i18n.py module with translation management and Flask integration
- Add language files: en.json (English), pl.json (Polish)
- Add i18n.js client-side translation loading
- Add i18n.css for language selector styling
- Add Language Settings section in Settings page
- Add custom language pack upload/delete functionality
- Add CSRF exemption for i18n POST endpoints
- Add i18n documentation to README
- Add CONTRIBUTING_TRANSLATIONS.md guide
2026-02-11 23:58:31 +01:00
UNITRONIX 59216f7620 Refactor BetterDesk PowerShell and Dockerfile
Major refactor of betterdesk.ps1: convert to modern PowerShell script with Param/Help, enforce RunAsAdministrator, introduce script-scoped variables, structured logging, Print-* helper functions, auto-mode handling, public IP and password helpers, improved path detection and defaults, binary verification (Verify-*), dependency installation, venv setup for the web console, service setup using NSSM with scheduled-task fallback, and database migration/initialization logic. UI and status output were cleaned up and many functions renamed for clarity. Dockerfile.console: make resolv.conf DNS edits conditional (skip on read-only / Oracle Cloud VCNs) to avoid modifying immutable resolv.conf. .github/copilot-instructions.md: update project status date. These changes improve robustness, non-interactive automation, and Windows service management for BetterDesk.
2026-02-11 23:04:28 +01:00
UNITRONIX d524e9268a Add betterdesk-builder to gitignore (experimental feature) 2026-02-08 16:41:44 +01:00