@@ -373,19 +373,21 @@ function changeTypeReq(mac, config, bucket, key, newType, callbackFunc) {
373373) ;
374374}
375375
376- // 设置空间镜像源
377- //@link https://developer.qiniu.com/kodo/api/1370/mirror
378- //@param bucket 空间名称
379- //@param srcSiteUrl 镜像源地址
380- //@param srcHost 镜像Host
381- //@param callbackFunc(err, respBody, respInfo) 回调函数
382- const PU_HOST = 'http://pu.qbox.me:10200' ;
376+ /**
377+ * 设置空间镜像源
378+ *@link https://developer.qiniu.com/kodo/3966/bucket-image-source
379+ *@param {string } bucket 空间名称
380+ *@param {string } srcSiteUrl 镜像源地址
381+ *@param {string } srcHost 镜像Host
382+ *@param {function(err: error, respBody: object, respInfo: object) } callbackFunc 回调函数
383+ */
383384BucketManager . prototype . image = function ( bucket , srcSiteUrl , srcHost ,
384385callbackFunc ) {
385- var encodedSrcSite = util . urlsafeBase64Encode ( srcSiteUrl ) ;
386- var requestURI = PU_HOST + '/image/' + bucket + '/from/' + encodedSrcSite ;
386+ const encodedSrcSite = util . urlsafeBase64Encode ( srcSiteUrl ) ;
387+ const scheme = this . config . useHttpsDomain ?'https://' :'http://' ;
388+ let requestURI = scheme + conf . UC_HOST + '/image/' + bucket + '/from/' + encodedSrcSite ;
387389if ( srcHost ) {
388- var encodedHost = util . urlsafeBase64Encode ( srcHost ) ;
390+ const encodedHost = util . urlsafeBase64Encode ( srcHost ) ;
389391requestURI += '/host/' + encodedHost ;
390392}
391393rpc . postWithOptions (
@@ -398,13 +400,15 @@ BucketManager.prototype.image = function (bucket, srcSiteUrl, srcHost,
398400) ;
399401} ;
400402
401- // 取消设置空间镜像源
402- //@link https://developer.qiniu.com/kodo/api/1370/mirror
403- //@param bucket 空间名称
404- //@param callbackFunc(err, respBody, respInfo) 回调函数
403+ /**
404+ * 取消设置空间镜像源
405+ *@param {string } bucket 空间名称
406+ *@param {function(err: error, respBody: object, respInfo: object) } callbackFunc 回调函数
407+ */
405408BucketManager . prototype . unimage = function ( bucket , callbackFunc ) {
406- var requestURI = PU_HOST + '/unimage/' + bucket ;
407- var digest = util . generateAccessTokenV2 ( this . mac , requestURI , 'POST' , 'application/x-www-form-urlencoded' ) ;
409+ const scheme = this . config . useHttpsDomain ?'https://' :'http://' ;
410+ const requestURI = scheme + conf . UC_HOST + '/unimage/' + bucket ;
411+ const digest = util . generateAccessTokenV2 ( this . mac , requestURI , 'POST' , 'application/x-www-form-urlencoded' ) ;
408412rpc . postWithoutForm ( requestURI , digest , callbackFunc ) ;
409413} ;
410414