mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-02-18 10:13:49 +00:00
oss 上传新增host 配置, 支持配置cdn
This commit is contained in:
parent
63b290ba9f
commit
c1d54feae0
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "6.0.4",
|
||||
"version": "6.0.5",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -147,6 +147,8 @@ export interface OSSConfig {
|
||||
expAfter?: number;
|
||||
/** 文件最大的 size */
|
||||
maxSize?: number;
|
||||
// host
|
||||
host?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "6.0.4",
|
||||
"version": "6.0.5",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/file",
|
||||
"version": "6.0.1",
|
||||
"version": "6.0.2",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -308,6 +308,7 @@ export class CoolFile {
|
||||
endpoint,
|
||||
expAfter = 300000,
|
||||
maxSize = 200 * 1024 * 1024,
|
||||
host,
|
||||
} = this.config.oss;
|
||||
const oss = {
|
||||
bucket,
|
||||
@ -317,7 +318,7 @@ export class CoolFile {
|
||||
expAfter, // 签名失效时间,毫秒
|
||||
maxSize, // 文件最大的 size
|
||||
};
|
||||
const host = `https://${bucket}.${endpoint}`;
|
||||
const newHost = host ? host : `https://${bucket}.${endpoint}`;
|
||||
const expireTime = new Date().getTime() + oss.expAfter;
|
||||
const expiration = new Date(expireTime).toISOString();
|
||||
const policyString = JSON.stringify({
|
||||
@ -336,7 +337,7 @@ export class CoolFile {
|
||||
return {
|
||||
signature,
|
||||
policy,
|
||||
host,
|
||||
host: newHost,
|
||||
OSSAccessKeyId: accessKeyId,
|
||||
success_action_status: 200,
|
||||
};
|
||||
|
||||
@ -61,6 +61,8 @@ export interface OSSConfig {
|
||||
expAfter?: number;
|
||||
// 文件最大的 size
|
||||
maxSize?: number;
|
||||
// host
|
||||
host?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/file",
|
||||
"version": "6.0.1",
|
||||
"version": "6.0.2",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user