duclaw-cli 1.9.2 → 1.9.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.
- package/dist/bundle.js +29 -5
- package/dist/main.js +1 -1
- package/dist/worker-main.js +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -30242,7 +30242,7 @@ function printHelp() {
|
|
|
30242
30242
|
`);
|
|
30243
30243
|
}
|
|
30244
30244
|
function printVersion() {
|
|
30245
|
-
console.log(`duclaw-cli v${true ? "1.9.
|
|
30245
|
+
console.log(`duclaw-cli v${true ? "1.9.3" : "unknown"}`);
|
|
30246
30246
|
}
|
|
30247
30247
|
function getDuclawTemplate() {
|
|
30248
30248
|
return {
|
|
@@ -41540,10 +41540,34 @@ var guessMediaTypeFromExt = (filePath) => {
|
|
|
41540
41540
|
if (ext === ".webp") return "image/webp";
|
|
41541
41541
|
return null;
|
|
41542
41542
|
};
|
|
41543
|
+
var controlPlaneBaseUrl = () => {
|
|
41544
|
+
return process.env.DUCLAW_CONTROL_PLANE_BASE_URL?.replace(/\/$/, "");
|
|
41545
|
+
};
|
|
41546
|
+
var resolveRemoteUrl = (input) => {
|
|
41547
|
+
if (/^https?:\/\//i.test(input)) return input;
|
|
41548
|
+
const baseUrl = controlPlaneBaseUrl();
|
|
41549
|
+
if (baseUrl && input.startsWith("/internal/")) return `${baseUrl}${input}`;
|
|
41550
|
+
return void 0;
|
|
41551
|
+
};
|
|
41552
|
+
var shouldAttachRuntimeAuth = (url) => {
|
|
41553
|
+
const baseUrl = controlPlaneBaseUrl();
|
|
41554
|
+
if (!baseUrl || !url.includes("/internal/runtime/mobile/attachments/")) return false;
|
|
41555
|
+
try {
|
|
41556
|
+
return new URL(url).origin === new URL(baseUrl).origin;
|
|
41557
|
+
} catch {
|
|
41558
|
+
return false;
|
|
41559
|
+
}
|
|
41560
|
+
};
|
|
41543
41561
|
var resolveImageBlock = async (input) => {
|
|
41544
|
-
|
|
41545
|
-
|
|
41546
|
-
|
|
41562
|
+
const remoteUrl = resolveRemoteUrl(input);
|
|
41563
|
+
if (remoteUrl) {
|
|
41564
|
+
console.log(`[ImageUnderstand] \u4E0B\u8F7D\u56FE\u7247: ${remoteUrl.substring(0, 80)}...`);
|
|
41565
|
+
const headers = {};
|
|
41566
|
+
const runtimeToken = process.env.DUCLAW_CONTROL_PLANE_METERING_TOKEN;
|
|
41567
|
+
if (runtimeToken && shouldAttachRuntimeAuth(remoteUrl)) {
|
|
41568
|
+
headers.authorization = `Bearer ${runtimeToken}`;
|
|
41569
|
+
}
|
|
41570
|
+
const res = await fetch(remoteUrl, { headers });
|
|
41547
41571
|
if (!res.ok) throw new Error(`[ImageUnderstand] \u56FE\u7247\u4E0B\u8F7D\u5931\u8D25: ${res.status} ${res.statusText}`);
|
|
41548
41572
|
const contentType = res.headers.get("content-type") || "";
|
|
41549
41573
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
@@ -53086,7 +53110,7 @@ var systemRoutes = new Hono2();
|
|
|
53086
53110
|
var startTime = Date.now();
|
|
53087
53111
|
systemRoutes.get("/system/info", (c) => {
|
|
53088
53112
|
return c.json({
|
|
53089
|
-
version: true ? "1.9.
|
|
53113
|
+
version: true ? "1.9.3" : "unknown",
|
|
53090
53114
|
uptime: Math.floor((Date.now() - startTime) / 1e3),
|
|
53091
53115
|
env: process.env.NODE_ENV || "development",
|
|
53092
53116
|
nodeVersion: process.version
|