mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 07:05:24 +00:00
release-2.9.1 (#1557)
* fix(sso): send the PKCE verifier for GitHub login (#1534) * fix(remote-desktop): clip cursor overflow without disabling zoom (#1535) * test(remote-desktop): preserve sessions beyond one hour (#1536) * fix(hosts): expose controls for overflowing editor tabs (#1537) * fix(hosts): expose controls for overflowing editor tabs * test(hosts): mock resize observation in admin panel tests * fix(status): skip TCP probes while host sessions are active (#1538) * fix(database): batch session activity persistence (#1539) * docs(api): describe cookie and API key authentication (#1540) * fix(snippets): repair missing note column on SQLite upgrades (#1541) * fix(docker): retain stored SSH credential association (#1543) * fix(file-manager): render transfer toasts without plugin hooks (#1546) * feat(hosts): keep compact row actions inline (#1547) * fix(auth): allow retrying unavailable second-factor interfaces (#1549) * fix(auth): reject unresolved legacy identity provisioning (#1550) * fix(desktop): ship the plugin SDK inside Mac App Store builds (#1551) * fix(tmux): pass full session info to the terminal's session picker (#1552) The tmux.sessions service reduced detected sessions to bare names, but the picker reads session.name, so every entry rendered blank and selecting one sent an empty name, which created a new session instead of attaching. * fix(ssh): read force keyboard-interactive as a boolean when resolving hosts (#1553) The column holds the text "true"/"false", and the resolver passed it through as-is. The string "false" is truthy, so the password provider treated every saved host as forced keyboard-interactive and left the password out. Jump hops are built straight from the resolved host, so a password hop whose server doesn't offer keyboard-interactive failed with "All configured authentication methods failed". * fix(database): batch database saves for bulk host writes (#1554) * fix(database): yield to the event loop between database saves Each SQLite save serializes and encrypts the whole database into new buffers, which V8 only releases once the event loop turns. Boot migrations and bulk host import write plugin settings per host and per key in an awaited loop, so hundreds of full copies piled up and the container ran out of memory. * fix(database): save once per bulk host write instead of once per row On SQLite every repository write force-saves the whole database. Boot plugin data migrations, host defaults materialization and the bulk host routes write one row per host per setting, so they serialized and encrypted the full database hundreds of times in a row. DatabaseSaveTrigger.batched wraps a function so force saves made while it runs collapse into a single save when it finishes. Nested scopes fold into the outer one, and work that outlives its scope saves normally. * feat(hosts): add instance-wide predefined tag suggestions (#1548) * feat(hosts): add shared predefined tag suggestions * style(hosts): format tag catalog routes * test(database): advance fake timers past the save yield (#1555) * fix(i18n): complete Simplified Chinese core and plugin translations (#1542) * fix(i18n): complete Chinese onboarding and navigation labels * fix(i18n): translate remaining Chinese core and plugin interfaces * fix(i18n): translate host editor tab overflow controls * fix(i18n): use consistent Chinese fleet terminology * fix(i18n): localize hardcoded controls and plugin views * fix(i18n): translate built-in homepage widget catalog * test(homepage): follow translated timezone placeholder * fix(i18n): translate plugin-provided homepage widgets * fix(i18n): localize feature settings section titles * fix: 2.8 oidc accounts unable to sign in after upgrading (#1381) * fix: plugins losing the saved ssh login when copying a host (#1391) * fix: fleets, proxmox and automations not getting the host sudo password * fix: host imports running a defaults pass and metrics restart per host (#1384) * fix: high cpu from status probes and full database saves on every sample (#1300) * fix: user data export freezing the server (#1393) * fix: op:// secret references rejected as ssh keys on credentials (#1394) * fix: slow file deletes from the trash lookups on every delete (#1390) * fix: add openapi docs and error handling to host tag routes * test: compare download stream buffers directly so it stops timing out * chore: drop em dash from host row comment * chore: update release notes for 2.9.1 * fix: restore space to add host tags and redesign predefined tags editor * fix: host key silently accepted when the host is missing from the database (#1397) * fix: clearer host login failed status label and fix its translations (#1396) * chore: add host key and status label fixes to release notes * fix: sso and ldap provider dialogs overflowing the screen and using mismatched toggles * chore: increment ver * fix(audit): store plugin entries with no acting user as a null user_id (#1556) Plugin audit entries written outside a request used the literal "system" as user_id. That column references users.id, so the insert was refused (Postgres logs it as an FK violation) and the entry was silently dropped. Write null instead and keep "system" / plugin:<id> in username. * chore: add sso/ldap dialog and audit log fixes to release notes * fix: tunnels and host settings missing from shared hosts on desktop * fix: remote desktop logins missing from shared hosts on desktop * fix: simplify host status to online/offline and keep it live without a refresh * chore: sync Crowdin translations for 2.9.1 --------- Co-authored-by: ZacharyZcR <zacharyzcr1984@gmail.com>
This commit is contained in:
1 parent
5786eaccbb
commit
6b708106e1
912 files changed
+14220
-2200
No files matched your search
@@ -308,5 +308,8 @@
|
||||
"label": "Monitored paths"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Gemonitorde paaie"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "المسارات المراقبة"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Мониторирани пътища"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "পর্যবেক্ষণ করা পথ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Camins monitoritzats"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Sledované cesty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Overvågede stier"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Überwachte Pfade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Παρακολουθούμενες διαδρομές"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Senderos vigilados"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Valvotut polut"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Chemins surveillés"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "נתיבים מנוטרים"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "निगरानी किए गए पथ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Megfigyelt útvonalak"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Jalur yang dipantau"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Percorsi monitorati"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "監視対象経路"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "모니터링되는 경로"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Bewaakte paden"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Overvåkede stier"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Monitorowane ścieżki"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Caminhos monitorados"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Caminhos monitorizados"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Căi monitorizate"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Контролируемые пути"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Праћене путање"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Övervakade vägar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "เส้นทางที่ได้รับการตรวจสอบ"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "İzlenen yollar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Контрольовані шляхи"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "Các tuyến đường được giám sát"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "监控路径"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -308,5 +308,8 @@
|
||||
"label": "監控路徑"
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"name": "Host Metrics"
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ export interface MetricsViewersV1 {
|
||||
unregister: (hostId: number, viewerSessionId: string) => void;
|
||||
}
|
||||
|
||||
const RETIME_DEBOUNCE_MS = 1000;
|
||||
|
||||
export async function activate(ctx: PluginContext) {
|
||||
const log = createLogger(ctx.log);
|
||||
const repository = await createHostMetricsRepository(ctx.db);
|
||||
@@ -73,7 +75,19 @@ export async function activate(ctx: PluginContext) {
|
||||
const { hostId } = payload as { hostId?: number };
|
||||
if (hostId) poller.hostKeyAccepted(hostId);
|
||||
});
|
||||
ctx.settings.onChange("metricsInterval", () => void poller.retimeAll());
|
||||
// An import writes this once per host, and each write restarted every
|
||||
// polled host. One retime after the writes settle covers them all.
|
||||
let retime: ReturnType<typeof setTimeout> | null = null;
|
||||
ctx.settings.onChange("metricsInterval", () => {
|
||||
if (retime) clearTimeout(retime);
|
||||
retime = setTimeout(() => {
|
||||
retime = null;
|
||||
void poller.retimeAll();
|
||||
}, RETIME_DEBOUNCE_MS);
|
||||
});
|
||||
ctx.disposables.add(() => {
|
||||
if (retime) clearTimeout(retime);
|
||||
});
|
||||
|
||||
ctx.services.provide<MetricsViewersV1>("host-metrics.viewers", {
|
||||
register: async (hostId) => {
|
||||
|
||||
@@ -347,11 +347,8 @@ export class MetricsPoller {
|
||||
const settings = await this.settingsFor(host.id);
|
||||
if (!settings.metricsEnabled) return;
|
||||
|
||||
let authenticated = false;
|
||||
try {
|
||||
const metrics = await collectMetrics(this.deps, host, settings, () => {
|
||||
authenticated = true;
|
||||
});
|
||||
const metrics = await collectMetrics(this.deps, host, settings);
|
||||
this.metrics.set(host.id, { data: metrics, timestamp: Date.now() });
|
||||
this.ctx.hosts.status.reportLogin(host.id, { ok: true });
|
||||
this.setCollectionState(host, "collecting");
|
||||
@@ -367,14 +364,6 @@ export class MetricsPoller {
|
||||
const hostKeyChanged = isHostKeyVerificationError(error);
|
||||
const message = error instanceof Error ? error.message : "";
|
||||
const isAuthError = /authentication|permission denied/i.test(message);
|
||||
|
||||
// A timeout or a dropped connection says nothing about the login.
|
||||
if (!authenticated && (isAuthError || hostKeyChanged)) {
|
||||
this.ctx.hosts.status.reportLogin(host.id, {
|
||||
ok: false,
|
||||
hostKeyChanged,
|
||||
});
|
||||
}
|
||||
this.setCollectionState(
|
||||
host,
|
||||
hostKeyChanged
|
||||
|
||||
@@ -159,7 +159,7 @@ export async function createHostMetricsRepository(db: PluginDatabase) {
|
||||
)
|
||||
: scope,
|
||||
);
|
||||
await db.persist();
|
||||
await db.persist({ lazy: true });
|
||||
},
|
||||
|
||||
async listHealth(
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { PluginHostStatus } from "@termix/plugin-sdk/backend";
|
||||
import type { CpuSamples } from "./widgets/cpu-collector.js";
|
||||
import { createNetworkSamples } from "./widgets/network-collector.js";
|
||||
|
||||
export type HostStatus = "online" | "reachable" | "offline";
|
||||
|
||||
export class RequestQueue {
|
||||
private queues = new Map<number, Array<() => Promise<unknown>>>();
|
||||
private processing = new Set<number>();
|
||||
@@ -418,7 +417,7 @@ export class HostPollCache<THost extends { id: number } = { id: number }> {
|
||||
* host answers. A host core does not check (status checks off) is tried.
|
||||
*/
|
||||
export function canStartInitialMetrics(
|
||||
status: HostStatus | null | undefined,
|
||||
status: PluginHostStatus | null | undefined,
|
||||
hasViewers: boolean,
|
||||
): boolean {
|
||||
return hasViewers && status !== "offline";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import express from "express";
|
||||
import {
|
||||
createMockCtx,
|
||||
@@ -9,6 +9,7 @@ import { PluginCapabilityError } from "@termix/plugin-sdk/backend";
|
||||
import { activate } from "../../src/backend/index.js";
|
||||
import type { MetricsViewersV1 } from "../../src/backend/index.js";
|
||||
import { hostImportNormalizer } from "../../src/backend/host-import.js";
|
||||
import { MetricsPoller } from "../../src/backend/poller.js";
|
||||
import { manifest, pluginDir, startServer, type TestServer } from "./server";
|
||||
|
||||
let db: TestDb | null = null;
|
||||
@@ -117,4 +118,23 @@ describe("hostImportNormalizer", () => {
|
||||
it("writes nothing for a row without metrics settings", () => {
|
||||
expect(hostImportNormalizer({ name: "x" })).toBeNull();
|
||||
});
|
||||
|
||||
it("retimes once after a burst of interval writes", async () => {
|
||||
server = await startServer();
|
||||
const retime = vi
|
||||
.spyOn(MetricsPoller.prototype, "retimeAll")
|
||||
.mockResolvedValue();
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
for (let hostId = 1; hostId <= 20; hostId++) {
|
||||
await server.mock.ctx.settings.setHost(hostId, "metricsInterval", 30);
|
||||
}
|
||||
expect(retime).not.toHaveBeenCalled();
|
||||
await vi.advanceTimersByTimeAsync(1500);
|
||||
expect(retime).toHaveBeenCalledTimes(1);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
retime.mockRestore();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -40,7 +40,7 @@ function setup(hostIds = [7]) {
|
||||
hostStatuses: Object.fromEntries(
|
||||
hostIds.map((id) => [
|
||||
id,
|
||||
{ status: "reachable" as const, lastChecked: "now" },
|
||||
{ status: "online" as const, lastChecked: "now" },
|
||||
]),
|
||||
),
|
||||
});
|
||||
@@ -131,13 +131,13 @@ describe("MetricsPoller", () => {
|
||||
expect(collectMetrics).not.toHaveBeenCalled();
|
||||
|
||||
// Core's check comes back: the first sample runs.
|
||||
fake.hostStatuses.set(7, { status: "reachable", lastChecked: "now" });
|
||||
poller.hostStatusChanged(7, "reachable");
|
||||
fake.hostStatuses.set(7, { status: "online", lastChecked: "now" });
|
||||
poller.hostStatusChanged(7, "online");
|
||||
await flush();
|
||||
expect(collectMetrics).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("reports a failed login and why collection stopped", async () => {
|
||||
it("says why collection stopped without touching the status", async () => {
|
||||
collectMetrics.mockRejectedValue(
|
||||
new Error("All configured authentication methods failed"),
|
||||
);
|
||||
@@ -146,9 +146,7 @@ describe("MetricsPoller", () => {
|
||||
poller.registerViewer(7, "viewer-a", "user-1");
|
||||
await flush();
|
||||
|
||||
expect(fake.statusReports).toEqual([
|
||||
{ hostId: 7, ok: false, hostKeyChanged: false },
|
||||
]);
|
||||
expect(fake.statusReports).toEqual([]);
|
||||
expect(fake.emitted.at(-1)?.payload).toMatchObject({
|
||||
state: "auth_failed",
|
||||
});
|
||||
@@ -174,9 +172,7 @@ describe("MetricsPoller", () => {
|
||||
poller.registerViewer(7, "viewer-a", "user-1");
|
||||
await flush();
|
||||
|
||||
expect(fake.statusReports).toEqual([
|
||||
{ hostId: 7, ok: false, hostKeyChanged: true },
|
||||
]);
|
||||
expect(fake.statusReports).toEqual([]);
|
||||
expect(state.authFailures.shouldSkip(7)).toBe(true);
|
||||
poller.hostKeyAccepted(7);
|
||||
expect(state.authFailures.shouldSkip(7)).toBe(false);
|
||||
|
||||
@@ -27,7 +27,6 @@ describe("auth failure tracking", () => {
|
||||
describe("initial metrics admission", () => {
|
||||
it("needs a viewer and a host core does not see as offline", () => {
|
||||
expect(canStartInitialMetrics("online", true)).toBe(true);
|
||||
expect(canStartInitialMetrics("reachable", true)).toBe(true);
|
||||
expect(canStartInitialMetrics("offline", true)).toBe(false);
|
||||
expect(canStartInitialMetrics("online", false)).toBe(false);
|
||||
// Status checks off: core has no status, so the sample is tried.
|
||||
|
||||
Reference in new issue
Block a user