File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ qiniu.compressImage(file, options).then(data => {
183
183
184
184
* config .useCdnDomain : 表示是否使用 cdn 加速域名,为布尔值,` true` 表示使用,默认为 ` false` 。
185
185
* config .disableStatisticsReport : 是否禁用日志报告,为布尔值,默认为 ` false` 。
186
+ * config .uphost : 上传 ` host` ,类型为 ` string` , 如果设定改参数则优先使用该参数作为上传地址,默认为` null` 。
186
187
* config .region : 选择上传域名区域;当为 ` null` 或 ` undefined` 时,自动分析上传域名区域。
187
188
* config .retryCount : 上传自动重试次数(整体重试次数,而不是某个分片的重试次数);默认 3 次(即上传失败后最多重试两次);** 目前仅在上传过程中产生 ` 599` 内部错误时生效** ,** 但是未来很可能会扩展为支持更多的情况** 。
188
189
* config .concurrentRequestLimit : 分片上传的并发请求量,` number` ,默认为3 ;因为浏览器本身也会限制最大并发量,所以最大并发量与浏览器有关。
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " qiniu-js" ,
3
3
"jsName" : " qiniu" ,
4
- "version" : " 2.3 .0" ,
4
+ "version" : " 2.4 .0" ,
5
5
"private" : false ,
6
6
"description" : " Javascript SDK for Qiniu Resource (Cloud) Storage AP" ,
7
7
"main" : " dist/qiniu.min.js" ,
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class UploadManager {
29
29
disableStatisticsReport : false ,
30
30
retryCount : 3 ,
31
31
checkByMD5 : false ,
32
+ uphost : null ,
32
33
concurrentRequestLimit : 3 ,
33
34
region : null
34
35
} ,
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ export function getPortFromUrl(url) {
191
191
groups = url . match ( / ^ h t t p s ? : \/ \/ ( [ ^ : ^ / ] * ) : ( \d * ) / ) ;
192
192
if ( groups ) {
193
193
return groups [ 2 ] ;
194
- }
194
+ }
195
195
if ( type === "http" ) {
196
196
return "80" ;
197
197
}
@@ -211,11 +211,17 @@ export function getDomainFromUrl (url) {
211
211
// 构造区域上传url
212
212
export function getUploadUrl ( config , token ) {
213
213
let protocol = getAPIProtocol ( ) ;
214
- if ( config . region != null ) {
214
+
215
+ if ( config . uphost != null ) {
216
+ return Promise . resolve ( `${ protocol } //${ config . uphost } ` ) ;
217
+ }
218
+
219
+ if ( config . region != null ) {
215
220
let upHosts = regionUphostMap [ config . region ] ;
216
221
let host = config . useCdnDomain ? upHosts . cdnUphost : upHosts . srcUphost ;
217
222
return Promise . resolve ( `${ protocol } //${ host } ` ) ;
218
- }
223
+ }
224
+
219
225
return getUpHosts ( token )
220
226
. then ( res => {
221
227
let hosts = res . data . up . acc . main ;
Original file line number Diff line number Diff line change 209
209
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
210
210
<![endif]-->
211
211
<!--[if !IE]><!-->
212
- < script src ="http ://cdn.static.runoob. com/libs /jquery/1.10.2/jquery.min.js "> </ script >
212
+ < script src ="https ://cdn.bootcss. com/jquery/1.10.2/jquery.min.js "> </ script >
213
213
<!--<![endif]-->
214
214
< script src ="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js "> </ script >
215
215
< script src ="https://cdn.bootcss.com/json3/3.3.2/json3.min.js "> </ script >
You can’t perform that action at this time.
0 commit comments