支持 S3 兼容对象存储 (#336)

* feat(storage): 支持 S3 对象存储

* fix(storage): 补齐 S3 对象文件后缀
This commit is contained in:
Rou
2026-08-27 22:16:08 +08:00
committed by GitHub
parent d42e392ed7
commit 21b69d8bc7
25 changed files with 1374 additions and 88 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, test } from "bun:test";
import { changesRequireOSSRetest, DEFAULT_OSS_PATH_PREFIX, getS3PresetHints } from "../src/lib/oss-settings";
describe("OSS settings helpers", () => {
test("provides editable S3 endpoint hints for known presets", () => {
expect(getS3PresetHints("r2")).toMatchObject({ region: "auto" });
expect(getS3PresetHints("b2").endpoint).toContain("backblazeb2.com");
});
test("only connection fields invalidate a previous test", () => {
expect(changesRequireOSSRetest({ endpoint: "https://s3.example.com" })).toBe(true);
expect(changesRequireOSSRetest({ enabled: true })).toBe(false);
expect(changesRequireOSSRetest({ allowUserS3: true })).toBe(false);
});
test("uses the product path prefix by default", () => {
expect(DEFAULT_OSS_PATH_PREFIX).toBe("open-ai-canvas");
});
});