mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 21:32:10 +03:00
chore: remove unused headroom log tail export (#5464)
This commit is contained in:
@@ -89,9 +89,7 @@ function safePort(port: unknown): number {
|
||||
return Number.isFinite(n) && n > 0 && n < 65536 ? n : DEFAULT_PORT;
|
||||
}
|
||||
|
||||
export async function startHeadroomProxy(
|
||||
opts: { port?: number } = {}
|
||||
): Promise<StartResult> {
|
||||
export async function startHeadroomProxy(opts: { port?: number } = {}): Promise<StartResult> {
|
||||
const binary = findHeadroomBinary();
|
||||
if (!binary) {
|
||||
throw new HeadroomError("Headroom CLI not installed", "NOT_INSTALLED");
|
||||
@@ -125,10 +123,7 @@ export async function startHeadroomProxy(
|
||||
if (isPidAlive(child.pid!)) resolve();
|
||||
else
|
||||
reject(
|
||||
new HeadroomError(
|
||||
"headroom proxy exited during startup — see proxy.log",
|
||||
"EARLY_EXIT"
|
||||
)
|
||||
new HeadroomError("headroom proxy exited during startup — see proxy.log", "EARLY_EXIT")
|
||||
);
|
||||
}, STARTUP_TIMEOUT_MS);
|
||||
|
||||
@@ -180,14 +175,3 @@ export function stopHeadroomProxy(): StopResult {
|
||||
throw new HeadroomError(`Failed to stop headroom proxy: ${msg}`, "STOP_FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
export function getHeadroomLogTail(maxLines = 200): string {
|
||||
try {
|
||||
if (!fs.existsSync(LOG_FILE)) return "";
|
||||
const content = fs.readFileSync(LOG_FILE, "utf8");
|
||||
const lines = content.split(/\r?\n/).filter(Boolean);
|
||||
return lines.slice(-maxLines).join("\n");
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
parsePortFromHeadroomUrl,
|
||||
buildHeadroomStatus,
|
||||
} from "../../src/lib/headroom/detect";
|
||||
import { getManagedPid, isPidAlive } from "../../src/lib/headroom/process";
|
||||
import { isLocalOnlyPath } from "../../src/server/authz/routeGuard";
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────────────────
|
||||
@@ -88,3 +89,9 @@ test("buildHeadroomStatus: nothing installed and proxy unreachable → all false
|
||||
assert.equal(status.localUrl, true);
|
||||
assert.equal(status.canStart, false);
|
||||
});
|
||||
|
||||
test("process status helpers are safe for absent managed processes", () => {
|
||||
assert.equal(isPidAlive(null), false);
|
||||
assert.equal(isPidAlive(undefined), false);
|
||||
assert.equal(getManagedPid(), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user