mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
release-2.9.0 (#1532)
* fix(macos): skip single-instance lock in Mac App Store builds (#1454)
fix(macos): skip single-instance lock in Mac App Store builds
* Fix/backend optional sharp (#1455)
Fix/backend optional sharp
* feat: issue #1218 (#1218)
https://github.com/Termix-SSH/Support/issues/1218
* feat: Add option to use saved global custom theme under Connection Defaults (#1209)
https://github.com/Termix-SSH/Support/issues/1209
* feat: Add Fleet Sharing functionality to the UI (#1228)
https://github.com/Termix-SSH/Support/issues/1228
* feat: Add a list view to the Docker management page (#1237)
https://github.com/Termix-SSH/Support/issues/1237
* feat: issue #1264 (#1264)
https://github.com/Termix-SSH/Support/issues/1264
* feat: 2FA With FortiToken (#1288)
https://github.com/Termix-SSH/Support/issues/1288
* feat: Allow to disable showing paths to folders (#1274)
https://github.com/Termix-SSH/Support/issues/1274
* feat: Sync Network Graph between Desktop and Remote Server (#1245)
https://github.com/Termix-SSH/Support/issues/1245
* feat: Version Number on offline servers (#1291)
https://github.com/Termix-SSH/Support/issues/1291
* feat: Support OrbStack Docker socket path on macOS / Fix "Docker is not installed" on mac... (#1302)
https://github.com/Termix-SSH/Support/issues/1302
* feat: Sidebar host click should focus existing tab instead of opening a new connection (#1289)
https://github.com/Termix-SSH/Support/issues/1289
* fix: Search in side bar shows overlapping hosts when grouped by tags (#1303)
https://github.com/Termix-SSH/Support/issues/1303
* fix: I can't send a file on its own. (#1304)
https://github.com/Termix-SSH/Support/issues/1304
* fix: sudo password not autofilling (#1248)
https://github.com/Termix-SSH/Support/issues/1248
* fix: node-MainThread (#1300)
https://github.com/Termix-SSH/Support/issues/1300
* fix: Tunnel authentication with shared credentials (#1295)
https://github.com/Termix-SSH/Support/issues/1295
* fix: host key updates not syncing, metrics 404 race on first connect
Host key writes never bumped updatedAt so sync never picked them up.
Also retry the first metrics fetch briefly instead of failing right away.
* chore: increment ver
* feat: add category and icon fields to plugin manifest schema
* ci(deps): bump the github-actions group with 2 updates (#1458)
Bumps the github-actions group with 2 updates: [crowdin/github-action](https://github.com/crowdin/github-action) and [actions/github-script](https://github.com/actions/github-script).
Updates `crowdin/github-action` from 2 to 3
- [Release notes](https://github.com/crowdin/github-action/releases)
- [Commits](https://github.com/crowdin/github-action/compare/v2...v3)
Updates `actions/github-script` from 7 to 9
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v9)
---
updated-dependencies:
- dependency-name: crowdin/github-action
dependency-version: '3'
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
- dependency-name: actions/github-script
dependency-version: '9'
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: github-actions
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps-dev): bump the dev-patch-updates group with 13 updates (#1459)
Bumps the dev-patch-updates group with 13 updates:
| Package | From | To |
| --- | --- | --- |
| [@codemirror/commands](https://github.com/codemirror/commands) | `6.11.0` | `6.11.1` |
| [@codemirror/search](https://github.com/codemirror/search) | `6.7.1` | `6.7.2` |
| [@codemirror/view](https://github.com/codemirror/view) | `6.43.9` | `6.43.12` |
| [@testing-library/dom](https://github.com/testing-library/dom-testing-library) | `10.4.1` | `10.4.2` |
| [@testing-library/react](https://github.com/testing-library/react-testing-library) | `16.3.2` | `16.3.3` |
| [@testing-library/user-event](https://github.com/testing-library/user-event) | `14.6.5` | `14.6.7` |
| [@types/ssh2](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ssh2) | `1.15.5` | `1.15.6` |
| [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `6.1.0` | `6.1.1` |
| [cytoscape](https://github.com/cytoscape/cytoscape.js) | `3.34.1` | `3.34.3` |
| [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) | `0.5.4` | `0.5.7` |
| [i18next](https://github.com/i18next/i18next) | `26.4.0` | `26.4.2` |
| [prettier](https://github.com/prettier/prettier) | `3.9.6` | `3.9.8` |
| [react-i18next](https://github.com/i18next/react-i18next) | `17.0.12` | `17.0.14` |
Updates `@codemirror/commands` from 6.11.0 to 6.11.1
- [Changelog](https://github.com/codemirror/commands/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/commands/commits)
Updates `@codemirror/search` from 6.7.1 to 6.7.2
- [Changelog](https://github.com/codemirror/search/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/search/commits)
Updates `@codemirror/view` from 6.43.9 to 6.43.12
- [Changelog](https://github.com/codemirror/view/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/view/commits)
Updates `@testing-library/dom` from 10.4.1 to 10.4.2
- [Release notes](https://github.com/testing-library/dom-testing-library/releases)
- [Changelog](https://github.com/testing-library/dom-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/dom-testing-library/compare/v10.4.1...v10.4.2)
Updates `@testing-library/react` from 16.3.2 to 16.3.3
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v16.3.2...v16.3.3)
Updates `@testing-library/user-event` from 14.6.5 to 14.6.7
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v14.6.5...v14.6.7)
Updates `@types/ssh2` from 1.15.5 to 1.15.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ssh2)
Updates `@vitejs/plugin-react` from 6.1.0 to 6.1.1
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@6.1.1/packages/plugin-react)
Updates `cytoscape` from 3.34.1 to 3.34.3
- [Release notes](https://github.com/cytoscape/cytoscape.js/releases)
- [Commits](https://github.com/cytoscape/cytoscape.js/compare/v3.34.1...v3.34.3)
Updates `eslint-plugin-react-refresh` from 0.5.4 to 0.5.7
- [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases)
- [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.5.4...v0.5.7)
Updates `i18next` from 26.4.0 to 26.4.2
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v26.4.0...v26.4.2)
Updates `prettier` from 3.9.6 to 3.9.8
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.9.6...3.9.8)
Updates `react-i18next` from 17.0.12 to 17.0.14
- [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/react-i18next/compare/v17.0.12...v17.0.14)
---
updated-dependencies:
- dependency-name: "@codemirror/commands"
dependency-version: 6.11.1
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@codemirror/search"
dependency-version: 6.7.2
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@codemirror/view"
dependency-version: 6.43.12
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@testing-library/dom"
dependency-version: 10.4.2
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@testing-library/react"
dependency-version: 16.3.3
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@testing-library/user-event"
dependency-version: 14.6.7
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@types/ssh2"
dependency-version: 1.15.6
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: "@vitejs/plugin-react"
dependency-version: 6.1.1
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: cytoscape
dependency-version: 3.34.3
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: eslint-plugin-react-refresh
dependency-version: 0.5.7
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: i18next
dependency-version: 26.4.2
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: prettier
dependency-version: 3.9.8
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
- dependency-name: react-i18next
dependency-version: 17.0.14
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: dev-patch-updates
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump the prod-patch-updates group with 6 updates (#1461)
Bumps the prod-patch-updates group with 6 updates:
| Package | From | To |
| --- | --- | --- |
| [@tanstack/react-virtual](https://github.com/TanStack/virtual/tree/HEAD/packages/react-virtual) | `3.14.10` | `3.14.13` |
| [compression](https://github.com/expressjs/compression) | `1.8.1` | `1.8.2` |
| [jose](https://github.com/panva/jose) | `6.2.9` | `6.2.12` |
| [jszip](https://github.com/Stuk/jszip) | `3.10.1` | `3.10.2` |
| [socks](https://github.com/JoshGlazebrook/socks) | `2.8.9` | `2.8.10` |
| [undici](https://github.com/nodejs/undici) | `8.10.0` | `8.10.2` |
Updates `@tanstack/react-virtual` from 3.14.10 to 3.14.13
- [Release notes](https://github.com/TanStack/virtual/releases)
- [Changelog](https://github.com/TanStack/virtual/blob/main/packages/react-virtual/CHANGELOG.md)
- [Commits](https://github.com/TanStack/virtual/commits/@tanstack/react-virtual@3.14.13/packages/react-virtual)
Updates `compression` from 1.8.1 to 1.8.2
- [Release notes](https://github.com/expressjs/compression/releases)
- [Changelog](https://github.com/expressjs/compression/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/compression/compare/v1.8.1...v1.8.2)
Updates `jose` from 6.2.9 to 6.2.12
- [Release notes](https://github.com/panva/jose/releases)
- [Changelog](https://github.com/panva/jose/blob/main/CHANGELOG.md)
- [Commits](https://github.com/panva/jose/compare/v6.2.9...v6.2.12)
Updates `jszip` from 3.10.1 to 3.10.2
- [Changelog](https://github.com/Stuk/jszip/blob/main/CHANGES.md)
- [Commits](https://github.com/Stuk/jszip/compare/v3.10.1...v3.10.2)
Updates `socks` from 2.8.9 to 2.8.10
- [Release notes](https://github.com/JoshGlazebrook/socks/releases)
- [Commits](https://github.com/JoshGlazebrook/socks/compare/2.8.9...2.8.10)
Updates `undici` from 8.10.0 to 8.10.2
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v8.10.0...v8.10.2)
---
updated-dependencies:
- dependency-name: "@tanstack/react-virtual"
dependency-version: 3.14.13
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
- dependency-name: compression
dependency-version: 1.8.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
- dependency-name: jose
dependency-version: 6.2.12
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
- dependency-name: jszip
dependency-version: 3.10.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
- dependency-name: socks
dependency-version: 2.8.10
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
- dependency-name: undici
dependency-version: 8.10.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: prod-patch-updates
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add plugin worker protocol, bootstrap and plugin_storage table
Worker-side ctx proxy plus the message envelope it talks over, and the
per-plugin key/value table behind ctx.storage with migrations for all
three dialects. Rows cascade with the plugin so uninstalling leaves
nothing behind.
* feat: add allowlisted host view for plugins
An allowlist rather than a list of fields to strip. A blocklist rots:
the moment a new secret-bearing column lands on SSHHost it starts
leaking silently. With an allowlist a new field stays invisible to
plugins until someone adds it here on purpose.
* feat: add plugin loader with manifest validation and crash restart
Validates an unpacked plugin, spawns a worker_threads worker and manages
activate/deactivate/crash-restart with backoff, disabling after three
tries.
The crash counter clears only after a plugin stays up past a stability
window, not on activation. Clearing it on activation let a plugin that
activates cleanly and then dies restart forever, because every attempt
looked like the first.
loader.ts documents what the worker boundary does and does not buy you.
Node's permission model is process-wide, not per-worker, so it cannot be
enabled for plugin workers alone and is not claimed here.
* feat: route internal events through a shared plugin event bus
Formalises three ad-hoc publish paths that already existed:
automation-events.ts, metrics/automation-bridge.ts and the
hostSessionStatus singleton, now the host.session.status topic.
Both invariants the old code relied on are preserved. Publishing stays
fire-and-forget, so a failing subscriber cannot disturb a metrics poll or
a host delete. The automations engine subscribes to the bus at scheduler
start instead of being imported ad hoc, which keeps the edge
one-directional: automations may import repositories, hosts modules must
not import automations.
* feat: add plugin ctx broker with permission gate and audit
Every ctx call a plugin makes is checked against its granted
capabilities, performed by the main thread, then audited. A capability
must be both declared in the manifest and granted in the database, so
widening a plugin's reach always needs a new manifest the user can see,
never just a database row.
Audit attribution is set by the broker, not the plugin. The plugin
supplies only the details, so it cannot forge the actor.
fix: stop plugin workers seeing plaintext credentials in error messages
A failing ctx.ssh.connect handed the worker the raw error from deep in
the SSH stack, which embeds the connect config. The worker received, in
full:
Authentication failed for root using password <SECRET>
where <SECRET> was the host's real plaintext password. Any plugin with
ssh.exec could read it by catching the error, defeating the whole point
of the handle-based ssh API.
Errors crossing the boundary are now sanitised. Only PluginFacingError
and PluginPermissionError, both authored here, reach a plugin verbatim;
anything else becomes a generic message and the real one goes to the
log. This uses a marker class rather than matching on message text,
because matching would start leaking again the moment an upstream error
happened to contain a familiar phrase.
Covered by credential-isolation.test.ts, which plants a sentinel in
every secret-bearing field and asserts it appears in no message the
worker ever receives.
* feat: dispatch plugin HTTP routes and wire the runtime into startup
ctx.http.route now registers a real router on the /plugin-api/:pluginId
dispatcher, replacing its stub 404. A plugin never touches the Express
req/res: it gets a plain summary and returns a plain object, so sockets
and session cookies stay on this side of the boundary. Authorization and
cookie headers are not forwarded.
Plugins load last in the start-up sequence, after the server is fully
wired, and are terminated before the database on shutdown so none can
outlive it. A plugin that fails to load cannot stop the backend.
fix: correct the nginx plugin-api location regex
The pattern was ^/plugin-api/(/.*)?$, which needs a double slash and so
never matched /plugin-api/<id>/<route>. Every other block in the file
uses ^/prefix(/.*)?$. Left alone, plugin routes would work in dev and
404 only behind Docker.
* fix: update stale SFTP transfer test for single file destination paths
The test still asserted transferToHost was called with the destination
directory "/srv". Commit 7727fa09 (#1304) deliberately changed a single
file transfer to send the full destination path including the filename,
so the correct expectation is "/srv/remote-1.txt". The code was right
and the test was left behind.
* feat: ship the ssh terminal as a first-party in-process plugin
Adds a hardcoded process:transport-owner tier so the terminal can own its
WebSocket server and ssh2 clients, which cannot cross the worker boundary.
* feat: ship docker as a first-party in-process plugin
Moves docker backend and frontend into plugins/docker/, alongside
ssh-terminal. Adds a host editor tab seam, a dashboard card registry,
and a build step to compile plugin backends into dist.
* feat: ship host metrics as a first-party in-process plugin
* fix: harden plugin auth and add per-request identity for ctx calls
Require auth on /plugin-api, gate plugin enable/grant/revoke routes
behind admin.plugins.manage, and thread the calling user through
worker ctx.hosts/ctx.ssh calls instead of always using the install
owner. Also adds the plugin permissions grant/revoke UI.
* feat: ship the AI assistant as a first-party in-process plugin
Moves src/backend/ai and its routes into plugins/ai, mounted through a
small /ai dispatcher instead of its own port. Moves the ai-enabled and
ai-private-endpoints settings routes out of user-settings-routes.ts
into the plugin too, so it has no leftover core dependents.
* fix: remove compiled plugin JS left behind in plugins/ after build
copy-bundled-plugins.cjs compiled and rewrote plugin backend TS in
place, copied it to dist/plugins, but never deleted the .js it had
just emitted next to the .ts sources. Those files shadowed the real
source for vitest/tsx and had import paths rewritten for the dist
layout, so tests failed with "Cannot find module" once a local build
had run. Affects docker, host-metrics and ai, not just this one.
* feat: add a permission-gated backend service registry for plugins
* feat: add a permission-gated UI action registry and action slots for plugins
Moves the terminal toolbar's hardwired AI button into a slot the ssh-terminal
plugin offers and the ai plugin fills, gated on ai.services.use.
* feat: add cross-plugin secret references gated by the provider's RBAC permission
* feat: move proxmox discovery/import/sync into a first-party plugin
* feat: move remote desktop (RDP/VNC/Telnet) into a first-party plugin
Relocates guacamole backend/frontend source and tests into
plugins/remote-desktop, following the ssh-terminal/docker pattern.
* feat: wire remote-desktop plugin into core and rename i18n keys
Repoints core consumers (dispatcher, collab, session-sharing, tab
utils) at the plugin, adds isTabTypeAvailable gating for rdp/vnc/
telnet, widens hostCapability to accept an array, and renames the
guacamole i18n namespace to remoteDesktop.
* feat: move fleets into a first-party plugin
* feat: move automations into a first-party plugin
* feat: remove legacy alert rules, superseded by automations
Alert rules already auto-migrate into automations on boot and the old
engine stands down after. Deletes the rule/firing tables, routes, UI,
and AI tools; keeps notification channels since automations still use
them. Also fixes automations' notify step, which still called the
deleted repository.
* feat: move network topology into a first-party plugin
* feat: move tailscale device discovery and settings into a plugin
Adds plugins/tailscale/ with a devices sidebar tab, admin settings
section, and re-auth dialog. Host Metrics tailscale manager card and
SSH re-auth banner parsing stay in core.
* feat: move workspaces into a first-party plugin
* feat: move web endpoint into a first-party plugin
* feat: collapse plugin runtime to one tier behind a plugin SDK
* feat: make each plugin an npm workspace built by a termix-plugin CLI
* feat: give plugins their own tables, migrations and sync entities
* feat: serve plugin http and websockets from one mount instead of ports
* feat: namespace plugin permissions and keep them valid when a plugin is off
* feat: give plugins their own settings and one settings screen
* feat: load plugin frontends at runtime and remove plugin ids from the shell
* fix: mock the ai status fetch in its activate test
* feat: add auth extension points and one ssh connect pipeline
* feat: rebuild workspaces as the reference plugin
* fix: gate second factors after SSO/LDAP behind an admin setting
* feat: convert network-topology to a full plugin (B1)
* feat: move snippets backend and tables into a plugin (B2)
* feat: point core frontend snippets pickers at the plugin (B2)
* feat: add the snippets plugin (B2)
* feat: wire ai, automations, fleets and ssh-terminal to snippets (B2)
* feat: finish the tailscale plugin, including SSH auth (B3)
* feat: finish the fleets plugin, add ctx.hosts and host-commands SDK (B4)
* chore: update proxmox and host-metrics locale files for B5
* chore: regenerate drizzle migration journals for B5
* feat: add ctx.hosts create/update to the SDK, host-metrics drops proxmox
* feat: move proxmox node stats and collectors into the proxmox plugin
* feat: drop proxmox host columns, use plugin settings instead
* feat: finish the fleets plugin, add ctx.hosts and host-commands SDK (B4)
* feat: convert file manager into a plugin
* feat: convert ssh tunnels into a plugin
* feat: finish the web-endpoint plugin, add ctx.desktop (B8)
* feat: move the terminal fully into the ssh-terminal plugin (B9)
* feat: convert tmux monitoring into a plugin (B10)
* feat: convert serial console into the serial plugin
* feat: move session sharing and collab rooms into a plugin (B12)
* feat: turn session recording into a plugin (B13)
* feat: finish the remote-desktop plugin (B14)
* feat: finish the host-metrics plugin, move host status into core (B16)
* feat: finish the docker plugin (B15)
* feat: finish the automations plugin (B17)
* feat: finish the ai plugin (B18)
* feat: finish the homepage plugin, move service links and canvas out of core (B19)
* feat: convert wake-on-lan into a plugin (B20)
* feat: convert secret-sources into a plugin (B20)
* feat: move totp and passkeys into plugins (C1)
* feat: move sso and ldap logins into plugins (C2)
* feat: move opkssh and warpgate into plugins (C3)
* feat: move step-ca into a plugin (C4)
* feat: move vault ssh signing into a plugin (C5)
* feat: move termix identity into a plugin (C6)
* feat: move acme certificate automation into a plugin (C7)
* fix: finish 2.9.0 plugin moves and get every check green
* chore: lock the plugin boundary and remove 2.9.0 leftovers
* fix: harden the plugin runtime after the 2.9.0 security review
* feat: add plugin packing, signing, pinned trust and tmxplug bundling
* test: prove 2.8 to 2.9.0 upgrade is lossless and fix what it caught
* fix: give bundled plugin backends a real require for CJS deps
* feat: improve UI loading time and jitter
* feat: show credential sharing inline in the sidebar like host sharing
* feat: tailscale add host and copy ip, fix outbound fetch hang and plugin ESM warning
* feat: unify alerts into one plugin, channels, rules and inbox
* feat: rebuild desktop sync as linked server accounts, fix packaged plugin bundles and UI scaling
* fix: set blacksmith builder cache-key to stop broken gha cache fallback
* fix: link plugin-sdk workspace before npm ci in docker deps stage
* fix: link every plugin workspace before npm ci in docker deps stage
* fix(host-metrics): exclude image and firmware filesystems (#1469)
* fix(host-metrics): exclude image and firmware filesystems
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(hosts): normalize imported jump host references (#1470)
* fix(hosts): normalize imported jump host references
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(ci): build plugin SDK and repair MySQL settings migration (#1471)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(file-manager): keep inline rename consistent (#1476)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(file-manager): keep inline rename consistent
* fix(dashboard): reuse translated host status labels (#1475)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(dashboard): reuse translated host status labels
* docs(api): clarify local and remote version fields (#1474)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* docs(api): clarify local and remote version fields
* fix(file-manager): preserve selected backgrounds on hover (#1473)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(file-manager): preserve selection feedback on hover
* test(ui): await dialog focus cleanup before teardown
* fix(file-manager): restore Ctrl/Cmd+F file search (#1472)
* fix(ci): build plugin SDK before dependent checks
* fix(mysql): keep plugin settings scope indexes within limits
* test(mysql): refresh reviewed plugin upgrade SQL
* fix(file-manager): focus file search with Ctrl or Cmd F
* fix: keep rounded-full circular in production builds
* fix(file-manager): cancel uploads and stop remote writes (#1477)
* fix(file-manager): cancel uploads and stop remote writes
* test(css): exercise the configured PostCSS plugin chain
* fix(file-manager): apply compact density to directory tree (#1478)
* fix(file-manager): apply compact density to directory tree
* test(css): exercise the configured PostCSS plugin chain
* fix(file-manager): preserve font sizes in compact mode (#1480)
* fix(file-manager): preserve font sizes in compact mode
* test(css): exercise the configured PostCSS plugin chain
* fix(file-manager): prioritize file names in narrow lists (#1483)
* fix(file-manager): prioritize file names in narrow lists
* test(css): exercise the configured PostCSS plugin chain
* test(identity): preserve full Ed25519 public keys in fixtures
* test(remote-desktop): always mutate ciphertext in tamper test
* fix(remote-desktop): probe the saved host guacd endpoint (#1481)
* fix(remote-desktop): probe the saved host guacd endpoint
* test(css): exercise the configured PostCSS plugin chain
* test(identity): preserve full Ed25519 public keys in fixtures
* fix(homepage): check allowlisted private service reachability (#1479)
* fix(homepage): check allowlisted private service reachability
* test(css): exercise the configured PostCSS plugin chain
* fix(remote-desktop): stop unsolicited clipboard read prompts (#1482)
* fix(remote-desktop): read clipboard only on explicit paste
* test(css): exercise the configured PostCSS plugin chain
* test(identity): preserve full Ed25519 public keys in fixtures
* test(remote-desktop): always mutate ciphertext in tamper test
* chore: simplify plugin readmes, changelogs and manifest descriptions
* fix: keep plugins loaded after signing in from the login screen
* fix(file-manager): accept OS file drops over existing rows (#1484)
* fix(file-manager): accept OS file drops over existing rows
* test(file-manager): target the file label in drop tests
* test(css): exercise the configured PostCSS plugin chain
* test(identity): preserve full Ed25519 public keys in fixtures
* test(remote-desktop): always mutate ciphertext in tamper test
* fix(file-manager): pipeline SFTP download reads (#1485)
* feat: add plugin sdk build to beta release
* fix: make link-store secret check immune to random base64 matches
* fix(ldap): preserve the directory-provided bind DN (#1486)
* fix: compute beta changes across dev branches and move the beta tag
* chore: untrack plugin sdk ARCHITECTURE.md
* chore: remove references to plugin sdk ARCHITECTURE.md
* feat: merge host editor terminal tabs into one owned by ssh-terminal
* feat: add descriptions to plugin host enable toggles
* fix(file-manager): show download progress in file viewers (#1487)
* fix(electron): signal backend readiness over IPC (#1488)
* fix(split-screen): allow layout creation without randomUUID (#1490)
* fix(split-screen): allow layout creation without randomUUID
* test(credentials): avoid flaky Ed25519 key generation
* fix(sidebar): remeasure visible rows after density changes (#1489)
* fix(sidebar): remeasure visible rows after density changes
* test(credentials): avoid flaky Ed25519 key generation
* feat(split-screen): redesign split screen with free-form panes and pane picker
* feat(sidebar): add host click behavior setting, default to always opening a new tab
* feat(snippets): redesign panel to match the host list
* fix(session-recording): stop session logs panel from refetching in a loop
* feat(snippets): bring back sharing, target hosts and drag reorder
* feat(ssh-terminal): add toolbar position, start state, display and fade host settings
* feat(ssh-terminal): add host setting to turn off password prompt auto-fill
* fix(ai): stop streams getting cut off and keep tool steps across messages
* feat: improve quick connect system using plugin api
* fix: proxmox guest sync, startup snippet sync, drop dead cloudflare ssh transport
* feat: move terminal settings, look and ssh tools into ssh-terminal plugin
* feat: move snippets, keybinding actions and macros out of core into plugins
* feat: store rdp, vnc and telnet logins in a generic per-protocol table
* feat: type the plugin host record, move plugin strings out of core and add lint checks
* feat: replace core homepage widget registry with generic extension points
* feat: plugins only see their own host settings in the browser
* feat: harden plugin api for separate repos, signed updates and generic external login
* fix: keep plugin css below core utilities and version plugin assets by their css
* fix: load and save plugin host settings in the editor and tighten settings row spacing
* feat: redesign user host defaults system
* fix(remote-desktop): release held keys on focus loss (#1498)
* fix(session-sharing): replace local presentation after takeover (#1500)
* fix(file-manager): refresh disk usage with directory listing (#1503)
* fix(ssh-terminal): preserve input order during local echo reconciliation (#1505)
* feat(remote-desktop): expose display zoom controls for RDP (#1514)
* fix(file-manager): restore text selection and copying in Markdown previews (#1518)
* fix(sidebar): keep compact host addresses visible (#1524)
* fix(hosts): preserve plugin settings when reopening the editor (#1499)
* fix(ssh-terminal): close owner sockets when presentations unmount (#1501)
* fix(session-sharing): synchronize shared SSH terminal dimensions (#1502)
* fix(session-sharing): show participant presence in member terminals (#1504)
* fix(ai): sync provider configuration and keys across linked devices (#1506)
* feat(ssh-terminal): add a duplicate tab action (#1510)
* feat(file-manager): allow disabling move-to-trash confirmation (#1511)
* feat(file-manager): default to the remote login directory (#1512)
* feat(homepage): synchronize canvas layouts across devices (#1515)
* fix(shortcuts): prevent accidental double-Shift palette activation (#1519)
* feat(tmux-monitor): add a unified multi-host view (#1520)
* fix(electron): allow explicit quit with active connections (#1522)
* feat: reconnect all disconnected terminal tabs (#1523)
* fix(hosts): preserve recording and sharing settings in the dev editor (#1509)
* fix(database): preserve RDP domain during startup backfill (#1497)
* feat(sidebar): add keyboard type-ahead search for hosts (#1516)
* feat(automations): add per-host maintenance mode and recurring schedules (#1521)
* feat(tmux): add a per-host mouse toggle and preserve remote configuration (#1513)
* fix(session-sharing): use the linked server for desktop meetings and links (#1507)
* fix(tunnels): support TOTP for client tunnels and jump hosts (#1508)
* fix: type errors and lint failures from merged plugin prs
* feat(installer): make the Windows desktop shortcut optional (#1517)
* fix: ship the plugin sdk and serialport in desktop builds
* fix: prefer ipv4 when resolving ssh host names (#1365)
* fix: readable terminal selection with the light theme (#1319)
* fix: build desktop session share links on the linked server (#1350)
* fix: show meeting guests to members and hide the roster from guests (#1353)
* fix: reliable file manager saves with sudo prompt and no base64 guessing (#1335)
* fix: show disk usage for the mount being browsed (#1347)
* fix: load the linux tray icon reliably and log tray failures (#1332)
* fix: cover the gnome close path in the desktop quit test (#1332)
* fix: prompt for jump host TOTP in terminal, file manager and metrics (#1312)
* feat: optional auto reconnect for dropped ssh sessions (#1321)
* feat: tighter compact host rows with inline tags (#1325)
* feat: bring back the alert feed homepage widget
* feat: pick target terminals for snippets again
* feat: share button on connection tabs again
* feat: recent servers list when linking the desktop app
* feat: list the fixed app shortcuts in keyboard shortcuts
* fix: translate hardcoded toasts and drop em dashes from ui text
* fix: translate leftover hardcoded ui text
* fix: toolbar files button opens at the shell directory again
* fix: show the remote desktop note under connection origin again
* chore: openapi docs for host metrics manager routes
* chore: openapi docs for undocumented routes and fix two broken doc blocks
* fix: declare terminal.listSessions use for snippet targets
* revert: drop the alert feed widget, the notification center replaces it
* feat: restore the alert feed homepage widget
* fix: quick connect fills the host address from plugin auth editors like tailscale
* fix: docker container logs use the base background color
* chore: fix dependabot alerts and apply safe npm upgrades
* fix: proxmox stats tab reads its switch from plugin host settings
* fix: count plugin ssh logins toward host status and stop showing reachable as a warning
* fix: hide the built-in source pill in the host editor
* fix: host status shows online when the port answers and only warns on a failed login
* fix: drop the top border on the split layout menu
* fix: host defaults tabs sit where the host editor puts them and skip plugins with nothing to default
* fix: remote desktop auth method labels and notes for vnc and telnet
* fix: add description to the web endpoint enable switch
* fix: crowdin sync and pretranslate for plugin locales, run plugin tests on release
* feat: move telemetry out of core into a usage statistics plugin
* fix: recent activity card no longer cuts off host names early
* fix: remove duplicate top border on split screen menu
* fix: redesign session log player controls, fix tooltip overlap and drop dot separators
* fix: file manager and sftp text showing raw i18n keys
* fix: onboarding rerunning for existing users after upgrading
* fix: fleet detail buttons overflowing the sidebar
* fix: session log player scrolling off screen horizontally
* fix: network graph lag when adding hosts and on every render
* fix: maintenance index name, shared host read only view and badge polling
* fix: meeting tabs, workspace tab merging, rail panels as tabs and general ui lag
* chore: update release notes
* fix: remote desktop tabs reconnecting on every tab switch
* fix: build plugin sdk before linting in release workflow
* chore: lint, format, and bump version to 2.9.0
* chore: skip crowdin pre-translate in release for now
* chore: sync Crowdin translations for 2.9.0
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Koi <38512047+datlt4@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ZacharyZcR <zacharyzcr1984@gmail.com>
This commit is contained in:
4405 files changed
+1341026
-289722
No files matched your search
@@ -1,60 +1,8 @@
|
||||
export const AUTH_OVERRIDE_PROTOCOLS = ["ssh", "rdp", "vnc", "telnet"] as const;
|
||||
/** Core's own protocol. Every other one is declared by a plugin. */
|
||||
export const SSH_AUTH_PROTOCOL = "ssh";
|
||||
|
||||
export type AuthOverrideProtocol = (typeof AUTH_OVERRIDE_PROTOCOLS)[number];
|
||||
|
||||
export const SUPPORTED_AUTH_OVERRIDE_PROTOCOLS =
|
||||
AUTH_OVERRIDE_PROTOCOLS satisfies readonly AuthOverrideProtocol[];
|
||||
|
||||
export const AUTH_PROTOCOL_METADATA = {
|
||||
ssh: {
|
||||
label: "SSH",
|
||||
enableField: "enableSsh",
|
||||
credentialField: "credentialId",
|
||||
},
|
||||
rdp: {
|
||||
label: "RDP",
|
||||
enableField: "enableRdp",
|
||||
credentialField: "rdpCredentialId",
|
||||
},
|
||||
vnc: {
|
||||
label: "VNC",
|
||||
enableField: "enableVnc",
|
||||
credentialField: "vncCredentialId",
|
||||
},
|
||||
telnet: {
|
||||
label: "Telnet",
|
||||
enableField: "enableTelnet",
|
||||
credentialField: "telnetCredentialId",
|
||||
},
|
||||
} as const satisfies Record<
|
||||
AuthOverrideProtocol,
|
||||
{
|
||||
label: string;
|
||||
enableField: "enableSsh" | "enableRdp" | "enableVnc" | "enableTelnet";
|
||||
credentialField:
|
||||
| "credentialId"
|
||||
| "rdpCredentialId"
|
||||
| "vncCredentialId"
|
||||
| "telnetCredentialId";
|
||||
}
|
||||
>;
|
||||
|
||||
export function isAuthOverrideProtocol(
|
||||
value: unknown,
|
||||
): value is AuthOverrideProtocol {
|
||||
return (
|
||||
typeof value === "string" &&
|
||||
AUTH_OVERRIDE_PROTOCOLS.includes(value as AuthOverrideProtocol)
|
||||
);
|
||||
}
|
||||
|
||||
export function isSupportedAuthOverrideProtocol(
|
||||
protocol: AuthOverrideProtocol,
|
||||
): boolean {
|
||||
return SUPPORTED_AUTH_OVERRIDE_PROTOCOLS.includes(
|
||||
protocol as (typeof SUPPORTED_AUTH_OVERRIDE_PROTOCOLS)[number],
|
||||
);
|
||||
}
|
||||
/** "ssh", or a protocol id a plugin declares in contributes.protocols. */
|
||||
export type AuthOverrideProtocol = string;
|
||||
|
||||
export interface HostAuthOverrideState<
|
||||
CredentialId extends number | string = number,
|
||||
|
||||
@@ -1,286 +0,0 @@
|
||||
/**
|
||||
* Shared automation model used by both the backend engine and the editor UI.
|
||||
* An automation is one trigger plus an ordered list of steps. The whole
|
||||
* definition is stored as JSON on the automations row, so this file is the
|
||||
* only contract describing that blob.
|
||||
*/
|
||||
|
||||
export const AUTOMATION_DEFINITION_VERSION = 1;
|
||||
|
||||
/** Which hosts a trigger watches or a step acts on. */
|
||||
export type HostSelector =
|
||||
| { kind: "host"; hostId: number }
|
||||
| { kind: "hosts"; hostIds: number[] }
|
||||
| { kind: "fleet"; fleetId: number }
|
||||
| { kind: "all" }
|
||||
/** The host that produced the event. Only valid for host-scoped triggers. */
|
||||
| { kind: "trigger" };
|
||||
|
||||
/**
|
||||
* A metric to compare against. Paths mirror the shape returned by
|
||||
* collectMetrics(). mount/iface pick one entry out of a per-instance list so a
|
||||
* rule can watch a single filesystem rather than the aggregate.
|
||||
*/
|
||||
export type MetricPath =
|
||||
| { path: "cpu.percent" }
|
||||
| { path: "cpu.load1" }
|
||||
| { path: "cpu.load5" }
|
||||
| { path: "cpu.load15" }
|
||||
| { path: "memory.percent" }
|
||||
| { path: "memory.usedGiB" }
|
||||
| { path: "disk.percent"; mount?: string }
|
||||
| { path: "disk.availableBytes"; mount?: string }
|
||||
| { path: "temperature.highestCelsius" }
|
||||
| { path: "uptime.seconds" }
|
||||
| { path: "processes.total" }
|
||||
| { path: "network.rxBytes"; iface?: string }
|
||||
| { path: "network.txBytes"; iface?: string }
|
||||
| { path: "network.rxRateBps"; iface?: string }
|
||||
| { path: "network.txRateBps"; iface?: string };
|
||||
|
||||
export type Operator =
|
||||
| ">"
|
||||
| "<"
|
||||
| ">="
|
||||
| "<="
|
||||
| "=="
|
||||
| "!="
|
||||
| "contains"
|
||||
| "not_contains"
|
||||
| "changed";
|
||||
|
||||
export type Severity = "info" | "warning" | "critical";
|
||||
|
||||
export type HostStatusState = "online" | "offline";
|
||||
export type HealthCheckState = "failing" | "recovered";
|
||||
export type DockerEventKind = "exited" | "started" | "unhealthy" | "restarting";
|
||||
|
||||
export type InternalEventKind =
|
||||
| "user_login"
|
||||
| "host_added"
|
||||
| "host_deleted"
|
||||
| "tunnel_disconnected"
|
||||
| "automation_failed";
|
||||
|
||||
export type Trigger =
|
||||
| {
|
||||
kind: "metric_threshold";
|
||||
hostSelector: HostSelector;
|
||||
metric: MetricPath;
|
||||
operator: Operator;
|
||||
value: number;
|
||||
/** Sustained breach window before firing. 0 fires immediately. */
|
||||
forSeconds?: number;
|
||||
cooldownMinutes: number;
|
||||
severity?: Severity;
|
||||
}
|
||||
| {
|
||||
kind: "host_status";
|
||||
hostSelector: HostSelector;
|
||||
to: HostStatusState;
|
||||
cooldownMinutes: number;
|
||||
}
|
||||
| {
|
||||
kind: "health_check";
|
||||
hostSelector: HostSelector;
|
||||
checkId?: string;
|
||||
to: HealthCheckState;
|
||||
cooldownMinutes: number;
|
||||
}
|
||||
| {
|
||||
kind: "schedule";
|
||||
/** Five field cron. Ignored when intervalSeconds is set. */
|
||||
cron?: string;
|
||||
intervalSeconds?: number;
|
||||
timezone?: string;
|
||||
}
|
||||
| {
|
||||
kind: "docker_event";
|
||||
hostSelector: HostSelector;
|
||||
container?: string;
|
||||
event: DockerEventKind;
|
||||
cooldownMinutes: number;
|
||||
}
|
||||
| {
|
||||
kind: "internal_event";
|
||||
event: InternalEventKind;
|
||||
hostSelector?: HostSelector;
|
||||
cooldownMinutes: number;
|
||||
}
|
||||
| {
|
||||
kind: "webhook";
|
||||
/** Only the hash is persisted. The raw token is shown once on creation. */
|
||||
tokenHash: string;
|
||||
};
|
||||
|
||||
export type TriggerKind = Trigger["kind"];
|
||||
|
||||
/** A comparison used by `if` steps, evaluated against the run context. */
|
||||
export interface Condition {
|
||||
/** Template string, e.g. "{{steps.check.stdout}}" or "{{trigger.value}}". */
|
||||
left: string;
|
||||
operator: Operator;
|
||||
/** Template string. Compared numerically when both sides parse as numbers. */
|
||||
right?: string;
|
||||
}
|
||||
|
||||
export type StepErrorPolicy = "stop" | "continue" | "branch";
|
||||
|
||||
interface StepBase {
|
||||
/** Stable across edits so run history survives reordering. */
|
||||
id: string;
|
||||
name?: string;
|
||||
enabled?: boolean;
|
||||
onError?: StepErrorPolicy;
|
||||
timeoutMs?: number;
|
||||
}
|
||||
|
||||
export type Step =
|
||||
| (StepBase & {
|
||||
type: "notify";
|
||||
channelIds: number[];
|
||||
title?: string;
|
||||
body?: string;
|
||||
severity?: Severity;
|
||||
})
|
||||
| (StepBase & {
|
||||
type: "http";
|
||||
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
body?: string;
|
||||
/** Opt in to LAN/private addresses. Off by default, see safe-outbound-fetch. */
|
||||
allowPrivateNetwork?: boolean;
|
||||
})
|
||||
| (StepBase & {
|
||||
type: "run_snippet";
|
||||
snippetId: number;
|
||||
hostSelector: HostSelector;
|
||||
inputValues?: Record<string, string>;
|
||||
elevated?: boolean;
|
||||
})
|
||||
| (StepBase & {
|
||||
type: "run_command";
|
||||
command: string;
|
||||
hostSelector: HostSelector;
|
||||
elevated?: boolean;
|
||||
})
|
||||
| (StepBase & {
|
||||
type: "docker";
|
||||
action: "start" | "stop" | "restart";
|
||||
container: string;
|
||||
hostSelector: HostSelector;
|
||||
})
|
||||
| (StepBase & {
|
||||
type: "tunnel";
|
||||
action: "connect" | "disconnect";
|
||||
tunnelName: string;
|
||||
})
|
||||
| (StepBase & { type: "wol"; hostId: number })
|
||||
| (StepBase & { type: "wait"; seconds: number })
|
||||
| (StepBase & { type: "set_var"; name: string; value: string })
|
||||
| (StepBase & {
|
||||
type: "if";
|
||||
condition: Condition;
|
||||
then: Step[];
|
||||
else?: Step[];
|
||||
})
|
||||
| (StepBase & { type: "run_automation"; automationId: number })
|
||||
| (StepBase & { type: "stop"; status?: "success" | "failed" });
|
||||
|
||||
export type StepType = Step["type"];
|
||||
|
||||
export interface AutomationDefinition {
|
||||
version: number;
|
||||
trigger: Trigger;
|
||||
steps: Step[];
|
||||
}
|
||||
|
||||
export type ConcurrencyPolicy = "skip" | "queue" | "allow";
|
||||
|
||||
export type RunStatus =
|
||||
"running" | "success" | "failed" | "timeout" | "skipped" | "cancelled";
|
||||
|
||||
export type StepStatus =
|
||||
"pending" | "running" | "success" | "failed" | "skipped";
|
||||
|
||||
export interface Automation {
|
||||
id: number;
|
||||
userId: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
enabled: boolean;
|
||||
definition: AutomationDefinition;
|
||||
concurrencyPolicy: ConcurrencyPolicy;
|
||||
maxRunSeconds: number;
|
||||
dryRun: boolean;
|
||||
lastRunAt: string | null;
|
||||
lastRunStatus: RunStatus | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface AutomationRun {
|
||||
id: number;
|
||||
automationId: number;
|
||||
userId: string;
|
||||
triggerType: TriggerKind | "manual";
|
||||
triggerContext: Record<string, unknown> | null;
|
||||
status: RunStatus;
|
||||
startedAt: string;
|
||||
finishedAt: string | null;
|
||||
durationMs: number | null;
|
||||
error: string | null;
|
||||
dryRun: boolean;
|
||||
parentRunId: number | null;
|
||||
}
|
||||
|
||||
export interface AutomationRunStep {
|
||||
id: number;
|
||||
runId: number;
|
||||
stepIndex: number;
|
||||
stepId: string;
|
||||
stepType: StepType;
|
||||
status: StepStatus;
|
||||
startedAt: string;
|
||||
finishedAt: string | null;
|
||||
output: string | null;
|
||||
error: string | null;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
/** Defaults applied when an automation does not override them. */
|
||||
export const DEFAULT_MAX_RUN_SECONDS = 300;
|
||||
export const DEFAULT_STEP_TIMEOUT_MS = 60_000;
|
||||
export const DEFAULT_COOLDOWN_MINUTES = 15;
|
||||
/** Guards run_automation against direct and mutual recursion. */
|
||||
export const MAX_AUTOMATION_DEPTH = 5;
|
||||
/** Step output beyond this is truncated before it reaches the database. */
|
||||
export const MAX_STEP_OUTPUT_BYTES = 32_768;
|
||||
|
||||
export const OPERATOR_LABELS: Record<Operator, string> = {
|
||||
">": "greater than",
|
||||
"<": "less than",
|
||||
">=": "greater than or equal to",
|
||||
"<=": "less than or equal to",
|
||||
"==": "equals",
|
||||
"!=": "does not equal",
|
||||
contains: "contains",
|
||||
not_contains: "does not contain",
|
||||
changed: "changed",
|
||||
};
|
||||
|
||||
/** Steps that reach outside Termix and are therefore stubbed in a dry run. */
|
||||
export const SIDE_EFFECTING_STEP_TYPES: readonly StepType[] = [
|
||||
"notify",
|
||||
"http",
|
||||
"run_snippet",
|
||||
"run_command",
|
||||
"docker",
|
||||
"tunnel",
|
||||
"wol",
|
||||
];
|
||||
|
||||
export function isSideEffectingStep(type: StepType): boolean {
|
||||
return SIDE_EFFECTING_STEP_TYPES.includes(type);
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Where a connection is. Core's SSH pipeline uses the named stages; a plugin
|
||||
* may log its own (such as "guac_ready") and they pass through unchanged.
|
||||
*/
|
||||
export type ConnectionStage =
|
||||
| "dns"
|
||||
| "tcp"
|
||||
@@ -9,29 +13,7 @@ export type ConnectionStage =
|
||||
| "proxy"
|
||||
| "jump"
|
||||
| "validation"
|
||||
| "docker_connecting"
|
||||
| "docker_auth"
|
||||
| "docker_session"
|
||||
| "docker_ready"
|
||||
| "stats_connecting"
|
||||
| "stats_totp"
|
||||
| "stats_polling"
|
||||
| "stats_heartbeat"
|
||||
| "tunnel_connecting"
|
||||
| "tunnel_source"
|
||||
| "tunnel_endpoint"
|
||||
| "tunnel_forwarding"
|
||||
| "tunnel_retry"
|
||||
| "tunnel_connected"
|
||||
| "sftp_connecting"
|
||||
| "sftp_auth"
|
||||
| "sftp_connected"
|
||||
| "guac_token"
|
||||
| "guac_guacd"
|
||||
| "guac_connecting"
|
||||
| "guac_handshake"
|
||||
| "guac_ready"
|
||||
| "guac_disconnected";
|
||||
| (string & {});
|
||||
|
||||
export type LogEntry = {
|
||||
id: string;
|
||||
@@ -41,7 +23,3 @@ export type LogEntry = {
|
||||
message: string;
|
||||
details?: Record<string, unknown> | string;
|
||||
};
|
||||
|
||||
export interface ConnectionLogResponse {
|
||||
connectionLogs?: LogEntry[];
|
||||
}
|
||||
@@ -27,7 +27,8 @@ export type CredentialTrayTrigger =
|
||||
"always" | "hover" | "click" | "actionsOnly";
|
||||
|
||||
export interface CredentialSidebarFilterState {
|
||||
type: ("password" | "key")[];
|
||||
/** Credential type ids; plugins can add their own. */
|
||||
type: string[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ const TRAY_TRIGGERS: CredentialTrayTrigger[] = [
|
||||
"click",
|
||||
"actionsOnly",
|
||||
];
|
||||
const FILTER_TYPE: CredentialSidebarFilterState["type"] = ["password", "key"];
|
||||
const TYPE_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
|
||||
|
||||
export function defaultCredentialSidebarPreferences(): CredentialSidebarPreferences {
|
||||
return {
|
||||
@@ -84,14 +85,6 @@ function sanitizeStringArray(input: unknown): string[] {
|
||||
return input.filter((v): v is string => typeof v === "string");
|
||||
}
|
||||
|
||||
function sanitizeEnumArray<T extends string>(
|
||||
input: unknown,
|
||||
allowed: readonly T[],
|
||||
): T[] {
|
||||
if (!Array.isArray(input)) return [];
|
||||
return input.filter((v): v is T => allowed.includes(v as T));
|
||||
}
|
||||
|
||||
export function sanitizeCredentialSidebarPreferences(
|
||||
input: unknown,
|
||||
): CredentialSidebarPreferences {
|
||||
@@ -112,7 +105,9 @@ export function sanitizeCredentialSidebarPreferences(
|
||||
|
||||
const filtersObj = (obj.filters ?? {}) as Record<string, unknown>;
|
||||
const filters: CredentialSidebarFilterState = {
|
||||
type: sanitizeEnumArray(filtersObj.type, FILTER_TYPE),
|
||||
type: sanitizeStringArray(filtersObj.type).filter((value) =>
|
||||
TYPE_PATTERN.test(value),
|
||||
),
|
||||
tags: sanitizeStringArray(filtersObj.tags),
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-397
@@ -1,397 +1 @@
|
||||
interface ServerConfig {
|
||||
serverUrl?: string;
|
||||
allowInvalidCertificate?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface ConnectionTestResult {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface DialogOptions {
|
||||
title?: string;
|
||||
defaultPath?: string;
|
||||
buttonLabel?: string;
|
||||
filters?: Array<{ name: string; extensions: string[] }>;
|
||||
properties?: string[];
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface DialogResult {
|
||||
canceled: boolean;
|
||||
filePath?: string;
|
||||
filePaths?: string[];
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface LocalDirectoryResult {
|
||||
success: boolean;
|
||||
path: string;
|
||||
parent?: string;
|
||||
entries: LocalFileEntry[];
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface LocalCollectedFile {
|
||||
path: string;
|
||||
name: string;
|
||||
relativePath: string;
|
||||
size: number;
|
||||
created?: string;
|
||||
modified: string;
|
||||
}
|
||||
|
||||
export type LocalPathMutationResult =
|
||||
| ({ success: true } & Partial<LocalFileEntry>)
|
||||
| { success: false; error?: string };
|
||||
|
||||
export interface ElectronAPI {
|
||||
getAppVersion: () => Promise<string>;
|
||||
getPlatform: () => Promise<string>;
|
||||
openNativeRdp: (options: {
|
||||
host: string;
|
||||
port?: number;
|
||||
username?: string;
|
||||
domain?: string;
|
||||
}) => Promise<{ success: boolean; error?: string }>;
|
||||
getSetting?: (key: string) => Promise<string | null | undefined>;
|
||||
setSetting?: (key: string, value: string) => Promise<void>;
|
||||
|
||||
getServerConfig: () => Promise<ServerConfig>;
|
||||
saveServerConfig: (config: ServerConfig) => Promise<{ success: boolean }>;
|
||||
testServerConnection: (
|
||||
serverUrl: string,
|
||||
allowInvalidCertificate?: boolean,
|
||||
) => Promise<ConnectionTestResult>;
|
||||
getC2STunnelConfig: () => Promise<unknown[]>;
|
||||
saveC2STunnelConfig: (
|
||||
config: unknown[],
|
||||
) => Promise<{ success: boolean; error?: string }>;
|
||||
checkLocalPortAvailable: (
|
||||
host: string,
|
||||
port: number,
|
||||
) => Promise<{ available: boolean; error?: string }>;
|
||||
getC2STunnelPresetDefaultName: () => Promise<string>;
|
||||
startC2STunnel: (
|
||||
tunnel: unknown,
|
||||
index: number,
|
||||
authToken?: string,
|
||||
) => Promise<{
|
||||
success: boolean;
|
||||
tunnelName?: string;
|
||||
error?: string;
|
||||
code?: string;
|
||||
}>;
|
||||
testC2STunnel: (
|
||||
tunnel: unknown,
|
||||
index: number,
|
||||
authToken?: string,
|
||||
) => Promise<{
|
||||
success: boolean;
|
||||
message?: string;
|
||||
error?: string;
|
||||
code?: string;
|
||||
}>;
|
||||
stopC2STunnel: (
|
||||
tunnelName: string,
|
||||
) => Promise<{ success: boolean; error?: string }>;
|
||||
getC2STunnelStatuses: () => Promise<Record<string, unknown>>;
|
||||
onC2STunnelStatuses?: (
|
||||
callback: (statuses: Record<string, unknown>) => void,
|
||||
) => () => void;
|
||||
startC2SAutoStartTunnels: () => Promise<{
|
||||
success: boolean;
|
||||
started: number;
|
||||
errors: string[];
|
||||
}>;
|
||||
onRemoteSyncStatusChanged?: (
|
||||
callback: (status: {
|
||||
connected: boolean;
|
||||
syncing: boolean;
|
||||
lastSyncedAt: string | null;
|
||||
lastError: string | null;
|
||||
needsReauth: boolean;
|
||||
}) => void,
|
||||
) => () => void;
|
||||
onCloseActiveTab?: (callback: () => void) => () => void;
|
||||
clearSessionCookies: () => Promise<void>;
|
||||
getSessionCookie: (
|
||||
name: string,
|
||||
targetUrl?: string,
|
||||
) => Promise<string | null>;
|
||||
waitForSessionCookie: (
|
||||
name: string,
|
||||
targetUrl?: string,
|
||||
previousValue?: string | null,
|
||||
timeoutMs?: number,
|
||||
) => Promise<{ success: boolean; value?: string; error?: string }>;
|
||||
|
||||
showSaveDialog: (options: DialogOptions) => Promise<DialogResult>;
|
||||
showOpenDialog: (options: DialogOptions) => Promise<DialogResult>;
|
||||
getLocalHomeDirectory?: () => Promise<string>;
|
||||
listLocalDirectory?: (path?: string) => Promise<LocalDirectoryResult>;
|
||||
statLocalPaths?: (
|
||||
paths: string[],
|
||||
) => Promise<
|
||||
Array<
|
||||
| (LocalFileEntry & { success: true })
|
||||
| { success: false; path: string; error?: string }
|
||||
>
|
||||
>;
|
||||
collectLocalFiles?: (paths: string[]) => Promise<{
|
||||
success: boolean;
|
||||
files: LocalCollectedFile[];
|
||||
truncated?: boolean;
|
||||
error?: string;
|
||||
}>;
|
||||
createLocalFolder?: (
|
||||
parentPath: string,
|
||||
folderName: string,
|
||||
) => Promise<LocalPathMutationResult>;
|
||||
renameLocalPath?: (
|
||||
path: string,
|
||||
newName: string,
|
||||
) => Promise<LocalPathMutationResult>;
|
||||
trashLocalPath?: (path: string) => Promise<LocalPathMutationResult>;
|
||||
chmodLocalPath?: (
|
||||
path: string,
|
||||
permissions: string,
|
||||
) => Promise<LocalPathMutationResult>;
|
||||
|
||||
openExternalEditor: (fileData: {
|
||||
fileName: string;
|
||||
content: string;
|
||||
encoding?: "utf8" | "base64";
|
||||
editorPath?: string | null;
|
||||
}) => Promise<{
|
||||
success: boolean;
|
||||
editId?: string;
|
||||
path?: string;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
closeExternalEditor: (editId: string) => Promise<{
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
onExternalEditorSaved?: (
|
||||
callback: (payload: {
|
||||
editId: string;
|
||||
content: string;
|
||||
encoding: "utf8";
|
||||
path: string;
|
||||
}) => void,
|
||||
) => () => void;
|
||||
|
||||
onUpdateAvailable: (callback: () => void) => void;
|
||||
onUpdateDownloaded: (callback: () => void) => void;
|
||||
|
||||
removeAllListeners: (channel: string) => void;
|
||||
isElectron: boolean;
|
||||
isDev: boolean;
|
||||
|
||||
invoke: (channel: string, ...args: unknown[]) => Promise<unknown>;
|
||||
|
||||
createTempFile: (fileData: {
|
||||
fileName: string;
|
||||
content: string;
|
||||
encoding?: "base64" | "utf8";
|
||||
}) => Promise<{
|
||||
success: boolean;
|
||||
tempId?: string;
|
||||
path?: string;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
createTempFolder: (folderData: {
|
||||
folderName: string;
|
||||
files: Array<{
|
||||
relativePath: string;
|
||||
content: string;
|
||||
encoding?: "base64" | "utf8";
|
||||
}>;
|
||||
}) => Promise<{
|
||||
success: boolean;
|
||||
tempId?: string;
|
||||
path?: string;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
startDragToDesktop: (dragData: {
|
||||
tempId: string;
|
||||
fileName: string;
|
||||
}) => Promise<{
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
cleanupTempFile: (tempId: string) => Promise<{
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}>;
|
||||
|
||||
startLocalTerminal(dimensions: {
|
||||
cols: number;
|
||||
rows: number;
|
||||
shell?: "default" | "wsl";
|
||||
}): Promise<{ sessionId: string; shell: string }>;
|
||||
readyLocalTerminal(sessionId: string): Promise<boolean>;
|
||||
writeLocalTerminal(sessionId: string, data: string): Promise<boolean>;
|
||||
resizeLocalTerminal(
|
||||
sessionId: string,
|
||||
cols: number,
|
||||
rows: number,
|
||||
): Promise<boolean>;
|
||||
closeLocalTerminal(sessionId: string): Promise<boolean>;
|
||||
onLocalTerminalData(
|
||||
sessionId: string,
|
||||
callback: (data: string) => void,
|
||||
): () => void;
|
||||
onLocalTerminalExit(
|
||||
sessionId: string,
|
||||
callback: (exitCode: number) => void,
|
||||
): () => void;
|
||||
|
||||
/** Local disk browsing for the dual-pane file manager (desktop only). */
|
||||
localFs?: {
|
||||
home: () => Promise<LocalFsResult<LocalFsHomeInfo>>;
|
||||
list: (dirPath: string) => Promise<LocalFsResult<LocalDirectoryListing>>;
|
||||
mkdir: (
|
||||
parentPath: string,
|
||||
name: string,
|
||||
) => Promise<LocalFsResult<{ path: string }>>;
|
||||
createFile: (
|
||||
parentPath: string,
|
||||
name: string,
|
||||
) => Promise<LocalFsResult<{ path: string }>>;
|
||||
rename: (
|
||||
oldPath: string,
|
||||
newName: string,
|
||||
) => Promise<LocalFsResult<{ path: string }>>;
|
||||
trash: (paths: string[]) => Promise<LocalFsResult<LocalTrashResult>>;
|
||||
ensureDir: (
|
||||
dirPath: string,
|
||||
rootPath?: string,
|
||||
) => Promise<LocalFsResult<{ path: string }>>;
|
||||
exists: (paths: string[]) => Promise<LocalFsResult<{ existing: string[] }>>;
|
||||
walk: (paths: string[]) => Promise<LocalFsResult<LocalWalkResult>>;
|
||||
reveal: (targetPath: string) => Promise<LocalFsResult<unknown>>;
|
||||
open: (targetPath: string) => Promise<LocalFsResult<unknown>>;
|
||||
};
|
||||
|
||||
/** Streamed local<->remote transfers driven by the main process. */
|
||||
localTransfer?: {
|
||||
upload: (
|
||||
options: LocalUploadRequest,
|
||||
) => Promise<LocalFsResult<{ bytes: number }>>;
|
||||
download: (
|
||||
options: LocalDownloadRequest,
|
||||
) => Promise<LocalFsResult<{ path: string }>>;
|
||||
cancel: (
|
||||
transferId: string,
|
||||
) => Promise<LocalFsResult<{ cancelled: boolean }>>;
|
||||
onProgress: (
|
||||
callback: (payload: LocalTransferProgress) => void,
|
||||
) => () => void;
|
||||
};
|
||||
}
|
||||
|
||||
export type LocalFsResult<T> =
|
||||
({ success: true } & T) | { success: false; error: string; code?: string };
|
||||
|
||||
export interface LocalFsHomeInfo {
|
||||
home: string;
|
||||
separator: string;
|
||||
platform: string;
|
||||
}
|
||||
|
||||
export interface LocalFileEntry {
|
||||
name: string;
|
||||
path: string;
|
||||
type: "file" | "directory" | "link" | "other";
|
||||
created?: string;
|
||||
modified?: string;
|
||||
permissions?: string;
|
||||
owner?: string;
|
||||
group?: string;
|
||||
size: number;
|
||||
modifiedTimestamp?: number;
|
||||
linkTarget?: string;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
export interface LocalDirectoryListing {
|
||||
path: string;
|
||||
parent: string | null;
|
||||
entries: LocalFileEntry[];
|
||||
}
|
||||
|
||||
export interface LocalTrashResult {
|
||||
trashed: number;
|
||||
failed: Array<{ path: string; error: string }>;
|
||||
}
|
||||
|
||||
export interface LocalWalkFile {
|
||||
localPath: string;
|
||||
/** Path relative to the drop root; "/"-separated and includes the root's own name. */
|
||||
relativePath: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface LocalWalkResult {
|
||||
files: LocalWalkFile[];
|
||||
emptyDirs: string[];
|
||||
totalBytes: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Which Termix backend a transfer talks to. The main process resolves the
|
||||
* actual URL and credentials for the origin; the renderer never supplies them.
|
||||
*/
|
||||
export type LocalTransferOrigin = "local" | "remote";
|
||||
|
||||
export interface LocalUploadRequest {
|
||||
transferId: string;
|
||||
origin: LocalTransferOrigin;
|
||||
fields: Record<string, string>;
|
||||
localPath: string;
|
||||
fileName: string;
|
||||
deviceId?: string;
|
||||
/** The renderer's token for the embedded backend (origin "local"); sent as a Bearer header. */
|
||||
authToken?: string;
|
||||
}
|
||||
|
||||
export interface LocalDownloadRequest {
|
||||
transferId: string;
|
||||
origin: LocalTransferOrigin;
|
||||
body: Record<string, unknown>;
|
||||
destPath: string;
|
||||
/** Selected download folder; destPath must resolve strictly inside it (code EINVAL otherwise). */
|
||||
rootPath: string;
|
||||
expectedSize?: number;
|
||||
/** Replace an existing file at destPath; otherwise the transfer is refused with code EEXIST. */
|
||||
overwrite?: boolean;
|
||||
deviceId?: string;
|
||||
/** The renderer's token for the embedded backend (origin "local"); sent as a Bearer header. */
|
||||
authToken?: string;
|
||||
}
|
||||
|
||||
export interface LocalTransferProgress {
|
||||
transferId: string;
|
||||
transferred: number;
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
electronAPI: ElectronAPI;
|
||||
IS_ELECTRON: boolean;
|
||||
electronClipboard?: {
|
||||
writeText(text: string): Promise<boolean>;
|
||||
readText(): Promise<string>;
|
||||
};
|
||||
}
|
||||
}
|
||||
export type * from "@termix/plugin-sdk/desktop";
|
||||
Vendored
-225
@@ -1,225 +0,0 @@
|
||||
declare module "guacamole-common-js" {
|
||||
namespace Guacamole {
|
||||
class Client {
|
||||
constructor(tunnel: Tunnel);
|
||||
connect(data?: string): void;
|
||||
disconnect(): void;
|
||||
getDisplay(): Display;
|
||||
sendKeyEvent(pressed: number, keysym: number): void;
|
||||
sendMouseState(state: Mouse.State): void;
|
||||
sendSize(width: number, height: number): void;
|
||||
setClipboard(stream: OutputStream, mimetype: string): void;
|
||||
createClipboardStream(mimetype: string): OutputStream;
|
||||
onstatechange: ((state: number) => void) | null;
|
||||
onerror: ((error: Status) => void) | null;
|
||||
onsync: ((timestamp: number) => void) | null;
|
||||
onclipboard: ((stream: InputStream, mimetype: string) => void) | null;
|
||||
onaudio: ((stream: InputStream, mimetype: string) => void) | null;
|
||||
onfile:
|
||||
| ((stream: InputStream, mimetype: string, filename: string) => void)
|
||||
| null;
|
||||
onfilesystem: ((filesystem: Object, name: string) => void) | null;
|
||||
}
|
||||
|
||||
// Mirrors Guacamole.Object: a named collection of streams. Within this
|
||||
// namespace `Object` refers to this class, not the global one.
|
||||
class Object {
|
||||
static readonly ROOT_STREAM: string;
|
||||
static readonly STREAM_INDEX_MIMETYPE: string;
|
||||
readonly index: number;
|
||||
requestInputStream(
|
||||
name: string,
|
||||
bodyCallback?: (stream: InputStream, mimetype: string) => void,
|
||||
): void;
|
||||
createOutputStream(mimetype: string, name: string): OutputStream;
|
||||
onbody: ((stream: InputStream, mimetype: string) => void) | null;
|
||||
onundefine: (() => void) | null;
|
||||
}
|
||||
|
||||
class AudioPlayer {
|
||||
static getInstance(
|
||||
stream: InputStream,
|
||||
mimetype: string,
|
||||
): AudioPlayer | null;
|
||||
sync(): void;
|
||||
}
|
||||
|
||||
class Display {
|
||||
getElement(): HTMLElement;
|
||||
getWidth(): number;
|
||||
getHeight(): number;
|
||||
scale(scale: number): void;
|
||||
onresize: (() => void) | null;
|
||||
}
|
||||
|
||||
class Tunnel {
|
||||
onerror: ((status: Status) => void) | null;
|
||||
onstatechange: ((state: number) => void) | null;
|
||||
}
|
||||
|
||||
class WebSocketTunnel extends Tunnel {
|
||||
constructor(url: string);
|
||||
}
|
||||
|
||||
class SessionRecording {
|
||||
constructor(source: Blob | Tunnel, refreshInterval?: number);
|
||||
onload: (() => void) | null;
|
||||
onerror: ((message: string) => void) | null;
|
||||
onprogress: ((duration: number, parsedSize: number) => void) | null;
|
||||
onplay: (() => void) | null;
|
||||
onpause: (() => void) | null;
|
||||
onseek:
|
||||
((position: number, current: number, total: number) => void) | null;
|
||||
getDisplay(): Display;
|
||||
getPosition(): number;
|
||||
getDuration(): number;
|
||||
isPlaying(): boolean;
|
||||
play(): void;
|
||||
pause(): void;
|
||||
seek(position: number, callback?: () => void): void;
|
||||
abort(): void;
|
||||
}
|
||||
|
||||
class Mouse {
|
||||
constructor(element: HTMLElement);
|
||||
onmousedown: ((state: Mouse.State) => void) | null;
|
||||
onmouseup: ((state: Mouse.State) => void) | null;
|
||||
onmousemove: ((state: Mouse.State) => void) | null;
|
||||
onmouseout: ((state: Mouse.State) => void) | null;
|
||||
}
|
||||
|
||||
namespace Mouse {
|
||||
class State {
|
||||
constructor(
|
||||
x: number,
|
||||
y: number,
|
||||
left?: boolean,
|
||||
middle?: boolean,
|
||||
right?: boolean,
|
||||
up?: boolean,
|
||||
down?: boolean,
|
||||
);
|
||||
constructor(state: {
|
||||
x: number;
|
||||
y: number;
|
||||
left?: boolean;
|
||||
middle?: boolean;
|
||||
right?: boolean;
|
||||
up?: boolean;
|
||||
down?: boolean;
|
||||
});
|
||||
x: number;
|
||||
y: number;
|
||||
left: boolean;
|
||||
middle: boolean;
|
||||
right: boolean;
|
||||
up: boolean;
|
||||
down: boolean;
|
||||
}
|
||||
|
||||
interface MouseEvent {
|
||||
state: Mouse.State;
|
||||
preventDefault(): void;
|
||||
stopPropagation(): void;
|
||||
}
|
||||
|
||||
class Touchpad {
|
||||
constructor(element: HTMLElement);
|
||||
currentState: Mouse.State;
|
||||
clickTimingThreshold: number;
|
||||
clickMoveThreshold: number;
|
||||
scrollThreshold: number;
|
||||
onEach(
|
||||
types: string[],
|
||||
listener: (event: Mouse.MouseEvent) => void,
|
||||
): void;
|
||||
on(type: string, listener: (event: Mouse.MouseEvent) => void): void;
|
||||
}
|
||||
|
||||
class Touchscreen {
|
||||
constructor(element: HTMLElement);
|
||||
currentState: Mouse.State;
|
||||
clickTimingThreshold: number;
|
||||
clickMoveThreshold: number;
|
||||
scrollThreshold: number;
|
||||
longPressThreshold: number;
|
||||
onEach(
|
||||
types: string[],
|
||||
listener: (event: Mouse.MouseEvent) => void,
|
||||
): void;
|
||||
on(type: string, listener: (event: Mouse.MouseEvent) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
class Keyboard {
|
||||
constructor(element: Document | HTMLElement);
|
||||
reset(): void;
|
||||
onkeydown: ((keysym: number) => void) | null;
|
||||
onkeyup: ((keysym: number) => void) | null;
|
||||
}
|
||||
|
||||
class Status {
|
||||
code: number;
|
||||
message: string;
|
||||
isError(): boolean;
|
||||
static readonly Code: {
|
||||
SUCCESS: number;
|
||||
UNSUPPORTED: number;
|
||||
SERVER_ERROR: number;
|
||||
SERVER_BUSY: number;
|
||||
UPSTREAM_TIMEOUT: number;
|
||||
UPSTREAM_ERROR: number;
|
||||
RESOURCE_NOT_FOUND: number;
|
||||
RESOURCE_CONFLICT: number;
|
||||
RESOURCE_CLOSED: number;
|
||||
CLIENT_BAD_REQUEST: number;
|
||||
CLIENT_UNAUTHORIZED: number;
|
||||
CLIENT_FORBIDDEN: number;
|
||||
CLIENT_TIMEOUT: number;
|
||||
};
|
||||
}
|
||||
|
||||
class InputStream {
|
||||
onblob: ((data: string) => void) | null;
|
||||
onend: (() => void) | null;
|
||||
sendAck(message: string, code: number): void;
|
||||
}
|
||||
|
||||
class OutputStream {
|
||||
sendBlob(data: string): void;
|
||||
sendEnd(): void;
|
||||
}
|
||||
|
||||
class StringReader {
|
||||
constructor(stream: InputStream);
|
||||
ontext: ((text: string) => void) | null;
|
||||
onend: (() => void) | null;
|
||||
}
|
||||
|
||||
class StringWriter {
|
||||
constructor(stream: OutputStream);
|
||||
sendText(text: string): void;
|
||||
sendEnd(): void;
|
||||
}
|
||||
|
||||
class BlobReader {
|
||||
constructor(stream: InputStream, mimetype: string);
|
||||
getBlob(): Blob;
|
||||
getLength(): number;
|
||||
onprogress: ((length: number) => void) | null;
|
||||
onend: (() => void) | null;
|
||||
}
|
||||
|
||||
class BlobWriter {
|
||||
constructor(stream: OutputStream);
|
||||
sendBlob(blob: Blob): void;
|
||||
sendEnd(): void;
|
||||
onack: ((status: Status) => void) | null;
|
||||
onerror: ((blob: Blob, offset: number, error: Status) => void) | null;
|
||||
onprogress: ((blob: Blob, offset: number) => void) | null;
|
||||
oncomplete: ((blob: Blob) => void) | null;
|
||||
}
|
||||
}
|
||||
|
||||
export default Guacamole;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/**
|
||||
* Per-host Guacamole connection settings, as edited in the host editor and
|
||||
* forwarded to guacd. Field names are camelCase here and translated to the
|
||||
* hyphenated protocol parameters in toGuacamoleParams().
|
||||
*/
|
||||
export interface GuacamoleConfig {
|
||||
colorDepth?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
dpi?: number;
|
||||
resizeMethod?: string;
|
||||
forceLossless?: boolean;
|
||||
disableAudio?: boolean;
|
||||
enableAudioInput?: boolean;
|
||||
enableWallpaper?: boolean;
|
||||
enableTheming?: boolean;
|
||||
enableFontSmoothing?: boolean;
|
||||
enableFullWindowDrag?: boolean;
|
||||
enableDesktopComposition?: boolean;
|
||||
enableMenuAnimations?: boolean;
|
||||
disableBitmapCaching?: boolean;
|
||||
disableOffscreenCaching?: boolean;
|
||||
disableGlyphCaching?: boolean;
|
||||
disableGfx?: boolean;
|
||||
enablePrinting?: boolean;
|
||||
printerName?: string;
|
||||
enableDrive?: boolean;
|
||||
driveName?: string;
|
||||
drivePath?: string;
|
||||
createDrivePath?: boolean;
|
||||
disableDownload?: boolean;
|
||||
disableUpload?: boolean;
|
||||
enableTouch?: boolean;
|
||||
clientName?: string;
|
||||
console?: boolean;
|
||||
initialProgram?: string;
|
||||
serverLayout?: string;
|
||||
timezone?: string;
|
||||
gatewayHostname?: string;
|
||||
gatewayPort?: number;
|
||||
gatewayUsername?: string;
|
||||
gatewayPassword?: string;
|
||||
gatewayDomain?: string;
|
||||
remoteApp?: string;
|
||||
remoteAppDir?: string;
|
||||
remoteAppArgs?: string;
|
||||
normalizeClipboard?: string;
|
||||
disableCopy?: boolean;
|
||||
disablePaste?: boolean;
|
||||
cursor?: string;
|
||||
swapRedBlue?: boolean;
|
||||
readOnly?: boolean;
|
||||
recordingPath?: string;
|
||||
recordingName?: string;
|
||||
createRecordingPath?: boolean;
|
||||
recordingExcludeOutput?: boolean;
|
||||
recordingExcludeMouse?: boolean;
|
||||
recordingIncludeKeys?: boolean;
|
||||
wolSendPacket?: boolean;
|
||||
wolMacAddr?: string;
|
||||
wolBroadcastAddr?: string;
|
||||
wolUdpPort?: number;
|
||||
wolWaitTime?: number;
|
||||
}
|
||||
@@ -1,415 +0,0 @@
|
||||
export const GRID_SIZE = 30;
|
||||
export const MIN_ZOOM = 0.4;
|
||||
export const MAX_ZOOM = 2.0;
|
||||
export const ZOOM_STEP = 0.1;
|
||||
|
||||
export type WidgetTypeId =
|
||||
| "service_link"
|
||||
| "folder"
|
||||
| "clock"
|
||||
| "notes"
|
||||
| "host_status"
|
||||
| "bookmark_list"
|
||||
| "weather"
|
||||
| "iframe_embed"
|
||||
| "rss_feed"
|
||||
| "metrics_chart"
|
||||
| "host_grid"
|
||||
| "alert_feed"
|
||||
| "ping_status"
|
||||
| "recent_activity"
|
||||
| "termix_uptime"
|
||||
| "system_overview"
|
||||
| "ssh_terminal"
|
||||
| "quick_connect"
|
||||
| "file_manager_widget"
|
||||
| "docker_widget"
|
||||
| "tunnel_widget"
|
||||
| "calendar"
|
||||
| "countdown"
|
||||
| "search_bar"
|
||||
| "text_banner"
|
||||
| "image_widget"
|
||||
| "markdown_notes"
|
||||
| "custom_api"
|
||||
| "service_grid"
|
||||
| "dashboard_links"
|
||||
| "search_links"
|
||||
| "link_tree"
|
||||
| "docker_activity"
|
||||
| "ssh_quick_connect";
|
||||
|
||||
export interface HomepageItemRow {
|
||||
id: number;
|
||||
userId: string;
|
||||
typeId: WidgetTypeId;
|
||||
title: string | null;
|
||||
config: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface HomepageLayoutEntry {
|
||||
itemId: number;
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
zOrder?: number;
|
||||
}
|
||||
|
||||
export interface HomepageLayoutData {
|
||||
entries: HomepageLayoutEntry[];
|
||||
pan: { x: number; y: number };
|
||||
zoom: number;
|
||||
}
|
||||
|
||||
export interface HomepageLayoutRow {
|
||||
id: number;
|
||||
userId: string;
|
||||
layout: HomepageLayoutData;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CanvasWidget {
|
||||
id: number;
|
||||
typeId: WidgetTypeId;
|
||||
title: string | null;
|
||||
config: Record<string, unknown>;
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
zOrder: number;
|
||||
}
|
||||
|
||||
// ---- Per-widget config shapes ----
|
||||
|
||||
export interface ServiceLinkConfig {
|
||||
url: string;
|
||||
description?: string;
|
||||
accentColor?: string;
|
||||
imageUrl?: string;
|
||||
showImage?: boolean;
|
||||
}
|
||||
|
||||
export interface FolderConfig {
|
||||
color?: string;
|
||||
isExpanded: boolean;
|
||||
}
|
||||
|
||||
export interface ClockConfig {
|
||||
timezone?: string;
|
||||
showSeconds: boolean;
|
||||
format: "12h" | "24h";
|
||||
}
|
||||
|
||||
export interface NotesConfig {
|
||||
content: string;
|
||||
backgroundColor?: string;
|
||||
}
|
||||
|
||||
export type HostMetricKey =
|
||||
"cpu" | "memory" | "disk" | "uptime" | "network" | "system" | "processes";
|
||||
|
||||
export interface HostStatusConfig {
|
||||
hostId: number;
|
||||
/** @deprecated use shownMetrics instead */
|
||||
showMetrics?: boolean;
|
||||
/** @deprecated use shownMetrics instead */
|
||||
showDisk?: boolean;
|
||||
shownMetrics: HostMetricKey[];
|
||||
showSparkline?: boolean;
|
||||
}
|
||||
|
||||
export interface BookmarkLink {
|
||||
label: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface BookmarkListConfig {
|
||||
links: BookmarkLink[];
|
||||
}
|
||||
|
||||
export interface WeatherConfig {
|
||||
location: string;
|
||||
unit: "C" | "F";
|
||||
showForecast: boolean;
|
||||
}
|
||||
|
||||
export interface IframeConfig {
|
||||
url: string;
|
||||
scrolling: boolean;
|
||||
}
|
||||
|
||||
export interface RssFeedConfig {
|
||||
feedUrl: string;
|
||||
maxItems: number;
|
||||
showDescription: boolean;
|
||||
}
|
||||
|
||||
// ---- New widget configs ----
|
||||
|
||||
export type MetricsChartMetric =
|
||||
"cpu" | "memory" | "disk" | "net_rx" | "net_tx";
|
||||
export type MetricsChartRange = "15m" | "1h" | "6h" | "24h";
|
||||
|
||||
export interface MetricsChartConfig {
|
||||
hostId: number;
|
||||
metric: MetricsChartMetric;
|
||||
range: MetricsChartRange;
|
||||
showCurrentValue: boolean;
|
||||
}
|
||||
|
||||
export interface HostGridConfig {
|
||||
hostIds: number[];
|
||||
showIp: boolean;
|
||||
columns: 2 | 3 | 4;
|
||||
}
|
||||
|
||||
export interface AlertFeedConfig {
|
||||
maxItems: number;
|
||||
showAcknowledged: boolean;
|
||||
}
|
||||
|
||||
export interface PingUrl {
|
||||
label: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface PingStatusConfig {
|
||||
urls: PingUrl[];
|
||||
refreshInterval: number;
|
||||
showLatency: boolean;
|
||||
}
|
||||
|
||||
export type ActivityType =
|
||||
"terminal" | "file_manager" | "docker" | "tunnel" | "rdp" | "vnc" | "telnet";
|
||||
|
||||
export interface RecentActivityConfig {
|
||||
maxItems: number;
|
||||
filterTypes: ActivityType[];
|
||||
showTimestamp: boolean;
|
||||
}
|
||||
|
||||
export interface DockerActivityConfig {
|
||||
maxItems: number;
|
||||
showHostName: boolean;
|
||||
}
|
||||
|
||||
export interface SshQuickConnectConfig {
|
||||
hostIds: number[];
|
||||
connectionType: QuickConnectType;
|
||||
showStatus: boolean;
|
||||
layout: "grid" | "list";
|
||||
}
|
||||
|
||||
export interface TermixUptimeConfig {
|
||||
showDetailed: boolean;
|
||||
}
|
||||
|
||||
export interface SystemOverviewConfig {
|
||||
showVersion: boolean;
|
||||
showDbHealth: boolean;
|
||||
showUptime: boolean;
|
||||
}
|
||||
|
||||
export interface FileManagerWidgetConfig {
|
||||
hostId: number;
|
||||
}
|
||||
|
||||
export interface DockerWidgetConfig {
|
||||
hostId: number;
|
||||
}
|
||||
|
||||
export interface TunnelWidgetConfig {
|
||||
hostId: number;
|
||||
}
|
||||
|
||||
export interface SshTerminalConfig {
|
||||
hostId: number;
|
||||
autoConnect: boolean;
|
||||
}
|
||||
|
||||
export type QuickConnectType =
|
||||
| "terminal"
|
||||
| "files"
|
||||
| "docker"
|
||||
| "tunnel"
|
||||
| "host-metrics"
|
||||
| "rdp"
|
||||
| "vnc"
|
||||
| "telnet";
|
||||
|
||||
export interface QuickConnectConfig {
|
||||
hostIds: number[];
|
||||
connectionTypes: QuickConnectType[];
|
||||
showStatus: boolean;
|
||||
layout: "grid" | "list";
|
||||
}
|
||||
|
||||
export interface CalendarConfig {
|
||||
timezone?: string;
|
||||
startOnMonday: boolean;
|
||||
}
|
||||
|
||||
export interface CountdownConfig {
|
||||
targetDate: string;
|
||||
label: string;
|
||||
showDays: boolean;
|
||||
showHours: boolean;
|
||||
}
|
||||
|
||||
export type SearchEngine = "google" | "duckduckgo" | "bing" | "custom";
|
||||
|
||||
export interface SearchBarConfig {
|
||||
engine: SearchEngine;
|
||||
customUrl?: string;
|
||||
placeholder?: string;
|
||||
openInNewTab: boolean;
|
||||
}
|
||||
|
||||
export type TextBannerFontSize = "sm" | "md" | "lg" | "xl";
|
||||
export type TextBannerAlign = "left" | "center" | "right";
|
||||
export type TextBannerWeight = "normal" | "semibold" | "bold";
|
||||
|
||||
export interface TextBannerConfig {
|
||||
text: string;
|
||||
fontSize: TextBannerFontSize;
|
||||
textAlign: TextBannerAlign;
|
||||
fontWeight: TextBannerWeight;
|
||||
backgroundColor?: string;
|
||||
}
|
||||
|
||||
export interface ImageWidgetConfig {
|
||||
imageUrl: string;
|
||||
fit: "contain" | "cover" | "fill";
|
||||
alt?: string;
|
||||
linkUrl?: string;
|
||||
}
|
||||
|
||||
export interface MarkdownNotesConfig {
|
||||
content: string;
|
||||
backgroundColor?: string;
|
||||
renderMarkdown: boolean;
|
||||
}
|
||||
|
||||
export type CustomApiDisplayMode = "value" | "json" | "table";
|
||||
|
||||
export interface CustomApiConfig {
|
||||
url: string;
|
||||
displayField?: string;
|
||||
label?: string;
|
||||
unit?: string;
|
||||
refreshInterval: number;
|
||||
displayMode: CustomApiDisplayMode;
|
||||
jsonPath?: string;
|
||||
}
|
||||
|
||||
export interface ServiceGridItem {
|
||||
label: string;
|
||||
url: string;
|
||||
imageUrl?: string;
|
||||
accentColor?: string;
|
||||
}
|
||||
|
||||
export interface ServiceGridConfig {
|
||||
services: ServiceGridItem[];
|
||||
columns: 2 | 3 | 4;
|
||||
showLabels: boolean;
|
||||
iconSize: "sm" | "md" | "lg";
|
||||
}
|
||||
|
||||
export interface DashboardLinksConfig {
|
||||
showIcons: boolean;
|
||||
columns: 1 | 2 | 3;
|
||||
maxItems?: number;
|
||||
}
|
||||
|
||||
export interface SearchLinkShortcut {
|
||||
label: string;
|
||||
queryTemplate: string;
|
||||
icon?: string;
|
||||
accentColor?: string;
|
||||
}
|
||||
|
||||
export interface SearchLinksConfig {
|
||||
shortcuts: SearchLinkShortcut[];
|
||||
}
|
||||
|
||||
export interface LinkTreeLink {
|
||||
label: string;
|
||||
url: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface LinkTreeSection {
|
||||
heading: string;
|
||||
links: LinkTreeLink[];
|
||||
}
|
||||
|
||||
export interface LinkTreeConfig {
|
||||
sections: LinkTreeSection[];
|
||||
compact: boolean;
|
||||
}
|
||||
|
||||
// ---- Widget registry types ----
|
||||
|
||||
export interface WidgetComponentProps<C = Record<string, unknown>> {
|
||||
widget: CanvasWidget;
|
||||
config: C;
|
||||
isReadOnly?: boolean;
|
||||
onConfigUpdate?: (config: Record<string, unknown>) => void;
|
||||
}
|
||||
|
||||
export interface WidgetEditFormProps<C = Record<string, unknown>> {
|
||||
config: C;
|
||||
onChange: (config: C) => void;
|
||||
}
|
||||
|
||||
export interface WidgetTypeDefinition<C = Record<string, unknown>> {
|
||||
id: WidgetTypeId;
|
||||
name: string;
|
||||
description: string;
|
||||
category: "links" | "info" | "system" | "monitoring";
|
||||
icon: React.ReactNode;
|
||||
defaultConfig: C;
|
||||
defaultSize: { w: number; h: number };
|
||||
minSize: { w: number; h: number };
|
||||
component: React.ComponentType<WidgetComponentProps<C>>;
|
||||
editFormComponent?: React.ComponentType<WidgetEditFormProps<C>>;
|
||||
}
|
||||
|
||||
export interface DragState {
|
||||
widgetId: number;
|
||||
startMouseX: number;
|
||||
startMouseY: number;
|
||||
startWidgetX: number;
|
||||
startWidgetY: number;
|
||||
}
|
||||
|
||||
export interface ResizeState {
|
||||
widgetId: number;
|
||||
startMouseX: number;
|
||||
startMouseY: number;
|
||||
startW: number;
|
||||
startH: number;
|
||||
}
|
||||
|
||||
export interface ContextMenuAnchor {
|
||||
top: number;
|
||||
bottom: number;
|
||||
left: number;
|
||||
right: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface ContextMenuState {
|
||||
visible: boolean;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
canvasX: number;
|
||||
canvasY: number;
|
||||
anchorRect?: ContextMenuAnchor;
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/**
|
||||
* Host defaults: the keys a host can inherit and how their values compare.
|
||||
*
|
||||
* Shared by the backend (resolution, materializing, the upgrade) and the host
|
||||
* editor (which fields show an inherited badge). A key is namespaced:
|
||||
* "core.<key>" for core's own fields, "<pluginId>.<field>" for a plugin's host
|
||||
* setting. Values are in the host API's shape, never in column form.
|
||||
*/
|
||||
|
||||
export type HostDefaultsLevel = "admin" | "user" | "folder";
|
||||
|
||||
export const HOST_DEFAULTS_LEVELS: readonly HostDefaultsLevel[] = [
|
||||
"admin",
|
||||
"user",
|
||||
"folder",
|
||||
];
|
||||
|
||||
export const CORE_NAMESPACE = "core";
|
||||
|
||||
/** Namespace -> keys the host sets itself. */
|
||||
export type DefaultOverrides = Record<string, string[]>;
|
||||
|
||||
export interface HostDefaultSource {
|
||||
level: HostDefaultsLevel | "builtin";
|
||||
folderId?: number;
|
||||
folderName?: string;
|
||||
}
|
||||
|
||||
export interface ResolvedHostDefault {
|
||||
value: unknown;
|
||||
source: HostDefaultSource;
|
||||
}
|
||||
|
||||
export interface HostAuthDefault {
|
||||
authType: string;
|
||||
credentialId: number | null;
|
||||
overrideCredentialUsername: boolean;
|
||||
agentSocketPath: string | null;
|
||||
agentIdentity: string | null;
|
||||
}
|
||||
|
||||
export interface HostSocks5Default {
|
||||
useSocks5: boolean;
|
||||
socks5Host: string | null;
|
||||
socks5Port: number | null;
|
||||
socks5Username: string | null;
|
||||
socks5ProxyChain: unknown[] | null;
|
||||
}
|
||||
|
||||
export interface CoreHostDefault {
|
||||
key: string;
|
||||
/** Levels allowed to set it. A value that points at a user's row is never admin. */
|
||||
levels: readonly HostDefaultsLevel[];
|
||||
/** What a host gets when no level sets it. Undefined means nothing to inherit. */
|
||||
builtin: unknown;
|
||||
/** One canonical form, so two spellings of the same value compare equal. */
|
||||
normalize: (value: unknown) => unknown;
|
||||
}
|
||||
|
||||
const ALL_LEVELS = HOST_DEFAULTS_LEVELS;
|
||||
const OWN_LEVELS: readonly HostDefaultsLevel[] = ["user", "folder"];
|
||||
|
||||
function toBoolean(value: unknown, fallback: boolean): boolean {
|
||||
if (value === true || value === 1 || value === "true" || value === "1")
|
||||
return true;
|
||||
if (value === false || value === 0 || value === "false" || value === "0")
|
||||
return false;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
function toNumber(value: unknown, fallback: number | null): number | null {
|
||||
if (value === null || value === undefined || value === "") return fallback;
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : fallback;
|
||||
}
|
||||
|
||||
function toText(value: unknown): string | null {
|
||||
return typeof value === "string" && value.trim() !== "" ? value : null;
|
||||
}
|
||||
|
||||
function toArray(value: unknown): unknown[] {
|
||||
let parsed = value;
|
||||
if (typeof parsed === "string") {
|
||||
try {
|
||||
parsed = JSON.parse(parsed);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
}
|
||||
|
||||
function toObject(value: unknown): Record<string, unknown> | null {
|
||||
let parsed = value;
|
||||
if (typeof parsed === "string") {
|
||||
try {
|
||||
parsed = JSON.parse(parsed);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
||||
? (parsed as Record<string, unknown>)
|
||||
: null;
|
||||
}
|
||||
|
||||
/** Auth types whose login lives on the host itself, so it cannot be a default. */
|
||||
export const SECRET_AUTH_TYPES = ["password", "key"];
|
||||
|
||||
export function normalizeAuthDefault(value: unknown): HostAuthDefault | null {
|
||||
const source = toObject(value);
|
||||
if (!source || typeof source.authType !== "string" || !source.authType)
|
||||
return null;
|
||||
const authType = source.authType;
|
||||
const credentialId = toNumber(source.credentialId, null);
|
||||
return {
|
||||
authType,
|
||||
credentialId: authType === "credential" ? credentialId : null,
|
||||
overrideCredentialUsername:
|
||||
authType === "credential"
|
||||
? toBoolean(source.overrideCredentialUsername, false)
|
||||
: false,
|
||||
agentSocketPath:
|
||||
authType === "agent" ? toText(source.agentSocketPath) : null,
|
||||
agentIdentity: authType === "agent" ? toText(source.agentIdentity) : null,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeSocks5Default(value: unknown): HostSocks5Default {
|
||||
const source = toObject(value) ?? {};
|
||||
if (!toBoolean(source.useSocks5, false)) {
|
||||
return {
|
||||
useSocks5: false,
|
||||
socks5Host: null,
|
||||
socks5Port: null,
|
||||
socks5Username: null,
|
||||
socks5ProxyChain: null,
|
||||
};
|
||||
}
|
||||
const chain = toArray(source.socks5ProxyChain);
|
||||
if (chain.length > 0) {
|
||||
return {
|
||||
useSocks5: true,
|
||||
socks5Host: null,
|
||||
socks5Port: null,
|
||||
socks5Username: null,
|
||||
socks5ProxyChain: chain.map((node) => {
|
||||
const own = toObject(node) ?? {};
|
||||
// A proxy's password stays on the host.
|
||||
const { password: _password, ...rest } = own;
|
||||
return rest;
|
||||
}),
|
||||
};
|
||||
}
|
||||
return {
|
||||
useSocks5: true,
|
||||
socks5Host: toText(source.socks5Host),
|
||||
socks5Port: toNumber(source.socks5Port, 1080),
|
||||
socks5Username: toText(source.socks5Username),
|
||||
socks5ProxyChain: null,
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeJumpHosts(value: unknown): Array<{ hostId: number }> {
|
||||
return toArray(value)
|
||||
.map((entry) => toNumber(toObject(entry)?.hostId, null))
|
||||
.filter((hostId): hostId is number => hostId !== null)
|
||||
.map((hostId) => ({ hostId }));
|
||||
}
|
||||
|
||||
function normalizePortKnock(value: unknown): unknown[] {
|
||||
return toArray(value).map((entry) => {
|
||||
const own = toObject(entry) ?? {};
|
||||
return {
|
||||
port: toNumber(own.port, 0),
|
||||
protocol: own.protocol === "udp" ? "udp" : "tcp",
|
||||
delay: toNumber(own.delay, 0),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeEnvironment(value: unknown): unknown[] {
|
||||
return toArray(value).map((entry) => {
|
||||
const own = toObject(entry) ?? {};
|
||||
return { key: String(own.key ?? ""), value: String(own.value ?? "") };
|
||||
});
|
||||
}
|
||||
|
||||
export const CORE_HOST_DEFAULTS: readonly CoreHostDefault[] = [
|
||||
{
|
||||
key: "username",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: undefined,
|
||||
normalize: toText,
|
||||
},
|
||||
{
|
||||
key: "sshPort",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: 22,
|
||||
normalize: (value) => {
|
||||
const port = toNumber(value, 22);
|
||||
return port !== null && Number.isInteger(port) && port > 0 && port < 65536
|
||||
? port
|
||||
: 22;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "auth",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: undefined,
|
||||
normalize: normalizeAuthDefault,
|
||||
},
|
||||
{
|
||||
key: "forceKeyboardInteractive",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: false,
|
||||
normalize: (value) => toBoolean(value, false),
|
||||
},
|
||||
{
|
||||
key: "keepaliveInterval",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: 60,
|
||||
normalize: (value) => toNumber(value, 60),
|
||||
},
|
||||
{
|
||||
key: "keepaliveCountMax",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: 5,
|
||||
normalize: (value) => toNumber(value, 5),
|
||||
},
|
||||
{
|
||||
key: "allowLegacyAlgorithms",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: true,
|
||||
normalize: (value) => toBoolean(value, true),
|
||||
},
|
||||
{
|
||||
key: "agentForwarding",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: false,
|
||||
normalize: (value) => toBoolean(value, false),
|
||||
},
|
||||
{
|
||||
key: "environmentVariables",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: [],
|
||||
normalize: normalizeEnvironment,
|
||||
},
|
||||
{
|
||||
key: "socks5",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: normalizeSocks5Default(null),
|
||||
normalize: normalizeSocks5Default,
|
||||
},
|
||||
{
|
||||
key: "jumpHosts",
|
||||
levels: OWN_LEVELS,
|
||||
builtin: [],
|
||||
normalize: normalizeJumpHosts,
|
||||
},
|
||||
{
|
||||
key: "portKnockSequence",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: [],
|
||||
normalize: normalizePortKnock,
|
||||
},
|
||||
{
|
||||
key: "statusCheckEnabled",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: true,
|
||||
normalize: (value) => toBoolean(value, true),
|
||||
},
|
||||
{
|
||||
key: "statusCheckInterval",
|
||||
levels: ALL_LEVELS,
|
||||
builtin: null,
|
||||
normalize: (value) => {
|
||||
const interval = toNumber(value, null);
|
||||
return interval !== null && interval > 0 ? Math.round(interval) : null;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export function findCoreHostDefault(key: string): CoreHostDefault | undefined {
|
||||
return CORE_HOST_DEFAULTS.find((entry) => entry.key === key);
|
||||
}
|
||||
|
||||
/** "core.sshPort" -> ["core", "sshPort"]. The plugin id never has a dot. */
|
||||
export function splitDefaultKey(fullKey: string): [string, string] {
|
||||
const dot = fullKey.indexOf(".");
|
||||
if (dot <= 0) return [CORE_NAMESPACE, fullKey];
|
||||
return [fullKey.slice(0, dot), fullKey.slice(dot + 1)];
|
||||
}
|
||||
|
||||
export function joinDefaultKey(namespace: string, key: string): string {
|
||||
return `${namespace}.${key}`;
|
||||
}
|
||||
|
||||
/** JSON with sorted object keys, so equal values stringify the same. */
|
||||
export function stableStringify(value: unknown): string {
|
||||
if (value === undefined) return "undefined";
|
||||
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
||||
if (Array.isArray(value)) {
|
||||
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
||||
}
|
||||
const entries = Object.entries(value as Record<string, unknown>)
|
||||
.filter(([, item]) => item !== undefined)
|
||||
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
||||
return `{${entries
|
||||
.map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item)}`)
|
||||
.join(",")}}`;
|
||||
}
|
||||
|
||||
export function defaultValuesEqual(a: unknown, b: unknown): boolean {
|
||||
return stableStringify(a) === stableStringify(b);
|
||||
}
|
||||
|
||||
/** A stored or sent overrides value, or null when it is not one. */
|
||||
export function parseDefaultOverrides(raw: unknown): DefaultOverrides | null {
|
||||
const source = toObject(raw);
|
||||
if (!source) return null;
|
||||
const result: DefaultOverrides = {};
|
||||
for (const [namespace, keys] of Object.entries(source)) {
|
||||
if (!Array.isArray(keys)) continue;
|
||||
result[namespace] = [
|
||||
...new Set(keys.filter((key): key is string => typeof key === "string")),
|
||||
].sort();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function isDefaultOverridden(
|
||||
overrides: DefaultOverrides | null | undefined,
|
||||
namespace: string,
|
||||
key: string,
|
||||
): boolean {
|
||||
return !!overrides?.[namespace]?.includes(key);
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
import type { WidgetType } from "./stats-widgets.js";
|
||||
|
||||
/**
|
||||
* Host Metrics layout model. Shared by the frontend tab and the backend
|
||||
* preferences endpoint. Metric card ids reuse the existing `WidgetType` values
|
||||
* verbatim (so `enabledWidgets` stays valid for the mobile app); manager card
|
||||
* ids are new and never enter `statsConfig.enabledWidgets`.
|
||||
*/
|
||||
|
||||
export type HostMetricCardId = WidgetType;
|
||||
|
||||
export type HostMetricManagerId =
|
||||
| "service_manager"
|
||||
| "process_inspector"
|
||||
| "log_viewer"
|
||||
| "cron_manager"
|
||||
| "package_manager"
|
||||
| "ssl_manager"
|
||||
| "firewall_manager"
|
||||
| "user_manager"
|
||||
| "health_check"
|
||||
| "disk_breakdown"
|
||||
| "systemd_timers"
|
||||
| "top_memory"
|
||||
| "wireguard_manager"
|
||||
| "tailscale_manager";
|
||||
|
||||
export type HostMetricsCardId = HostMetricCardId | HostMetricManagerId;
|
||||
|
||||
export type HostMetricsColSpan = 1 | 2 | 3;
|
||||
|
||||
export interface HostMetricsSlot {
|
||||
id: HostMetricsCardId;
|
||||
order: number;
|
||||
colSpan: HostMetricsColSpan;
|
||||
height: number | null;
|
||||
}
|
||||
|
||||
export interface HostMetricsLayout {
|
||||
slots: HostMetricsSlot[];
|
||||
columns: number;
|
||||
}
|
||||
|
||||
/** Canonical order of metric cards (also the canonical `enabledWidgets` order). */
|
||||
export const METRIC_CARD_IDS: HostMetricCardId[] = [
|
||||
"cpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"network",
|
||||
"uptime",
|
||||
"system",
|
||||
"login_stats",
|
||||
"processes",
|
||||
"ports",
|
||||
"firewall",
|
||||
"temperature",
|
||||
"gpu",
|
||||
];
|
||||
|
||||
export const MANAGER_CARD_IDS: HostMetricManagerId[] = [
|
||||
"service_manager",
|
||||
"process_inspector",
|
||||
"log_viewer",
|
||||
"cron_manager",
|
||||
"package_manager",
|
||||
"ssl_manager",
|
||||
"firewall_manager",
|
||||
"user_manager",
|
||||
"health_check",
|
||||
"disk_breakdown",
|
||||
"systemd_timers",
|
||||
"top_memory",
|
||||
"wireguard_manager",
|
||||
"tailscale_manager",
|
||||
];
|
||||
|
||||
export function isMetricCardId(id: string): id is HostMetricCardId {
|
||||
return (METRIC_CARD_IDS as string[]).includes(id);
|
||||
}
|
||||
|
||||
export function isManagerCardId(id: string): id is HostMetricManagerId {
|
||||
return (MANAGER_CARD_IDS as string[]).includes(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Derive the flat `enabledWidgets` array (canonical order, deduped, metric ids
|
||||
* only) from a set of layout slots. This is the single source of truth keeping
|
||||
* `statsConfig.enabledWidgets` valid for the mobile app.
|
||||
*/
|
||||
export function deriveEnabledWidgets(
|
||||
slots: Array<{ id: string }>,
|
||||
): WidgetType[] {
|
||||
const present = new Set(slots.map((s) => s.id));
|
||||
return METRIC_CARD_IDS.filter((id) => present.has(id));
|
||||
}
|
||||
|
||||
const DEFAULT_COLSPAN: Partial<Record<HostMetricsCardId, HostMetricsColSpan>> =
|
||||
{
|
||||
cpu: 1,
|
||||
memory: 1,
|
||||
disk: 1,
|
||||
uptime: 1,
|
||||
system: 1,
|
||||
network: 1,
|
||||
temperature: 1,
|
||||
processes: 2,
|
||||
ports: 2,
|
||||
firewall: 2,
|
||||
login_stats: 2,
|
||||
gpu: 2,
|
||||
};
|
||||
|
||||
// All cards default to content/auto height (null); the masonry packs them
|
||||
// tetris-style and scrollable cards cap their own body height. Users can still
|
||||
// pin an explicit height by dragging a card's resize handle.
|
||||
const DEFAULT_HEIGHT: Partial<Record<HostMetricsCardId, number | null>> = {};
|
||||
|
||||
/**
|
||||
* Build a default layout from a list of enabled metric-card ids (e.g. the host's
|
||||
* current `statsConfig.enabledWidgets`), preserving canonical order. Manager
|
||||
* cards are not added by default.
|
||||
*/
|
||||
export function defaultLayoutFromWidgets(
|
||||
enabledWidgets: string[],
|
||||
columns = 3,
|
||||
): HostMetricsLayout {
|
||||
const enabled = new Set(enabledWidgets);
|
||||
const ids = METRIC_CARD_IDS.filter((id) => enabled.has(id));
|
||||
const slots: HostMetricsSlot[] = ids.map((id, i) => ({
|
||||
id,
|
||||
order: i,
|
||||
colSpan: DEFAULT_COLSPAN[id] ?? 1,
|
||||
height: DEFAULT_HEIGHT[id] ?? null,
|
||||
}));
|
||||
return { slots, columns };
|
||||
}
|
||||
|
||||
export function defaultColSpanFor(id: HostMetricsCardId): HostMetricsColSpan {
|
||||
return DEFAULT_COLSPAN[id] ?? (isManagerCardId(id) ? 2 : 1);
|
||||
}
|
||||
|
||||
export function defaultHeightFor(id: HostMetricsCardId): number | null {
|
||||
if (id in DEFAULT_HEIGHT) return DEFAULT_HEIGHT[id] ?? null;
|
||||
return null;
|
||||
}
|
||||
@@ -32,13 +32,18 @@ export type HostDensity = "comfortable" | "compact";
|
||||
|
||||
export type HostTrayTrigger = "always" | "hover" | "click" | "actionsOnly";
|
||||
|
||||
/** What clicking a host does when it already has an open tab. */
|
||||
export type HostClickBehavior =
|
||||
"newTab" | "focusExisting" | "focusExistingDoubleClickNew";
|
||||
|
||||
export interface HostSidebarFilterState {
|
||||
status: ("online" | "offline" | "pinned")[];
|
||||
authType: (
|
||||
"password" | "key" | "credential" | "none" | "opkssh" | "stepca"
|
||||
)[];
|
||||
protocol: ("ssh" | "rdp" | "vnc" | "telnet")[];
|
||||
features: ("terminal" | "fileManager" | "tunnel" | "docker")[];
|
||||
/** SSH auth type ids; plugins add their own. */
|
||||
authType: string[];
|
||||
/** "ssh" or a plugin protocol id. */
|
||||
protocol: string[];
|
||||
/** Plugin ids whose host switch must be on. */
|
||||
features: string[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
@@ -49,6 +54,9 @@ export interface HostSidebarDisplayPreferences {
|
||||
statusColorScheme: StatusColorScheme;
|
||||
/** When true, a host row needs a double click to launch its session. */
|
||||
openOnDoubleClick: boolean;
|
||||
/** When false, nested folders hide the parent-path breadcrumb before their name. */
|
||||
showFolderPaths: boolean;
|
||||
hostClickBehavior: HostClickBehavior;
|
||||
}
|
||||
|
||||
export interface HostSidebarPreferences {
|
||||
@@ -84,32 +92,19 @@ const TRAY_TRIGGERS: HostTrayTrigger[] = [
|
||||
"click",
|
||||
"actionsOnly",
|
||||
];
|
||||
const HOST_CLICK_BEHAVIORS: HostClickBehavior[] = [
|
||||
"newTab",
|
||||
"focusExisting",
|
||||
"focusExistingDoubleClickNew",
|
||||
];
|
||||
const STATUS_COLOR_SCHEMES: StatusColorScheme[] = ["accent", "status"];
|
||||
const FILTER_STATUS: HostSidebarFilterState["status"] = [
|
||||
"online",
|
||||
"offline",
|
||||
"pinned",
|
||||
];
|
||||
const FILTER_AUTH_TYPE: HostSidebarFilterState["authType"] = [
|
||||
"password",
|
||||
"key",
|
||||
"credential",
|
||||
"none",
|
||||
"opkssh",
|
||||
"stepca",
|
||||
];
|
||||
const FILTER_PROTOCOL: HostSidebarFilterState["protocol"] = [
|
||||
"ssh",
|
||||
"rdp",
|
||||
"vnc",
|
||||
"telnet",
|
||||
];
|
||||
const FILTER_FEATURES: HostSidebarFilterState["features"] = [
|
||||
"terminal",
|
||||
"fileManager",
|
||||
"tunnel",
|
||||
"docker",
|
||||
];
|
||||
/** Same shape as a manifest's auth type, protocol and plugin ids. */
|
||||
const AUTH_TYPE_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
|
||||
|
||||
export function defaultHostSidebarPreferences(): HostSidebarPreferences {
|
||||
return {
|
||||
@@ -130,6 +125,8 @@ export function defaultHostSidebarPreferences(): HostSidebarPreferences {
|
||||
trayTrigger: "always",
|
||||
statusColorScheme: "accent",
|
||||
openOnDoubleClick: false,
|
||||
showFolderPaths: true,
|
||||
hostClickBehavior: "newTab",
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -172,9 +169,15 @@ export function sanitizeHostSidebarPreferences(
|
||||
const filtersObj = (obj.filters ?? {}) as Record<string, unknown>;
|
||||
const filters: HostSidebarFilterState = {
|
||||
status: sanitizeEnumArray(filtersObj.status, FILTER_STATUS),
|
||||
authType: sanitizeEnumArray(filtersObj.authType, FILTER_AUTH_TYPE),
|
||||
protocol: sanitizeEnumArray(filtersObj.protocol, FILTER_PROTOCOL),
|
||||
features: sanitizeEnumArray(filtersObj.features, FILTER_FEATURES),
|
||||
authType: sanitizeStringArray(filtersObj.authType).filter((value) =>
|
||||
AUTH_TYPE_PATTERN.test(value),
|
||||
),
|
||||
protocol: sanitizeStringArray(filtersObj.protocol).filter((value) =>
|
||||
AUTH_TYPE_PATTERN.test(value),
|
||||
),
|
||||
features: sanitizeStringArray(filtersObj.features).filter((value) =>
|
||||
AUTH_TYPE_PATTERN.test(value),
|
||||
),
|
||||
tags: sanitizeStringArray(filtersObj.tags),
|
||||
};
|
||||
|
||||
@@ -203,6 +206,15 @@ export function sanitizeHostSidebarPreferences(
|
||||
typeof displayObj.openOnDoubleClick === "boolean"
|
||||
? displayObj.openOnDoubleClick
|
||||
: defaults.display.openOnDoubleClick,
|
||||
showFolderPaths:
|
||||
typeof displayObj.showFolderPaths === "boolean"
|
||||
? displayObj.showFolderPaths
|
||||
: defaults.display.showFolderPaths,
|
||||
hostClickBehavior: HOST_CLICK_BEHAVIORS.includes(
|
||||
displayObj.hostClickBehavior as HostClickBehavior,
|
||||
)
|
||||
? (displayObj.hostClickBehavior as HostClickBehavior)
|
||||
: defaults.display.hostClickBehavior,
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
+68
-922
File diff suppressed because it is too large.
Load diff
@@ -7,22 +7,16 @@ export interface KeyCombo {
|
||||
meta: boolean;
|
||||
}
|
||||
|
||||
export type KeybindingActionType =
|
||||
| "copy"
|
||||
| "paste"
|
||||
| "sendControlCode"
|
||||
| "sendText"
|
||||
| "runSnippet"
|
||||
| "nextTab"
|
||||
| "previousTab"
|
||||
| "openCommandPalette";
|
||||
/**
|
||||
* The shell's own actions (nextTab, previousTab, openCommandPalette,
|
||||
* reconnectSession) or one a plugin declared in contributes.keybindingActions.
|
||||
*/
|
||||
export type KeybindingActionType = string;
|
||||
|
||||
/** A bound action: its type plus the parameters its declaration lists. */
|
||||
export interface KeybindingAction {
|
||||
type: KeybindingActionType;
|
||||
text?: string;
|
||||
controlCode?: string;
|
||||
snippetId?: string;
|
||||
appendEnter?: boolean;
|
||||
[param: string]: unknown;
|
||||
}
|
||||
|
||||
export interface CustomKeybinding {
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
export interface ProxmoxGuest {
|
||||
name: string;
|
||||
vmid: number;
|
||||
type: "qemu" | "lxc";
|
||||
node: string;
|
||||
status: string;
|
||||
ip: string | null;
|
||||
connectionType: "ssh" | "rdp";
|
||||
enableDocker: boolean;
|
||||
}
|
||||
|
||||
export interface ProxmoxDiscoverResult {
|
||||
guests: ProxmoxGuest[];
|
||||
credentialId: number | null;
|
||||
defaultCredentialId: number | null;
|
||||
jumpHosts?: unknown[] | null;
|
||||
}
|
||||
|
||||
export interface ProxmoxSyncResult {
|
||||
created: number;
|
||||
updated: number;
|
||||
markedMissing: number;
|
||||
skipped: number;
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
// Frontend-side mirror of the backend Proxmox Stats collectors' return shapes
|
||||
// (src/backend/hosts/metrics/proxmox/*). Kept in sync by hand, same convention
|
||||
// as ServerMetrics in main-axios.ts mirroring collectMetrics.
|
||||
|
||||
export interface ProxmoxNodeStats {
|
||||
cpu: {
|
||||
percent: number | null;
|
||||
cores: number | null;
|
||||
load: [number, number, number] | null;
|
||||
};
|
||||
memory: {
|
||||
percent: number | null;
|
||||
usedGiB: number | null;
|
||||
totalGiB: number | null;
|
||||
};
|
||||
disk: {
|
||||
percent: number | null;
|
||||
usedGiB: number | null;
|
||||
totalGiB: number | null;
|
||||
};
|
||||
uptime: {
|
||||
seconds: number | null;
|
||||
formatted: string | null;
|
||||
};
|
||||
system: {
|
||||
hostname: string | null;
|
||||
kernel: string | null;
|
||||
pveVersion: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ProxmoxNodeNetwork {
|
||||
interfaces: Array<{
|
||||
name: string;
|
||||
ip: string | null;
|
||||
state: string | null;
|
||||
rxBytes: string | null;
|
||||
txBytes: string | null;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ProxmoxGuestSummary {
|
||||
vmid: number;
|
||||
name: string;
|
||||
type: "qemu" | "lxc";
|
||||
status: string;
|
||||
cpuPercent: number | null;
|
||||
memPercent: number | null;
|
||||
memUsedGiB: number | null;
|
||||
memTotalGiB: number | null;
|
||||
diskPercent: number | null;
|
||||
diskUsedGiB: number | null;
|
||||
diskTotalGiB: number | null;
|
||||
uptimeSeconds: number | null;
|
||||
}
|
||||
|
||||
export interface ProxmoxGuestsSummary {
|
||||
guests: ProxmoxGuestSummary[];
|
||||
counts: { running: number; stopped: number; total: number };
|
||||
}
|
||||
|
||||
export interface ProxmoxStoragePool {
|
||||
name: string;
|
||||
type: string;
|
||||
active: boolean;
|
||||
enabled: boolean;
|
||||
usedGiB: number | null;
|
||||
totalGiB: number | null;
|
||||
availGiB: number | null;
|
||||
percent: number | null;
|
||||
}
|
||||
|
||||
export interface ProxmoxStorage {
|
||||
pools: ProxmoxStoragePool[];
|
||||
}
|
||||
|
||||
export type ProxmoxClusterHealth =
|
||||
| { clustered: false }
|
||||
| {
|
||||
clustered: true;
|
||||
quorate: boolean;
|
||||
clusterName: string | null;
|
||||
nodes: Array<{
|
||||
name: string;
|
||||
online: boolean;
|
||||
local: boolean;
|
||||
ip: string | null;
|
||||
}>;
|
||||
};
|
||||
|
||||
export interface ProxmoxStatsSnapshot {
|
||||
node: ProxmoxNodeStats;
|
||||
network: ProxmoxNodeNetwork;
|
||||
guests: ProxmoxGuestsSummary;
|
||||
storage: ProxmoxStorage;
|
||||
cluster: ProxmoxClusterHealth;
|
||||
lastChecked: string;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
export type WidgetType =
|
||||
| "cpu"
|
||||
| "memory"
|
||||
| "disk"
|
||||
| "network"
|
||||
| "uptime"
|
||||
| "processes"
|
||||
| "system"
|
||||
| "login_stats"
|
||||
| "ports"
|
||||
| "firewall"
|
||||
| "temperature"
|
||||
| "gpu";
|
||||
|
||||
export interface ListeningPort {
|
||||
protocol: "tcp" | "udp";
|
||||
localAddress: string;
|
||||
localPort: number;
|
||||
state?: string;
|
||||
pid?: number;
|
||||
process?: string;
|
||||
}
|
||||
|
||||
export interface PortsMetrics {
|
||||
source: "ss" | "netstat" | "none";
|
||||
ports: ListeningPort[];
|
||||
}
|
||||
|
||||
export interface FirewallRule {
|
||||
chain: string;
|
||||
target: string;
|
||||
protocol: string;
|
||||
source: string;
|
||||
destination: string;
|
||||
dport?: string;
|
||||
sport?: string;
|
||||
state?: string;
|
||||
interface?: string;
|
||||
extra?: string;
|
||||
}
|
||||
|
||||
export interface FirewallChain {
|
||||
name: string;
|
||||
policy: string;
|
||||
rules: FirewallRule[];
|
||||
}
|
||||
|
||||
export interface FirewallMetrics {
|
||||
type: "iptables" | "nftables" | "none";
|
||||
status: "active" | "inactive" | "unknown";
|
||||
chains: FirewallChain[];
|
||||
}
|
||||
|
||||
export interface TemperatureSensor {
|
||||
label: string;
|
||||
celsius: number;
|
||||
}
|
||||
|
||||
export interface TemperatureMetrics {
|
||||
source: "sysfs" | "sensors" | "none";
|
||||
highestCelsius: number | null;
|
||||
sensors: TemperatureSensor[];
|
||||
}
|
||||
|
||||
export interface GpuDevice {
|
||||
index: number;
|
||||
uuid: string;
|
||||
name: string;
|
||||
driverVersion: string | null;
|
||||
utilizationPercent: number | null;
|
||||
memoryUsedMiB: number | null;
|
||||
memoryTotalMiB: number | null;
|
||||
memoryPercent: number | null;
|
||||
temperatureCelsius: number | null;
|
||||
powerDrawWatts: number | null;
|
||||
powerLimitWatts: number | null;
|
||||
fanPercent: number | null;
|
||||
}
|
||||
|
||||
export interface GpuProcess {
|
||||
gpuIndex: number | null;
|
||||
pid: number;
|
||||
name: string;
|
||||
memoryUsedMiB: number | null;
|
||||
}
|
||||
|
||||
export interface GpuMetrics {
|
||||
source: "nvidia-smi" | "none";
|
||||
gpus: GpuDevice[];
|
||||
processes: GpuProcess[];
|
||||
}
|
||||
|
||||
export interface StatsConfig {
|
||||
enabledWidgets: WidgetType[];
|
||||
statusCheckEnabled: boolean;
|
||||
statusCheckInterval: number;
|
||||
useGlobalStatusInterval?: boolean;
|
||||
metricsEnabled: boolean;
|
||||
metricsInterval: number;
|
||||
useGlobalMetricsInterval?: boolean;
|
||||
disableTcpPing?: boolean;
|
||||
/** Filesystem mount points to leave out of the disk widget. */
|
||||
excludedMounts?: string[];
|
||||
/** Extra paths to monitor, including paths inside bind-mounted containers. */
|
||||
monitoredMounts?: Array<{ path: string; label?: string }>;
|
||||
}
|
||||
|
||||
export const DEFAULT_STATS_CONFIG: StatsConfig = {
|
||||
enabledWidgets: [
|
||||
"cpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"network",
|
||||
"uptime",
|
||||
"system",
|
||||
"login_stats",
|
||||
"processes",
|
||||
"ports",
|
||||
"firewall",
|
||||
"temperature",
|
||||
],
|
||||
statusCheckEnabled: true,
|
||||
statusCheckInterval: 30,
|
||||
useGlobalStatusInterval: true,
|
||||
metricsEnabled: true,
|
||||
metricsInterval: 30,
|
||||
useGlobalMetricsInterval: true,
|
||||
disableTcpPing: false,
|
||||
};
|
||||
@@ -1,127 +0,0 @@
|
||||
export const TOUCH_INPUT_SETTING_KEY = "touch_input_settings";
|
||||
|
||||
export interface TouchInputSettings {
|
||||
enabled: boolean;
|
||||
momentumEnabled: boolean;
|
||||
dragThresholdPx: number;
|
||||
maxWheelDeltaPx: number;
|
||||
momentumSampleWindowMs: number;
|
||||
releaseGracePeriodMs: number;
|
||||
minimumVelocityPxPerMs: number;
|
||||
maximumVelocityPxPerMs: number;
|
||||
maximumDurationMs: number;
|
||||
maximumTravelPx: number;
|
||||
decayTimeMs: number;
|
||||
pixelsPerTick: number;
|
||||
maximumFrameIntervalMs: number;
|
||||
maximumTicksPerFrame: number;
|
||||
}
|
||||
|
||||
export const TOUCH_INPUT_DEFAULTS: TouchInputSettings = {
|
||||
enabled: true,
|
||||
momentumEnabled: true,
|
||||
dragThresholdPx: 6,
|
||||
maxWheelDeltaPx: 120,
|
||||
momentumSampleWindowMs: 100,
|
||||
releaseGracePeriodMs: 120,
|
||||
minimumVelocityPxPerMs: 0.15,
|
||||
maximumVelocityPxPerMs: 2.5,
|
||||
maximumDurationMs: 1_000,
|
||||
maximumTravelPx: 720,
|
||||
decayTimeMs: 300,
|
||||
pixelsPerTick: 12,
|
||||
maximumFrameIntervalMs: 32,
|
||||
maximumTicksPerFrame: 4,
|
||||
};
|
||||
|
||||
export type TouchInputNumericKey = Exclude<
|
||||
keyof TouchInputSettings,
|
||||
"enabled" | "momentumEnabled"
|
||||
>;
|
||||
|
||||
export const TOUCH_INPUT_NUMERIC_BOUNDS: Record<
|
||||
TouchInputNumericKey,
|
||||
{ min: number; max: number; step: number }
|
||||
> = {
|
||||
dragThresholdPx: { min: 0, max: 100, step: 1 },
|
||||
maxWheelDeltaPx: { min: 1, max: 1_000, step: 1 },
|
||||
momentumSampleWindowMs: { min: 10, max: 1_000, step: 10 },
|
||||
releaseGracePeriodMs: { min: 0, max: 2_000, step: 10 },
|
||||
minimumVelocityPxPerMs: { min: 0, max: 10, step: 0.01 },
|
||||
maximumVelocityPxPerMs: { min: 0.01, max: 20, step: 0.01 },
|
||||
maximumDurationMs: { min: 0, max: 10_000, step: 100 },
|
||||
maximumTravelPx: { min: 0, max: 10_000, step: 10 },
|
||||
decayTimeMs: { min: 1, max: 5_000, step: 10 },
|
||||
pixelsPerTick: { min: 1, max: 500, step: 1 },
|
||||
maximumFrameIntervalMs: { min: 1, max: 1_000, step: 1 },
|
||||
maximumTicksPerFrame: { min: 1, max: 100, step: 1 },
|
||||
};
|
||||
|
||||
export function normalizeTouchInputSettings(
|
||||
value: unknown,
|
||||
): TouchInputSettings {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
||||
return { ...TOUCH_INPUT_DEFAULTS };
|
||||
}
|
||||
|
||||
const input = value as Record<string, unknown>;
|
||||
const normalized: TouchInputSettings = { ...TOUCH_INPUT_DEFAULTS };
|
||||
for (const key of ["enabled", "momentumEnabled"] as const) {
|
||||
if (typeof input[key] === "boolean") normalized[key] = input[key];
|
||||
}
|
||||
for (const [key, bounds] of Object.entries(TOUCH_INPUT_NUMERIC_BOUNDS) as [
|
||||
TouchInputNumericKey,
|
||||
{ min: number; max: number },
|
||||
][]) {
|
||||
const candidate = input[key];
|
||||
if (
|
||||
typeof candidate === "number" &&
|
||||
Number.isFinite(candidate) &&
|
||||
candidate >= bounds.min &&
|
||||
candidate <= bounds.max
|
||||
) {
|
||||
normalized[key] = candidate;
|
||||
}
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function validateTouchInputSettingsUpdate(
|
||||
value: unknown,
|
||||
): string | null {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
||||
return "settings must be an object";
|
||||
}
|
||||
const input = value as Record<string, unknown>;
|
||||
const validKeys = new Set(Object.keys(TOUCH_INPUT_DEFAULTS));
|
||||
const unknownKey = Object.keys(input).find((key) => !validKeys.has(key));
|
||||
if (unknownKey) return `Unknown touch input setting: ${unknownKey}`;
|
||||
for (const key of ["enabled", "momentumEnabled"] as const) {
|
||||
if (key in input && typeof input[key] !== "boolean") {
|
||||
return `${key} must be a boolean`;
|
||||
}
|
||||
}
|
||||
for (const [key, bounds] of Object.entries(TOUCH_INPUT_NUMERIC_BOUNDS) as [
|
||||
TouchInputNumericKey,
|
||||
{ min: number; max: number },
|
||||
][]) {
|
||||
if (!(key in input)) continue;
|
||||
const candidate = input[key];
|
||||
if (
|
||||
typeof candidate !== "number" ||
|
||||
!Number.isFinite(candidate) ||
|
||||
candidate < bounds.min ||
|
||||
candidate > bounds.max
|
||||
) {
|
||||
return `${key} must be a number between ${bounds.min} and ${bounds.max}`;
|
||||
}
|
||||
}
|
||||
if (
|
||||
typeof input.minimumVelocityPxPerMs === "number" &&
|
||||
typeof input.maximumVelocityPxPerMs === "number" &&
|
||||
input.minimumVelocityPxPerMs > input.maximumVelocityPxPerMs
|
||||
) {
|
||||
return "minimumVelocityPxPerMs must not exceed maximumVelocityPxPerMs";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
+117
-141
@@ -16,7 +16,8 @@
|
||||
* users who land on it see no change at all.
|
||||
*/
|
||||
|
||||
export const UI_PREFERENCES_VERSION = 1;
|
||||
/** 2: the docker and host metrics areas moved to their plugins. */
|
||||
export const UI_PREFERENCES_VERSION = 3;
|
||||
|
||||
/** Bump when onboarding gains steps existing users should be shown again. */
|
||||
export const UI_ONBOARDING_VERSION = 2;
|
||||
@@ -29,20 +30,12 @@ export type UiAreaKey =
|
||||
| "credentialList"
|
||||
| "rail"
|
||||
| "dashboard"
|
||||
| "terminal"
|
||||
| "fileManager"
|
||||
| "docker"
|
||||
| "hostMetrics"
|
||||
| "hostEditor"
|
||||
| "homepage";
|
||||
| "hostEditor";
|
||||
|
||||
export type UiDensity = "comfortable" | "compact";
|
||||
export type UiTrayTrigger = "always" | "hover" | "click" | "actionsOnly";
|
||||
export type UiRowActions = "essential" | "full";
|
||||
export type UiEmptyStateVerbosity = "minimal" | "guided";
|
||||
export type UiToolbarDensity = "icon" | "labeled" | "expanded";
|
||||
export type UiFileViewMode = "grid" | "list";
|
||||
export type UiDockerViewMode = "list" | "detail";
|
||||
export type UiHostEditorMode = "simple" | "full";
|
||||
|
||||
export interface UiChromePreferences {
|
||||
@@ -67,56 +60,36 @@ export interface UiCredentialListPreferences {
|
||||
|
||||
export interface UiRailPreferences {
|
||||
hiddenTabs: string[];
|
||||
/**
|
||||
* Also hide every plugin rail item that does not set simplePreset. Plugin
|
||||
* items are only known at runtime, so the preset cannot list them.
|
||||
*/
|
||||
hidePluginItems?: boolean;
|
||||
}
|
||||
|
||||
export interface UiDashboardPreferences {
|
||||
enabledCards: string[];
|
||||
}
|
||||
|
||||
export interface UiTerminalPreferences {
|
||||
toolbarDensity: UiToolbarDensity;
|
||||
}
|
||||
|
||||
export interface UiFileManagerPreferences {
|
||||
viewMode: UiFileViewMode;
|
||||
showHiddenFiles: boolean;
|
||||
}
|
||||
|
||||
export interface UiDockerPreferences {
|
||||
viewMode: UiDockerViewMode;
|
||||
}
|
||||
|
||||
export interface UiHostMetricsPreferences {
|
||||
enabledCards: string[];
|
||||
columns: number;
|
||||
}
|
||||
|
||||
export interface UiHostEditorPreferences {
|
||||
mode: UiHostEditorMode;
|
||||
}
|
||||
|
||||
export interface UiHomepagePreferences {
|
||||
/** null means "never preset-driven" -- a preset must not touch the canvas. */
|
||||
enabledWidgets: string[] | null;
|
||||
}
|
||||
|
||||
export interface UiAreaPreferences {
|
||||
chrome: UiChromePreferences;
|
||||
hostList: UiHostListPreferences;
|
||||
credentialList: UiCredentialListPreferences;
|
||||
rail: UiRailPreferences;
|
||||
dashboard: UiDashboardPreferences;
|
||||
terminal: UiTerminalPreferences;
|
||||
fileManager: UiFileManagerPreferences;
|
||||
docker: UiDockerPreferences;
|
||||
hostMetrics: UiHostMetricsPreferences;
|
||||
hostEditor: UiHostEditorPreferences;
|
||||
homepage: UiHomepagePreferences;
|
||||
}
|
||||
|
||||
/** A plugin's own area, keyed "plugin:<id>", holding what it declared in contributes.uiPresets. */
|
||||
export type UiPluginAreaKey = `plugin:${string}`;
|
||||
|
||||
export type UiOverrides = {
|
||||
[A in UiAreaKey]?: Partial<UiAreaPreferences[A]>;
|
||||
};
|
||||
} & { [key: UiPluginAreaKey]: Record<string, unknown> };
|
||||
|
||||
export interface UiOnboardingState {
|
||||
/** 0 means "never completed". Compared against UI_ONBOARDING_VERSION. */
|
||||
@@ -135,35 +108,21 @@ export interface UiPreferences {
|
||||
const PRESET_VALUES: UiPreset[] = ["simple", "balanced", "advanced", "custom"];
|
||||
|
||||
/**
|
||||
* Rail views Simple keeps. Cutting all the way down to hosts+credentials makes
|
||||
* the app feel broken, so connections and snippets stay: snippets is the most
|
||||
* approachable power feature and connections is where troubleshooting starts.
|
||||
* Core rail views Simple keeps. Cutting all the way down to hosts+credentials
|
||||
* makes the app feel broken, so connections stays: it is where
|
||||
* troubleshooting starts. Plugin items opt in with simplePreset.
|
||||
*/
|
||||
const SIMPLE_RAIL_VISIBLE = ["hosts", "credentials", "connections", "snippets"];
|
||||
const SIMPLE_RAIL_VISIBLE = ["hosts", "credentials", "connections"];
|
||||
|
||||
/** Every hideable rail view, mirroring HideableRailView in sidebar/AppRail.tsx. */
|
||||
const ALL_HIDEABLE_RAIL_VIEWS = [
|
||||
/** Core's hideable rail views, mirroring RAIL_ITEMS in sidebar/rail-items.ts. */
|
||||
const CORE_HIDEABLE_RAIL_VIEWS = [
|
||||
"hosts",
|
||||
"credentials",
|
||||
"termix-id",
|
||||
"quick-connect",
|
||||
"serial",
|
||||
"ssh-tools",
|
||||
"snippets",
|
||||
"macros",
|
||||
"history",
|
||||
"split-screen",
|
||||
"connections",
|
||||
"session-logs",
|
||||
"alerts",
|
||||
"fleets",
|
||||
"workspaces",
|
||||
"network_graph",
|
||||
"homepage",
|
||||
"ai",
|
||||
"quick-connect",
|
||||
];
|
||||
|
||||
const SIMPLE_HIDDEN_RAIL_TABS = ALL_HIDEABLE_RAIL_VIEWS.filter(
|
||||
const SIMPLE_HIDDEN_RAIL_TABS = CORE_HIDEABLE_RAIL_VIEWS.filter(
|
||||
(view) => !SIMPLE_RAIL_VISIBLE.includes(view),
|
||||
);
|
||||
|
||||
@@ -175,29 +134,8 @@ const BALANCED_DASHBOARD_CARDS = [
|
||||
"host_status",
|
||||
"recent_activity",
|
||||
];
|
||||
// Advanced adds service links but leaves network_graph and homepage_preview
|
||||
// off: both are wide, and enabling them by default pushes the dashboard past
|
||||
// the edge of the screen. They stay available in the Add card tray.
|
||||
const ADVANCED_DASHBOARD_CARDS = [...BALANCED_DASHBOARD_CARDS, "service_links"];
|
||||
|
||||
/** Host metrics card ids, mirroring CARD_DEFINITIONS in features/host-metrics/cards. */
|
||||
const SIMPLE_HOST_METRICS_CARDS = ["cpu", "memory", "disk"];
|
||||
const BALANCED_HOST_METRICS_CARDS = [
|
||||
"cpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"network",
|
||||
"uptime",
|
||||
"system",
|
||||
];
|
||||
const ADVANCED_HOST_METRICS_CARDS = [
|
||||
...BALANCED_HOST_METRICS_CARDS,
|
||||
"login_stats",
|
||||
"ports",
|
||||
"processes",
|
||||
"firewall",
|
||||
"temperature",
|
||||
];
|
||||
// Only core's own cards: a plugin's cards are added from the Add card tray.
|
||||
const ADVANCED_DASHBOARD_CARDS = [...BALANCED_DASHBOARD_CARDS];
|
||||
|
||||
export const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences> = {
|
||||
simple: {
|
||||
@@ -217,7 +155,7 @@ export const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences> = {
|
||||
rowActions: "essential",
|
||||
},
|
||||
credentialList: { density: "comfortable", showTags: false },
|
||||
rail: { hiddenTabs: SIMPLE_HIDDEN_RAIL_TABS },
|
||||
rail: { hiddenTabs: SIMPLE_HIDDEN_RAIL_TABS, hidePluginItems: true },
|
||||
dashboard: {
|
||||
enabledCards: [
|
||||
"stats_bar",
|
||||
@@ -226,12 +164,7 @@ export const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences> = {
|
||||
"host_status",
|
||||
],
|
||||
},
|
||||
terminal: { toolbarDensity: "icon" },
|
||||
fileManager: { viewMode: "grid", showHiddenFiles: false },
|
||||
docker: { viewMode: "list" },
|
||||
hostMetrics: { enabledCards: SIMPLE_HOST_METRICS_CARDS, columns: 1 },
|
||||
hostEditor: { mode: "simple" },
|
||||
homepage: { enabledWidgets: null },
|
||||
},
|
||||
balanced: {
|
||||
chrome: {
|
||||
@@ -250,14 +183,8 @@ export const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences> = {
|
||||
credentialList: { density: "comfortable", showTags: true },
|
||||
rail: { hiddenTabs: [] },
|
||||
dashboard: { enabledCards: BALANCED_DASHBOARD_CARDS },
|
||||
terminal: { toolbarDensity: "labeled" },
|
||||
// FileManager.tsx has always defaulted to grid when nothing is stored.
|
||||
fileManager: { viewMode: "grid", showHiddenFiles: false },
|
||||
docker: { viewMode: "list" },
|
||||
// 3 is defaultLayoutFromWidgets's own default, i.e. today's behavior.
|
||||
hostMetrics: { enabledCards: BALANCED_HOST_METRICS_CARDS, columns: 3 },
|
||||
hostEditor: { mode: "full" },
|
||||
homepage: { enabledWidgets: null },
|
||||
},
|
||||
advanced: {
|
||||
chrome: {
|
||||
@@ -276,13 +203,7 @@ export const PRESETS: Record<Exclude<UiPreset, "custom">, UiAreaPreferences> = {
|
||||
credentialList: { density: "compact", showTags: true },
|
||||
rail: { hiddenTabs: [] },
|
||||
dashboard: { enabledCards: ADVANCED_DASHBOARD_CARDS },
|
||||
terminal: { toolbarDensity: "expanded" },
|
||||
// List packs more files and metadata per screen than the grid.
|
||||
fileManager: { viewMode: "list", showHiddenFiles: true },
|
||||
docker: { viewMode: "detail" },
|
||||
hostMetrics: { enabledCards: ADVANCED_HOST_METRICS_CARDS, columns: 4 },
|
||||
hostEditor: { mode: "full" },
|
||||
homepage: { enabledWidgets: null },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -290,8 +211,7 @@ type FieldSpec =
|
||||
| { kind: "enum"; values: readonly string[] }
|
||||
| { kind: "bool" }
|
||||
| { kind: "int"; min: number; max: number }
|
||||
| { kind: "stringArray" }
|
||||
| { kind: "nullableStringArray" };
|
||||
| { kind: "stringArray" };
|
||||
|
||||
/**
|
||||
* Field descriptors for every area knob. Unlike the flat sanitizers on the
|
||||
@@ -323,33 +243,14 @@ const AREA_SPECS: {
|
||||
},
|
||||
rail: {
|
||||
hiddenTabs: { kind: "stringArray" },
|
||||
hidePluginItems: { kind: "bool" },
|
||||
},
|
||||
dashboard: {
|
||||
enabledCards: { kind: "stringArray" },
|
||||
},
|
||||
terminal: {
|
||||
toolbarDensity: {
|
||||
kind: "enum",
|
||||
values: ["icon", "labeled", "expanded"],
|
||||
},
|
||||
},
|
||||
fileManager: {
|
||||
viewMode: { kind: "enum", values: ["grid", "list"] },
|
||||
showHiddenFiles: { kind: "bool" },
|
||||
},
|
||||
docker: {
|
||||
viewMode: { kind: "enum", values: ["list", "detail"] },
|
||||
},
|
||||
hostMetrics: {
|
||||
enabledCards: { kind: "stringArray" },
|
||||
columns: { kind: "int", min: 1, max: 4 },
|
||||
},
|
||||
hostEditor: {
|
||||
mode: { kind: "enum", values: ["simple", "full"] },
|
||||
},
|
||||
homepage: {
|
||||
enabledWidgets: { kind: "nullableStringArray" },
|
||||
},
|
||||
};
|
||||
|
||||
export const UI_AREA_KEYS = Object.keys(AREA_SPECS) as UiAreaKey[];
|
||||
@@ -374,11 +275,6 @@ function coerce(spec: FieldSpec, value: unknown): unknown | undefined {
|
||||
return Array.isArray(value)
|
||||
? value.filter((v): v is string => typeof v === "string")
|
||||
: undefined;
|
||||
case "nullableStringArray":
|
||||
if (value === null) return null;
|
||||
return Array.isArray(value)
|
||||
? value.filter((v): v is string => typeof v === "string")
|
||||
: undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,10 +284,71 @@ function coerce(spec: FieldSpec, value: unknown): unknown | undefined {
|
||||
* Object.keys(overrides).length > 0 an honest "has customizations" check for
|
||||
* the settings UI rather than something that accumulates {hostList:{}} noise.
|
||||
*/
|
||||
export function sanitizeUiOverrides(input: unknown): UiOverrides {
|
||||
const PLUGIN_AREA_PATTERN = /^plugin:[a-z][a-z0-9-]{0,63}$/;
|
||||
const PLUGIN_AREA_MAX_KEYS = 32;
|
||||
|
||||
/**
|
||||
* A plugin area's values are only checked for shape: core does not know the
|
||||
* plugin's fields, and the plugin reads them against its own presets.
|
||||
*/
|
||||
function sanitizePluginArea(input: unknown): Record<string, unknown> {
|
||||
const out: Record<string, unknown> = {};
|
||||
if (!input || typeof input !== "object") return out;
|
||||
for (const [key, value] of Object.entries(input as Record<string, unknown>)) {
|
||||
if (Object.keys(out).length >= PLUGIN_AREA_MAX_KEYS) break;
|
||||
if (!/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/.test(key)) continue;
|
||||
if (
|
||||
typeof value === "boolean" ||
|
||||
(typeof value === "number" && Number.isFinite(value)) ||
|
||||
(typeof value === "string" && value.length <= 200)
|
||||
) {
|
||||
out[key] = value;
|
||||
} else if (
|
||||
Array.isArray(value) &&
|
||||
value.length <= 100 &&
|
||||
value.every((item) => typeof item === "string" && item.length <= 200)
|
||||
) {
|
||||
out[key] = [...value];
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Areas that moved into a plugin: before `version` they were stored under
|
||||
* core's name. Version 1 had docker and host metrics, version 2 the terminal
|
||||
* and the file manager.
|
||||
*/
|
||||
const MOVED_PLUGIN_AREAS: Array<{
|
||||
before: number;
|
||||
legacy: string;
|
||||
area: UiPluginAreaKey;
|
||||
}> = [
|
||||
{ before: 2, legacy: "docker", area: "plugin:docker" }, // plugin-id-ok: 2.8 key
|
||||
{ before: 2, legacy: "hostMetrics", area: "plugin:host-metrics" },
|
||||
{ before: 3, legacy: "terminal", area: "plugin:ssh-terminal" },
|
||||
{ before: 3, legacy: "fileManager", area: "plugin:file-manager" },
|
||||
];
|
||||
|
||||
export function sanitizeUiOverrides(
|
||||
input: unknown,
|
||||
version = UI_PREFERENCES_VERSION,
|
||||
): UiOverrides {
|
||||
const out: Record<string, Record<string, unknown>> = {};
|
||||
if (!input || typeof input !== "object") return out as UiOverrides;
|
||||
|
||||
const moves = MOVED_PLUGIN_AREAS.filter((move) => version < move.before);
|
||||
if (moves.length > 0) {
|
||||
const upgraded = { ...(input as Record<string, unknown>) };
|
||||
for (const { legacy, area } of moves) {
|
||||
if (legacy in upgraded) {
|
||||
upgraded[area] = upgraded[legacy];
|
||||
delete upgraded[legacy];
|
||||
}
|
||||
}
|
||||
input = upgraded;
|
||||
}
|
||||
|
||||
const specsByArea = AREA_SPECS as unknown as Record<
|
||||
string,
|
||||
Record<string, FieldSpec>
|
||||
@@ -400,6 +357,11 @@ export function sanitizeUiOverrides(input: unknown): UiOverrides {
|
||||
for (const [area, areaValue] of Object.entries(
|
||||
input as Record<string, unknown>,
|
||||
)) {
|
||||
if (PLUGIN_AREA_PATTERN.test(area)) {
|
||||
const bucket = sanitizePluginArea(areaValue);
|
||||
if (Object.keys(bucket).length > 0) out[area] = bucket;
|
||||
continue;
|
||||
}
|
||||
const specs = specsByArea[area];
|
||||
if (!specs || !areaValue || typeof areaValue !== "object") continue;
|
||||
|
||||
@@ -462,7 +424,10 @@ export function sanitizeUiPreferences(input: unknown): UiPreferences {
|
||||
preset: PRESET_VALUES.includes(obj.preset as UiPreset)
|
||||
? (obj.preset as UiPreset)
|
||||
: defaults.preset,
|
||||
overrides: sanitizeUiOverrides(obj.overrides),
|
||||
overrides: sanitizeUiOverrides(
|
||||
obj.overrides,
|
||||
typeof obj.version === "number" ? obj.version : 1,
|
||||
),
|
||||
onboarding: sanitizeOnboarding(obj.onboarding),
|
||||
};
|
||||
}
|
||||
@@ -484,16 +449,27 @@ export function resolveArea<A extends UiAreaKey>(
|
||||
return override ? { ...base, ...override } : base;
|
||||
}
|
||||
|
||||
/** The presets a plugin declares in contributes.uiPresets. */
|
||||
export type UiPluginPresets = Record<
|
||||
Exclude<UiPreset, "custom">,
|
||||
Record<string, unknown>
|
||||
>;
|
||||
|
||||
/** A plugin area's values: its preset for the user's level, then overrides. */
|
||||
export function resolvePluginArea(
|
||||
preferences: UiPreferences,
|
||||
pluginId: string,
|
||||
presets: UiPluginPresets | undefined,
|
||||
): Record<string, unknown> {
|
||||
const level =
|
||||
preferences.preset === "custom" ? "balanced" : preferences.preset;
|
||||
const base = presets?.[level] ?? {};
|
||||
const override = (
|
||||
preferences.overrides as Record<string, Record<string, unknown>>
|
||||
)[`plugin:${pluginId}`];
|
||||
return override ? { ...base, ...override } : { ...base };
|
||||
}
|
||||
|
||||
export function hasUiOverrides(preferences: UiPreferences): boolean {
|
||||
return Object.keys(preferences.overrides).length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* What the settings UI should show as the active preset. "custom" is derived
|
||||
* rather than stored, so clearing every override automatically restores the
|
||||
* user's chosen preset instead of stranding them on a label.
|
||||
*/
|
||||
export function effectivePresetLabel(preferences: UiPreferences): UiPreset {
|
||||
if (preferences.preset === "custom") return "custom";
|
||||
return hasUiOverrides(preferences) ? "custom" : preferences.preset;
|
||||
}
|
||||
+96
-276
@@ -1,7 +1,12 @@
|
||||
import type { GuacamoleConfig } from "./guacamole-config.js";
|
||||
import type { TerminalConfig, WebUiConfig } from "./index.js";
|
||||
import type { StatsConfig } from "./stats-widgets.js";
|
||||
import type {
|
||||
HostProtocolAuthSummary,
|
||||
HostSshOptions,
|
||||
HostTerminalConfig,
|
||||
SSHAuthType,
|
||||
} from "./index.js";
|
||||
import type { HostAuthOverrides } from "./auth-protocols.js";
|
||||
import type { DefaultOverrides } from "./host-defaults.js";
|
||||
import type { QuickConnectLogin } from "@termix/plugin-sdk/frontend";
|
||||
|
||||
export type Host = {
|
||||
id: string;
|
||||
@@ -25,20 +30,9 @@ export type Host = {
|
||||
ram: number | null;
|
||||
lastAccess: string;
|
||||
tags?: string[];
|
||||
authType:
|
||||
| "password"
|
||||
| "key"
|
||||
| "credential"
|
||||
| "none"
|
||||
| "opkssh"
|
||||
| "stepca"
|
||||
| "tailscale"
|
||||
| "vault"
|
||||
| "agent";
|
||||
useWarpgate?: boolean;
|
||||
authType: SSHAuthType;
|
||||
shareSshAuth?: boolean;
|
||||
credentialId?: string;
|
||||
vaultProfileId?: string;
|
||||
overrideCredentialUsername?: boolean;
|
||||
password?: string;
|
||||
hasPassword?: boolean;
|
||||
@@ -50,18 +44,17 @@ export type Host = {
|
||||
keyPassword?: string;
|
||||
keyType?: string;
|
||||
notes?: string;
|
||||
macAddress?: string;
|
||||
wolBroadcastAddress?: string;
|
||||
pin?: boolean;
|
||||
/** Quick connect only: core can save this host as-is. */
|
||||
quickConnectSavable?: boolean;
|
||||
/** A Quick Connect host's plugin protocol login, never saved. */
|
||||
quickConnectLogin?: QuickConnectLogin;
|
||||
sortOrder?: number | null;
|
||||
|
||||
enableTerminal: boolean;
|
||||
enableCommandHistory: boolean;
|
||||
enableSessionLogging?: boolean;
|
||||
allowSessionSharing?: boolean;
|
||||
/** Stable identity across a desktop/server sync pair. */
|
||||
syncId?: string | null;
|
||||
terminalConfig?: Partial<TerminalConfig>;
|
||||
terminalConfig?: HostTerminalConfig;
|
||||
sshOptions?: HostSshOptions;
|
||||
|
||||
useSocks5?: boolean;
|
||||
socks5Host?: string;
|
||||
@@ -84,107 +77,21 @@ export type Host = {
|
||||
delay: number;
|
||||
}[];
|
||||
|
||||
enableTunnel: boolean;
|
||||
serverTunnels: {
|
||||
mode: "local" | "remote" | "dynamic";
|
||||
localAddress?: string;
|
||||
remoteAddress?: string;
|
||||
bindHost?: string;
|
||||
targetHost?: string;
|
||||
sourcePort: number;
|
||||
endpointHost: string;
|
||||
endpointPort: number;
|
||||
maxRetries: number;
|
||||
retryInterval: number;
|
||||
autoStart: boolean;
|
||||
}[];
|
||||
|
||||
enableFileManager: boolean;
|
||||
scpLegacy?: boolean;
|
||||
defaultPath?: string;
|
||||
|
||||
enableDocker: boolean;
|
||||
dockerConfig?: {
|
||||
runtime?: "docker" | "podman";
|
||||
} | null;
|
||||
enableWebUi?: boolean;
|
||||
webUiConfig?: WebUiConfig | null;
|
||||
enableProxmox: boolean;
|
||||
enableTmuxMonitor: boolean;
|
||||
enableTerminalToolbar: boolean;
|
||||
enableAiAssistant: boolean;
|
||||
proxmoxConfig?: {
|
||||
source?: {
|
||||
source: "proxmox";
|
||||
sourceHostId: number;
|
||||
node: string;
|
||||
vmid: number;
|
||||
type: "qemu" | "lxc";
|
||||
lastSeenAt?: string;
|
||||
lastStatus?: string;
|
||||
missingSince?: string | null;
|
||||
};
|
||||
defaultCredentialId: number | null;
|
||||
defaultAuthType?: string;
|
||||
windowsPatterns: string;
|
||||
dockerPatterns: string;
|
||||
preferredPrefixes: string;
|
||||
autoSyncEnabled?: boolean;
|
||||
syncIntervalMinutes?: number;
|
||||
markMissingGuests?: boolean;
|
||||
lastSyncAt?: string;
|
||||
lastSyncStatus?: "success" | "error";
|
||||
lastSyncError?: string | null;
|
||||
lastSyncResult?: {
|
||||
created: number;
|
||||
updated: number;
|
||||
markedMissing: number;
|
||||
skipped: number;
|
||||
errors: string[];
|
||||
};
|
||||
} | null;
|
||||
enableProxmoxStats: boolean;
|
||||
proxmoxStatsConfig?: {
|
||||
nodeName?: string | null;
|
||||
pollInterval?: number;
|
||||
enabledCards?: string[];
|
||||
} | null;
|
||||
|
||||
statsConfig?: StatsConfig;
|
||||
quickActions: { name: string; snippetId: string }[];
|
||||
statusCheckEnabled?: boolean;
|
||||
/** Seconds between status checks; null follows the global setting. */
|
||||
statusCheckInterval?: number | null;
|
||||
|
||||
enableSsh: boolean;
|
||||
enableRdp: boolean;
|
||||
enableVnc: boolean;
|
||||
enableTelnet: boolean;
|
||||
|
||||
sshPort: number;
|
||||
rdpPort: number;
|
||||
vncPort: number;
|
||||
telnetPort: number;
|
||||
|
||||
rdpAuthType?: "direct" | "credential" | "none";
|
||||
rdpCredentialId?: string;
|
||||
rdpUser?: string;
|
||||
rdpPassword?: string;
|
||||
hasRdpPassword?: boolean;
|
||||
domain?: string;
|
||||
security?: string;
|
||||
ignoreCert?: boolean;
|
||||
/** Each plugin protocol's login, secrets left out. */
|
||||
protocolAuth?: Record<string, HostProtocolAuthSummary>;
|
||||
|
||||
vncAuthType?: "direct" | "credential";
|
||||
vncCredentialId?: string;
|
||||
vncPassword?: string;
|
||||
hasVncPassword?: boolean;
|
||||
vncUser?: string;
|
||||
|
||||
telnetAuthType?: "direct" | "credential";
|
||||
telnetCredentialId?: string;
|
||||
telnetUser?: string;
|
||||
telnetPassword?: string;
|
||||
hasTelnetPassword?: boolean;
|
||||
|
||||
guacamoleConfig?: GuacamoleConfig;
|
||||
/** Host-scope plugin settings, keyed by plugin id. Secrets are redacted. */
|
||||
pluginSettings?: Record<string, Record<string, unknown>>;
|
||||
/** Host default keys this host sets itself, per namespace. */
|
||||
defaultOverrides?: DefaultOverrides | null;
|
||||
forceKeyboardInteractive?: boolean;
|
||||
|
||||
isShared?: boolean;
|
||||
@@ -192,6 +99,13 @@ export type Host = {
|
||||
permissionLevel?: SharePermissionLevel;
|
||||
sharedExpiresAt?: string;
|
||||
ownerUsername?: string;
|
||||
/**
|
||||
* A read-only copy of a host shared with the account this desktop is
|
||||
* linked to. It arrives through sync and is managed on the server.
|
||||
*/
|
||||
sharedCopy?: boolean;
|
||||
/** Desktop only: kept on this device, never synced to the server. */
|
||||
localOnly?: boolean;
|
||||
};
|
||||
|
||||
export type SharePermissionLevel = "connect" | "view" | "edit" | "manage";
|
||||
@@ -217,26 +131,6 @@ export type Credential = {
|
||||
permissionLevel?: "use" | "manage";
|
||||
};
|
||||
|
||||
// HashiCorp Vault SSH signer profile — shareable connection settings only
|
||||
// (no secrets). Users authenticate to Vault via OIDC at connect time.
|
||||
export type VaultProfile = {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
folder?: string;
|
||||
tags?: string[];
|
||||
vaultAddr: string;
|
||||
vaultNamespace?: string;
|
||||
oidcMount?: string;
|
||||
oidcRole?: string;
|
||||
sshMount?: string;
|
||||
sshRole: string;
|
||||
validPrincipals?: string;
|
||||
keyType?: string;
|
||||
shared: boolean;
|
||||
owned: boolean;
|
||||
};
|
||||
|
||||
export type HostFolder = {
|
||||
name: string;
|
||||
children: (Host | HostFolder)[];
|
||||
@@ -245,41 +139,15 @@ export type HostFolder = {
|
||||
icon?: string;
|
||||
credentialId?: number | null;
|
||||
sortOrder?: number | null;
|
||||
localOnly?: boolean;
|
||||
};
|
||||
|
||||
export type KnownTabType =
|
||||
/** Core's own tab types. Plugins register theirs at runtime. */
|
||||
type KnownTabType =
|
||||
| "dashboard"
|
||||
| "terminal"
|
||||
| "local-terminal"
|
||||
| "rdp"
|
||||
| "vnc"
|
||||
| "telnet"
|
||||
| "host-metrics"
|
||||
| "proxmox-stats"
|
||||
| "files"
|
||||
| "host-manager"
|
||||
| "user-profile"
|
||||
| "admin-settings"
|
||||
| "docker"
|
||||
| "tunnel"
|
||||
| "sftp"
|
||||
| "web-endpoint"
|
||||
| "network_graph"
|
||||
| "tmux_monitor" // --- tmux-monitor ---
|
||||
| "serial"
|
||||
| "homepage"
|
||||
| "fleet-inventory"
|
||||
// Rail panels that can also open full-width in the main area.
|
||||
| "termix-id"
|
||||
| "alerts"
|
||||
| "session-logs"
|
||||
| "snippets"
|
||||
| "macros"
|
||||
| "history"
|
||||
| "ssh-tools"
|
||||
| "automations"
|
||||
| "ai"
|
||||
| "collab"
|
||||
| "split-screen";
|
||||
|
||||
/**
|
||||
@@ -292,14 +160,6 @@ export type KnownTabType =
|
||||
*/
|
||||
export type TabType = KnownTabType | (string & {});
|
||||
|
||||
export type SerialConfig = {
|
||||
path: string;
|
||||
baudRate: number;
|
||||
dataBits: 5 | 6 | 7 | 8;
|
||||
stopBits: 1 | 2;
|
||||
parity: "none" | "even" | "odd";
|
||||
};
|
||||
|
||||
export type Tab = {
|
||||
id: string;
|
||||
instanceId: string;
|
||||
@@ -309,21 +169,10 @@ export type Tab = {
|
||||
host?: Host;
|
||||
openedAt: number;
|
||||
restoredSessionId?: string | null;
|
||||
/** Set when this tab joins someone else's live shared session instead of connecting/attaching its own. */
|
||||
joinSharedSessionId?: string | null;
|
||||
joinShareId?: string | null;
|
||||
initialFilePath?: string;
|
||||
/** Directory to open a Files tab into, distinct from initialFilePath (a specific file to open in an editor window). */
|
||||
initialPath?: string;
|
||||
/** Which fleet a fleet-inventory tab is currently showing (singleton tab, re-targeted on reopen). */
|
||||
fleetId?: number;
|
||||
/** Which web endpoint this tab shows. Only set when type is "web-endpoint". */
|
||||
endpointId?: string;
|
||||
/** Which collab room a collab tab is showing. */
|
||||
collabRoomId?: string;
|
||||
serialConfig?: SerialConfig;
|
||||
/** Present only on a split-screen container tab. Pane ids reference live child tabs. */
|
||||
splitConfig?: SplitTabConfig;
|
||||
/** Payload owned by the tab's plugin, e.g. which fleet or endpoint it shows. */
|
||||
data?: Record<string, unknown>;
|
||||
/** Present only on a split-screen container tab. Pane tab ids reference live child tabs. */
|
||||
split?: SplitState;
|
||||
/** Hides this session from the top-level tab bar while it belongs to a split tab. */
|
||||
parentSplitTabId?: string;
|
||||
terminalRef?: import("react").RefObject<{
|
||||
@@ -333,24 +182,24 @@ export type Tab = {
|
||||
subscribeOutput?: (listener: (data: string) => void) => () => void;
|
||||
paste?: (text: string) => void;
|
||||
reconnect?: () => void;
|
||||
/** Start a manual reconnect only when disconnected and idle; return whether it started. */
|
||||
reconnectIfDisconnected?: () => boolean;
|
||||
fit?: () => void;
|
||||
notifyResize?: () => void;
|
||||
refresh?: () => void;
|
||||
getApplicationCursorKeysMode?: () => boolean;
|
||||
openShareModal?: () => void;
|
||||
canShare?: () => boolean;
|
||||
focus?: () => void;
|
||||
} | null>;
|
||||
};
|
||||
|
||||
/** Core cards are named here; plugin cards add their own ids. */
|
||||
export type DashboardCardId =
|
||||
| "stats_bar"
|
||||
| "counters_bar"
|
||||
| "quick_actions"
|
||||
| "host_status"
|
||||
| "recent_activity"
|
||||
| "network_graph"
|
||||
| "service_links"
|
||||
| "homepage_preview";
|
||||
| (string & {});
|
||||
|
||||
export type DashboardCardConfig = {
|
||||
id: DashboardCardId;
|
||||
@@ -361,18 +210,15 @@ export type DashboardCardConfig = {
|
||||
|
||||
export type AdminSection =
|
||||
| "general"
|
||||
| "sso"
|
||||
| "users"
|
||||
| "sessions"
|
||||
| "roles"
|
||||
| "host-defaults"
|
||||
| "image-storage"
|
||||
| "branding"
|
||||
| "database"
|
||||
| "api-keys"
|
||||
| "audit-log"
|
||||
| "ssl"
|
||||
| "touch-input";
|
||||
| "ssl";
|
||||
export type ThemeId =
|
||||
| "dark"
|
||||
| "light"
|
||||
@@ -392,112 +238,86 @@ export type UiFontId =
|
||||
| "source-code-pro"
|
||||
| "caskaydia-cove";
|
||||
|
||||
export type ToolsTab =
|
||||
"ssh-tools" | "snippets" | "macros" | "history" | "split-screen";
|
||||
export type SplitMode =
|
||||
| "none"
|
||||
| "2-way"
|
||||
| "2-way-horizontal"
|
||||
| "3-way"
|
||||
| "3-way-horizontal"
|
||||
| "4-way"
|
||||
| "5-way"
|
||||
| "6-way";
|
||||
/** A tools panel view: a rail panel a plugin registered. */
|
||||
export type ToolsTab = string & {};
|
||||
|
||||
export type SplitTabConfig = {
|
||||
mode: Exclude<SplitMode, "none">;
|
||||
paneTabIds: (string | null)[];
|
||||
rowSizes: number[];
|
||||
rowColSizes: number[][];
|
||||
};
|
||||
/** "row" lays children side by side, "column" stacks them. */
|
||||
export type SplitDirection = "row" | "column";
|
||||
|
||||
export interface PaneNode {
|
||||
kind: "pane";
|
||||
id: string;
|
||||
tabId: string | null;
|
||||
}
|
||||
|
||||
export interface SplitNode {
|
||||
kind: "split";
|
||||
id: string;
|
||||
direction: SplitDirection;
|
||||
children: LayoutNode[];
|
||||
/** Percent of the parent per child, summing to 100. */
|
||||
sizes: number[];
|
||||
}
|
||||
|
||||
export type LayoutNode = PaneNode | SplitNode;
|
||||
|
||||
/** The layout of one split tab. */
|
||||
export interface SplitState {
|
||||
root: LayoutNode;
|
||||
focusedPaneId: string;
|
||||
/** A pane shown alone, filling the split, until unzoomed. */
|
||||
zoomedPaneId?: string | null;
|
||||
}
|
||||
|
||||
export type WorkspaceTabSnapshot = {
|
||||
/** Stable key within the saved tab list, not the live Tab.id (which is regenerated on every open). */
|
||||
slotId: string;
|
||||
type: TabType;
|
||||
/** Set for host-bound tab types, resolved by Host.syncId on apply. Never set for "serial". */
|
||||
/** Set for host-bound tab types, resolved by Host.syncId on apply. */
|
||||
hostSyncId?: string | null;
|
||||
/** Denormalized snapshot for display and graceful-skip messaging if the host is later deleted. */
|
||||
hostNameSnapshot?: string | null;
|
||||
label: string;
|
||||
customLabel?: string;
|
||||
/** Read from payloads saved before tabs carried `data`. */
|
||||
initialFilePath?: string;
|
||||
initialPath?: string;
|
||||
fleetId?: number;
|
||||
/** Only present when type === "serial". Fully self-contained, no host resolution needed. */
|
||||
serialConfig?: SerialConfig;
|
||||
/** The tab's plugin payload. */
|
||||
data?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
/** One dock's arrangement. `view` is a RailView, or null when the dock is closed. */
|
||||
export type WorkspaceDockState = {
|
||||
type WorkspaceDockState = {
|
||||
view: string | null;
|
||||
open: boolean;
|
||||
width: number;
|
||||
};
|
||||
|
||||
/** One split tab in a saved layout, its pane tab ids swapped for slotIds. */
|
||||
export type WorkspaceSplitSnapshot = {
|
||||
slotId: string;
|
||||
label: string;
|
||||
root: LayoutNode;
|
||||
focusedPaneId: string;
|
||||
};
|
||||
|
||||
export type WorkspacePayload = {
|
||||
version: 1;
|
||||
version: 1 | 2;
|
||||
tabs: WorkspaceTabSnapshot[];
|
||||
/** A tab's slotId, or a split's. */
|
||||
activeSlotId: string | null;
|
||||
splitMode: SplitMode;
|
||||
/** Indexed identically to AppShell's paneTabIds (length 6), holding slotId instead of a live Tab.id. */
|
||||
paneTabIds: (string | null)[];
|
||||
rowSizes: number[];
|
||||
rowColSizes: number[][];
|
||||
/** Every split tab. Version 2 and later. */
|
||||
splits?: WorkspaceSplitSnapshot[];
|
||||
/** Version 1: the one split, as a fixed mode. */
|
||||
splitMode?: string;
|
||||
/** Version 1: indexed by the mode's pane order, holding slotIds. */
|
||||
paneTabIds?: (string | null)[];
|
||||
rowSizes?: number[];
|
||||
rowColSizes?: number[][];
|
||||
/** Sidebar arrangement, so a workspace restores the whole layout and not just tabs. */
|
||||
sidebar?: {
|
||||
left: WorkspaceDockState;
|
||||
right: WorkspaceDockState;
|
||||
};
|
||||
};
|
||||
|
||||
export type WorkspaceKind = "manual" | "last_session";
|
||||
|
||||
export type Workspace = {
|
||||
id: number;
|
||||
userId: string;
|
||||
name: string;
|
||||
color: string | null;
|
||||
icon: string | null;
|
||||
kind: WorkspaceKind;
|
||||
isDefault: boolean;
|
||||
payload: WorkspacePayload;
|
||||
syncId: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
lastUsedAt: string | null;
|
||||
tabCount: number;
|
||||
};
|
||||
|
||||
export type Snippet = {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
content: string;
|
||||
folder: string | null;
|
||||
order: number;
|
||||
hostIds?: number[];
|
||||
isNote?: boolean;
|
||||
};
|
||||
|
||||
export const FOLDER_ICONS = [
|
||||
"folder",
|
||||
"server",
|
||||
"cloud",
|
||||
"database",
|
||||
"box",
|
||||
"network",
|
||||
"copy",
|
||||
"settings",
|
||||
"cpu",
|
||||
"globe",
|
||||
] as const;
|
||||
export type FolderIconId = (typeof FOLDER_ICONS)[number];
|
||||
|
||||
export type SnippetFolder = {
|
||||
id: number;
|
||||
name: string;
|
||||
color: string;
|
||||
icon: FolderIconId;
|
||||
open: boolean;
|
||||
};
|
||||
Reference in new issue
Block a user