feat: 完善安装部署与数字溯源码

This commit is contained in:
Nixevol
2026-07-06 23:26:21 +08:00
parent 7480e4d256
commit 7c6b0bff4c
59 changed files with 2174 additions and 166 deletions
+14
View File
@@ -1,6 +1,7 @@
import {
DeleteObjectCommand,
GetObjectCommand,
ListObjectsV2Command,
PutObjectCommand,
S3Client,
} from '@aws-sdk/client-s3';
@@ -56,6 +57,19 @@ export class OssDriver implements StorageDriver {
await this.client.send(new DeleteObjectCommand({ Bucket: this.opts.bucket, Key: key }));
}
async list(): Promise<string[]> {
const keys: string[] = [];
let token: string | undefined;
do {
const res = await this.client.send(new ListObjectsV2Command({ Bucket: this.opts.bucket, ContinuationToken: token }));
for (const item of res.Contents || []) {
if (item.Key) keys.push(item.Key);
}
token = res.NextContinuationToken;
} while (token);
return keys;
}
getPublicUrl(key: string): string {
if (this.opts.cdnBaseUrl) {
return `${this.opts.cdnBaseUrl.replace(/\/$/, '')}/${key}`;