🔱: [client] sync upgrade with 3 commits [trident-sync]

build: publish success
Merge remote-tracking branch 'origin/main'
This commit is contained in:
GitHub Actions Bot
2024-07-15 19:23:57 +00:00
parent f230a2a94d
commit f97827ec76
4 changed files with 15 additions and 9 deletions
@@ -181,7 +181,7 @@ function install(app: any, options: any = {}) {
domain: "https://d2p-demo.oss-cn-shenzhen.aliyuncs.com",
bucket: "d2p-demo",
region: "oss-cn-shenzhen",
accessKeyId: "",
accessKeyId: "", //不建议客户端使用AccessKey,生产部署请使用getAuthorization来获取授权
accessKeySecret: "",
async getAuthorization(context: FsUploaderGetAuthContext): Promise<FsUploaderAliossSTS> {
// 不传accessKeySecret代表使用临时签名模式,此时此参数必传(安全,生产环境推荐)
@@ -239,12 +239,12 @@ function install(app: any, options: any = {}) {
//minio与s3完全适配
endpoint: "https://play.min.io",
credentials: {
//不建议在客户端使用secretAccessKey来上传
//不建议在客户端使用secretAccessKey来上传 生产部署请使用getSignedUrl,来获取授权
accessKeyId: "Q3AM3UQ867SPQQA43P2F", //访问登录名
secretAccessKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" //访问密码
}
},
//预签名配置,向后端获取上传的预签名连接
//预签名配置,向后端获取上传的预签名连接(生产部署推荐)
async getSignedUrl(bucket: string, key: string, options: any, type: FsUploaderS3SignedUrlType = "put") {
return await GetSignedUrl(bucket, key, type);
},
@@ -1,7 +1,7 @@
// @ts-ignore
import { S3Client, GetObjectCommand, PutObjectCommand, CreateBucketCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import {utils} from "@fast-crud/fast-crud";
import { utils } from "@fast-crud/fast-crud";
// TODO 模拟server 你应该将此代码搬到你的server端
let bucketCreated = false;
export async function generateSignedUrl(bucket: string, key: string, type: "put" | "get" = "get") {