Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/src/gateway/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 1 kB image not shown  

Quelle  server.control-ui-root.test.ts

  Sprache: JAVA
 

import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, test } from "vitest";
import { installGatewayTestHooks, testState, withGatewayServer } from "./test-helpers.js";

installGatewayTestHooks({ scope: "suite" });

async function withGlobalControlUiHardlinkFixture<T>(run: (rootPath: string) => Promise<T>) {
  const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-gateway-ui-hardlink-"));
  try {
    const packageRoot = path.join(tmp, "pnpm-global""5""node_modules""openclaw");
    const controlUiRoot = path.join(packageRoot, "dist""control-ui");
    await fs.mkdir(controlUiRoot, { recursive: true });
    await fs.writeFile(
      path.join(packageRoot, "package.json"),
      JSON.stringify({ name: "openclaw" }),
    );

    const storeDir = path.join(tmp, "pnpm-store""files");
    await fs.mkdir(storeDir, { recursive: true });
    const storeIndex = path.join(storeDir, "index.html");
    await fs.writeFile(storeIndex, "<html><body>pnpm-hardlink-ui</body></html>\n");
    await fs.link(storeIndex, path.join(controlUiRoot, "index.html"));

    return await run(controlUiRoot);
  } finally {
    await fs.rm(tmp, { recursive: true, force: true });
  }
}

describe("gateway.controlUi.root", () => {
  test("rejects hardlinked index.html when configured root points at global OpenClaw package control-ui", async () => {
    await withGlobalControlUiHardlinkFixture(async (rootPath) => {
      testState.gatewayControlUi = { root: rootPath };
      await withGatewayServer(
        async ({ port }) => {
          const res = await fetch(`http://127.0.0.1:${port}/`);
          expect(res.status).toBe(404);
          expect(await res.text()).toBe("Not Found");
        },
        { serverOptions: { controlUiEnabled: true } },
      );
    });
  });
});

Messung V0.5 in Prozent
C=99 H=97 G=97

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.