vslides 1.0.15 → 1.0.16
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/cli.js +10 -42
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3247,48 +3247,16 @@ async function getGuide() {
|
|
|
3247
3247
|
return request("/api/slides/guide");
|
|
3248
3248
|
}
|
|
3249
3249
|
async function uploadAsset(slug, token, filename, content) {
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
},
|
|
3261
|
-
body: content
|
|
3262
|
-
// Node.js fetch handles Buffer directly
|
|
3263
|
-
});
|
|
3264
|
-
} catch (err) {
|
|
3265
|
-
if (i < MAX_RETRIES - 1) {
|
|
3266
|
-
const errMsg = err instanceof Error ? err.message : String(err);
|
|
3267
|
-
console.log(`Upload network error: ${errMsg}, retrying... (${i + 1}/${MAX_RETRIES})`);
|
|
3268
|
-
await sleep(RETRY_DELAY);
|
|
3269
|
-
continue;
|
|
3270
|
-
}
|
|
3271
|
-
throw err;
|
|
3272
|
-
}
|
|
3273
|
-
if (response.status === 503) {
|
|
3274
|
-
console.log("Sandbox waking up...");
|
|
3275
|
-
await sleep(RETRY_DELAY);
|
|
3276
|
-
continue;
|
|
3277
|
-
}
|
|
3278
|
-
if (response.status === 401) {
|
|
3279
|
-
clearCLIAuth();
|
|
3280
|
-
throw new AuthExpiredError();
|
|
3281
|
-
}
|
|
3282
|
-
let data;
|
|
3283
|
-
try {
|
|
3284
|
-
data = await response.json();
|
|
3285
|
-
} catch {
|
|
3286
|
-
const text = await response.text().catch(() => "unknown");
|
|
3287
|
-
throw new Error(`Upload failed (${response.status}): ${text}`);
|
|
3288
|
-
}
|
|
3289
|
-
return { ok: response.ok, status: response.status, data };
|
|
3290
|
-
}
|
|
3291
|
-
throw new Error("Upload failed after max retries");
|
|
3250
|
+
return request("/api/slides/assets", {
|
|
3251
|
+
method: "POST",
|
|
3252
|
+
headers: {
|
|
3253
|
+
"X-Slug": slug,
|
|
3254
|
+
"X-Session-Token": token,
|
|
3255
|
+
"X-Filename": filename,
|
|
3256
|
+
"Content-Type": "application/octet-stream"
|
|
3257
|
+
},
|
|
3258
|
+
body: content
|
|
3259
|
+
});
|
|
3292
3260
|
}
|
|
3293
3261
|
async function exportSlides(slug, token, format) {
|
|
3294
3262
|
const response = await fetch(`${BASE_URL}/api/slides/export?format=${format}`, {
|