mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 03:01:50 +03:00
refactor: rename to openclaw
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ export async function ensureMediaHosted(
|
||||
if (needsServerStart && !opts.startServer) {
|
||||
await fs.rm(saved.path).catch(() => {});
|
||||
throw new Error(
|
||||
`Media hosting requires the webhook/Funnel server. Start \`${formatCliCommand("moltbot webhook")}\`/\`${formatCliCommand("moltbot up")}\` or re-run with --serve-media.`,
|
||||
`Media hosting requires the webhook/Funnel server. Start \`${formatCliCommand("openclaw webhook")}\`/\`${formatCliCommand("openclaw up")}\` or re-run with --serve-media.`,
|
||||
);
|
||||
}
|
||||
if (needsServerStart && opts.startServer) {
|
||||
|
||||
@@ -17,8 +17,8 @@ function isBun(): boolean {
|
||||
|
||||
function prefersSips(): boolean {
|
||||
return (
|
||||
process.env.CLAWDBOT_IMAGE_BACKEND === "sips" ||
|
||||
(process.env.CLAWDBOT_IMAGE_BACKEND !== "sharp" && isBun() && process.platform === "darwin")
|
||||
process.env.OPENCLAW_IMAGE_BACKEND === "sips" ||
|
||||
(process.env.OPENCLAW_IMAGE_BACKEND !== "sharp" && isBun() && process.platform === "darwin")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ function readJpegExifOrientation(buffer: Buffer): number | null {
|
||||
}
|
||||
|
||||
async function withTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T> {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-img-"));
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-img-"));
|
||||
try {
|
||||
return await fn(dir);
|
||||
} finally {
|
||||
|
||||
@@ -165,7 +165,7 @@ export async function fetchWithGuard(params: {
|
||||
try {
|
||||
const response = await fetch(parsedUrl, {
|
||||
signal: controller.signal,
|
||||
headers: { "User-Agent": "Moltbot-Gateway/1.0" },
|
||||
headers: { "User-Agent": "OpenClaw-Gateway/1.0" },
|
||||
redirect: "manual",
|
||||
dispatcher,
|
||||
} as RequestInit & { dispatcher: Dispatcher });
|
||||
|
||||
@@ -3,7 +3,7 @@ import path from "node:path";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const realOs = await vi.importActual<typeof import("node:os")>("node:os");
|
||||
const HOME = path.join(realOs.tmpdir(), "moltbot-home-header-ext-test");
|
||||
const HOME = path.join(realOs.tmpdir(), "openclaw-home-header-ext-test");
|
||||
|
||||
vi.mock("node:os", () => ({
|
||||
default: { homedir: () => HOME, tmpdir: () => realOs.tmpdir() },
|
||||
|
||||
@@ -6,7 +6,7 @@ import JSZip from "jszip";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const realOs = await vi.importActual<typeof import("node:os")>("node:os");
|
||||
const HOME = path.join(realOs.tmpdir(), "moltbot-home-redirect");
|
||||
const HOME = path.join(realOs.tmpdir(), "openclaw-home-redirect");
|
||||
const mockRequest = vi.fn();
|
||||
|
||||
vi.doMock("node:os", () => ({
|
||||
|
||||
@@ -13,7 +13,7 @@ describe("media store", () => {
|
||||
const envSnapshot: Record<string, string | undefined> = {};
|
||||
|
||||
const snapshotEnv = () => {
|
||||
for (const key of ["HOME", "USERPROFILE", "HOMEDRIVE", "HOMEPATH", "CLAWDBOT_STATE_DIR"]) {
|
||||
for (const key of ["HOME", "USERPROFILE", "HOMEDRIVE", "HOMEPATH", "OPENCLAW_STATE_DIR"]) {
|
||||
envSnapshot[key] = process.env[key];
|
||||
}
|
||||
};
|
||||
@@ -27,10 +27,10 @@ describe("media store", () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
snapshotEnv();
|
||||
home = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-test-home-"));
|
||||
home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-test-home-"));
|
||||
process.env.HOME = home;
|
||||
process.env.USERPROFILE = home;
|
||||
process.env.CLAWDBOT_STATE_DIR = path.join(home, ".clawdbot");
|
||||
process.env.OPENCLAW_STATE_DIR = path.join(home, ".openclaw");
|
||||
if (process.platform === "win32") {
|
||||
const match = home.match(/^([A-Za-z]:)(.*)$/);
|
||||
if (match) {
|
||||
@@ -38,7 +38,7 @@ describe("media store", () => {
|
||||
process.env.HOMEPATH = match[2] || "\\";
|
||||
}
|
||||
}
|
||||
await fs.mkdir(path.join(home, ".clawdbot"), { recursive: true });
|
||||
await fs.mkdir(path.join(home, ".openclaw"), { recursive: true });
|
||||
store = await import("./store.js");
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ describe("media store", () => {
|
||||
await withTempStore(async (store, home) => {
|
||||
const dir = await store.ensureMediaDir();
|
||||
expect(isPathWithinBase(home, dir)).toBe(true);
|
||||
expect(path.normalize(dir)).toContain(`${path.sep}.clawdbot${path.sep}media`);
|
||||
expect(path.normalize(dir)).toContain(`${path.sep}.openclaw${path.sep}media`);
|
||||
const stat = await fs.stat(dir);
|
||||
expect(stat.isDirectory()).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user