mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-11 13:52:50 +00:00
commit
610ae3a5e8
@ -78,7 +78,13 @@ export class CoolFile {
|
||||
this.client = new QINIU.auth.digest.Mac(accessKeyId, accessKeySecret);
|
||||
}
|
||||
if (aws) {
|
||||
const { accessKeyId, secretAccessKey, region, publicDomain, forcePathStyle } = aws;
|
||||
const {
|
||||
accessKeyId,
|
||||
secretAccessKey,
|
||||
region,
|
||||
publicDomain,
|
||||
forcePathStyle,
|
||||
} = aws;
|
||||
this.client = new S3Client({
|
||||
region,
|
||||
credentials: { accessKeyId, secretAccessKey },
|
||||
@ -173,7 +179,8 @@ export class CoolFile {
|
||||
if (isCloud) {
|
||||
if (oss) {
|
||||
const ossClient: OSS = this.getMetaFileObj();
|
||||
return (await ossClient.put(name, data)).url;
|
||||
const { url } = await ossClient.put(name, data);
|
||||
return oss.publicDomain ? `${oss.publicDomain}/${name}` : url;
|
||||
}
|
||||
if (cos) {
|
||||
const cosClient: COS = this.getMetaFileObj();
|
||||
@ -244,7 +251,8 @@ export class CoolFile {
|
||||
if (mode == MODETYPE.CLOUD) {
|
||||
if (oss) {
|
||||
const ossClient: OSS = this.getMetaFileObj();
|
||||
return (await ossClient.put(key, data)).url;
|
||||
const { url } = await ossClient.put(key, data);
|
||||
return oss.publicDomain ? `${oss.publicDomain}/${key}` : url;
|
||||
}
|
||||
if (cos) {
|
||||
const cosClient: COS = this.getMetaFileObj();
|
||||
@ -391,6 +399,7 @@ export class CoolFile {
|
||||
expAfter = 300000,
|
||||
maxSize = 200 * 1024 * 1024,
|
||||
host,
|
||||
publicDomain,
|
||||
} = this.config.oss;
|
||||
const oss = {
|
||||
bucket,
|
||||
@ -420,6 +429,7 @@ export class CoolFile {
|
||||
signature,
|
||||
policy,
|
||||
host: newHost,
|
||||
publicDomain,
|
||||
OSSAccessKeyId: accessKeyId,
|
||||
success_action_status: 200,
|
||||
};
|
||||
|
||||
@ -67,6 +67,8 @@ export interface OSSConfig {
|
||||
maxSize?: number;
|
||||
// host
|
||||
host?: string;
|
||||
// 阿里云oss的公网访问地址
|
||||
publicDomain: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user