Initial import of streamline

This commit is contained in:
2026-11-16 17:26:44 -08:00
commit 8e4aec1855
1221 changed files with 274256 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
// Integration smoke: drive the real tos.ts helpers, then read every uploaded
// object back through the public voffline URL to prove the key encoding used
// for signing matches what actually landed in the bucket.
import { uploadImageToTos, uploadEvidenceToTos, isTosConfigured, evidenceContentType } from "../control-server/src/tos";
console.log("isTosConfigured:", isTosConfigured());
const cases: Array<[string, () => Promise<string>, string]> = [
["image / plain uuid name", () => {
const b = new TextEncoder().encode("PNGDATA-plain");
return uploadImageToTos("_smoke-plain.png", b, "image/png");
}, "PNGDATA-plain"],
["evidence / spaces + unicode + parens", () => {
const b = new TextEncoder().encode("EVIDENCE-weird");
const n = "屏幕截图 (1)!'*.png";
return uploadEvidenceToTos("bug", "_smoke-owner", n, b, evidenceContentType(n));
}, "EVIDENCE-weird"],
["evidence / mp4 content-type", () => {
const b = new TextEncoder().encode("MP4BYTES");
const n = "demo video.mp4";
return uploadEvidenceToTos("feature", "_smoke-owner", n, b, evidenceContentType(n));
}, "MP4BYTES"],
];
let bad = 0;
for (const [label, run, expect] of cases) {
try {
const url = await run();
const res = await fetch(url);
const body = await res.text();
const good = res.ok && body === expect;
if (!good) bad++;
console.log(`${good ? "PASS" : "FAIL"} ${label}`);
console.log(` url=${url}`);
console.log(` voffline=${res.status} ct=${res.headers.get("content-type")} body=${JSON.stringify(body.slice(0, 40))}`);
} catch (err) {
bad++;
console.log(`FAIL ${label}: ${(err as Error).message}`);
}
}
process.exit(bad ? 1 : 0);