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 => {
183183
184184 * config .useCdnDomain : 表示是否使用 cdn 加速域名,为布尔值,` true` 表示使用,默认为 ` false` 。
185185 * config .disableStatisticsReport : 是否禁用日志报告,为布尔值,默认为 ` false` 。
186+ * config .uphost : 上传 ` host` ,类型为 ` string` , 如果设定改参数则优先使用该参数作为上传地址,默认为` null` 。
186187 * config .region : 选择上传域名区域;当为 ` null` 或 ` undefined` 时,自动分析上传域名区域。
187188 * config .retryCount : 上传自动重试次数(整体重试次数,而不是某个分片的重试次数);默认 3 次(即上传失败后最多重试两次);** 目前仅在上传过程中产生 ` 599` 内部错误时生效** ,** 但是未来很可能会扩展为支持更多的情况** 。
188189 * config .concurrentRequestLimit : 分片上传的并发请求量,` number` ,默认为3 ;因为浏览器本身也会限制最大并发量,所以最大并发量与浏览器有关。
Original file line number Diff line number Diff line change 11{
22 "name" : " qiniu-js" ,
33 "jsName" : " qiniu" ,
4- "version" : " 2.3 .0" ,
4+ "version" : " 2.4 .0" ,
55 "private" : false ,
66 "description" : " Javascript SDK for Qiniu Resource (Cloud) Storage AP" ,
77 "main" : " dist/qiniu.min.js" ,
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class UploadManager {
2929 disableStatisticsReport : false ,
3030 retryCount : 3 ,
3131 checkByMD5 : false ,
32+ uphost : null ,
3233 concurrentRequestLimit : 3 ,
3334 region : null
3435 } ,
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ export function getPortFromUrl(url) {
191191 groups = url . match ( / ^ h t t p s ? : \/ \/ ( [ ^ : ^ / ] * ) : ( \d * ) / ) ;
192192 if ( groups ) {
193193 return groups [ 2 ] ;
194- }
194+ }
195195 if ( type === "http" ) {
196196 return "80" ;
197197 }
@@ -211,11 +211,17 @@ export function getDomainFromUrl (url) {
211211// 构造区域上传url
212212export function getUploadUrl ( config , token ) {
213213 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 ) {
215220 let upHosts = regionUphostMap [ config . region ] ;
216221 let host = config . useCdnDomain ? upHosts . cdnUphost : upHosts . srcUphost ;
217222 return Promise . resolve ( `${ protocol } //${ host } ` ) ;
218- }
223+ }
224+
219225 return getUpHosts ( token )
220226 . then ( res => {
221227 let hosts = res . data . up . acc . main ;
Original file line number Diff line number Diff line change 209209 <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
210210<![endif]-->
211211<!--[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 >
213213<!--<![endif]-->
214214< script src ="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js "> </ script >
215215< 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