mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
No commercial licence anywhere: the ee/ carve-out, ee/LICENSE.md and the retitled commercial text are gone from main. What is left is plain AGPL-3.0. Adds Hanzo AI, Inc. copyright for our modifications. Papermark's line stays: AGPL-3.0 s5 requires preserving upstream copyright notices, and removing it is the exact swap that created the exposure we are clearing. Storage comments referenced minio; we use hanzoai/s3. Co-authored-by: Hanzo Dev <[email protected]>
34 lines
938 B
TypeScript
34 lines
938 B
TypeScript
import { S3Store } from "@tus/s3-store";
|
|
|
|
import { getStorageConfig } from "@/lib/storage/config";
|
|
|
|
/** Multipart part size for resumable uploads. */
|
|
const PART_SIZE = 8 * 1024 * 1024;
|
|
|
|
/**
|
|
* Builds the tus datastore for resumable uploads.
|
|
*
|
|
* The store is stateless with respect to the request: bucket and credentials
|
|
* are fixed at construction, so concurrent uploads from different teams cannot
|
|
* observe each other's configuration.
|
|
*/
|
|
export function createTusStore(): S3Store {
|
|
const config = getStorageConfig();
|
|
|
|
return new S3Store({
|
|
partSize: PART_SIZE,
|
|
s3ClientConfig: {
|
|
bucket: config.bucket,
|
|
region: config.region,
|
|
credentials: {
|
|
accessKeyId: config.accessKeyId,
|
|
secretAccessKey: config.secretAccessKey,
|
|
},
|
|
// Set for hanzoai/s3; AWS ignores it.
|
|
...(config.endpoint
|
|
? { endpoint: config.endpoint, forcePathStyle: true }
|
|
: {}),
|
|
},
|
|
});
|
|
}
|