@songsid/agend 2.3.3-beta.9 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { type HumanOrigin } from "./human-delivery-receipts.js";
2
2
  import { SettingsExecution } from "./settings-transaction.js";
3
3
  import { AppIconStore } from "./web-app-icon.js";
4
+ import { type NamedTestResult } from "./tunnel/named-link-test.js";
4
5
  import { OfficeShareService } from "./office-share-service.js";
5
6
  import { type OfficeShare } from "./office-share.js";
6
7
  import type { LoginCodeOwner } from "./web-login.js";
@@ -1642,6 +1643,21 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1642
1643
  private publicWebLink;
1643
1644
  /** #1723: the public link's preview tunnel — a manager and lease of its own, never the fleet's one tunnel lane. */
1644
1645
  private getPreviewTunnel;
1646
+ private namedLinkTestRunning;
1647
+ /**
1648
+ * #2906 (the user, 2026-11-01): Settings → Access → Test connection, on the fixed-address values as filled in (the
1649
+ * typed connector token, else the saved one). One at a time; the result is closed step codes only — the token is
1650
+ * never logged or returned. Admin only, never over the public link (settings-api.ts).
1651
+ */
1652
+ testNamedLink(input: {
1653
+ hostname: unknown;
1654
+ port: unknown;
1655
+ protocol: unknown;
1656
+ token?: unknown;
1657
+ current?: () => boolean;
1658
+ }): Promise<NamedTestResult | {
1659
+ busy: true;
1660
+ }>;
1645
1661
  private getTunnelLane;
1646
1662
  private publicOwnerCurrent;
1647
1663
  /** Exact owning General. No primary-adapter or name fallback participates in authorization. */
@@ -27,6 +27,7 @@ import { clearPublicLinkOwner, readPublicLinkOwner, writePublicLinkOwner } from
27
27
  import { PUBLIC_PREVIEW_FRAME_SRC, PUBLIC_PREVIEW_TUNNEL_DIR, PublicPreview, publicPreviewWanted } from "./public-preview.js";
28
28
  import { CloudflaredProvider } from "./tunnel/cloudflared.js";
29
29
  import { ensureCloudflared } from "./tunnel/cloudflared-install.js";
30
+ import { namedTestLane, runNamedLinkTest } from "./tunnel/named-link-test.js";
30
31
  import { OFFICE_SHARE_TUNNEL_DIR, OfficeShareService } from "./office-share-service.js";
31
32
  import { ALL_OFFICES, WHOLE_FLEET } from "./office-share.js";
32
33
  import { TunnelPurposeLane } from "./tunnel/purpose-lane.js";
@@ -6585,6 +6586,32 @@ export class FleetManager {
6585
6586
  return this.previewTunnel ??= new ManagedTunnel({ dataDir: join(this.dataDir, PUBLIC_PREVIEW_TUNNEL_DIR),
6586
6587
  log: () => this.logger.warn("Public preview tunnel cleanup requires attention") });
6587
6588
  }
6589
+ namedLinkTestRunning = false;
6590
+ /**
6591
+ * #2906 (the user, 2026-11-01): Settings → Access → Test connection, on the fixed-address values as filled in (the
6592
+ * typed connector token, else the saved one). One at a time; the result is closed step codes only — the token is
6593
+ * never logged or returned. Admin only, never over the public link (settings-api.ts).
6594
+ */
6595
+ async testNamedLink(input) {
6596
+ if (this.namedLinkTestRunning)
6597
+ return { busy: true };
6598
+ this.namedLinkTestRunning = true;
6599
+ try {
6600
+ const typed = typeof input.token === "string" && input.token.trim() ? input.token : null;
6601
+ const result = await runNamedLinkTest({ hostname: input.hostname, port: input.port, protocol: input.protocol, token: typed ?? process.env[PUBLIC_TUNNEL_TOKEN_ENV] ?? null }, {
6602
+ healthPort: this.fleetConfig?.health_port ?? 19280,
6603
+ ensureBinary: async (signal) => (await ensureCloudflared({ dataDir: this.dataDir, pinnedOnly: true, signal })).path,
6604
+ liveMarker: values => this.publicWebLink?.liveNamedMarker(values) ?? null,
6605
+ reserve: namedTestLane(this.getTunnelLane()),
6606
+ current: input.current,
6607
+ });
6608
+ this.logger[result.cleanup ? "warn" : "info"]({ steps: result.steps.map(s => `${s.step}:${s.code}`), typedToken: !!typed, ...(result.cleanup ? { cleanup: result.cleanup } : {}) }, result.cleanup ? "Named link test: the test connector's stop could not be proven; the tunnel lane stays held" : "Named link test");
6609
+ return result;
6610
+ }
6611
+ finally {
6612
+ this.namedLinkTestRunning = false;
6613
+ }
6614
+ }
6588
6615
  getTunnelLane() {
6589
6616
  return this.tunnelPurposeLane ??= new TunnelPurposeLane(new ManagedTunnel({ dataDir: this.dataDir,
6590
6617
  log: () => this.logger.warn("Managed tunnel cleanup requires attention") }));
@@ -6960,7 +6987,8 @@ export class FleetManager {
6960
6987
  : "\n" + t("dashboard.public_status", status.state, status.remainingSeconds ?? 0)
6961
6988
  + (status.expiresAt ? t("dashboard.public_until", formatFleetTime(status.expiresAt)) : ""));
6962
6989
  const choices = [{ action: "local", label: t("dashboard.local_signin") },
6963
- ...(publicLinkSettings(this.fleetConfig?.web).allowed ? [{ action: "public", label: t("dashboard.public_open") }] : []),
6990
+ ...(publicLinkSettings(this.fleetConfig?.web).allowed
6991
+ ? [{ action: "public", label: t(publicLinkNamedHostname(this.fleetConfig?.web) ? "dashboard.public_open_named" : "dashboard.public_open") }] : []),
6964
6992
  ...(status.state !== "closed" ? [{ action: "close", label: t("dashboard.public_close") }] : [])];
6965
6993
  const posted = await this.postNonceButtonPrompt({
6966
6994
  prefix: "dashboard:", alertType: "login", instanceName: "dashboard", adapter, adapterId: owner.adapterId,