Skip to content

Commit

Permalink
remove hook and add event 'before-send'
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Aug 1, 2018
1 parent c560069 commit b06c2f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -5430,7 +5430,7 @@ function getAuth(params) {
function getObjectUrl(params, callback) {
var self = this;
var url = getUrl({
protocol: self.options.Protocol,
protocol: params.Protocol || self.options.Protocol,
domain: self.options.Domain,
bucket: params.Bucket,
region: params.Region,
Expand Down Expand Up @@ -5589,7 +5589,7 @@ function getAuthorizationAsync(params, callback) {
};

// 先判断是否有临时密钥
if (StsData.ExpiredTime && StsData.ExpiredTime - (Date.now() / 1000 > 60)) {
if (StsData.ExpiredTime && StsData.ExpiredTime - Date.now() / 1000 > 10) {
// 如果缓存的临时密钥有效,并还有超过60秒有效期就直接使用
calcAuthByTmpKey();
} else if (self.options.getAuthorization) {
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cos-js-sdk-v5",
"version": "0.4.10",
"version": "0.4.11",
"description": "cos js sdk v5",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ function getAuth(params) {
function getObjectUrl(params, callback) {
var self = this;
var url = getUrl({
protocol: self.options.Protocol,
protocol: params.Protocol || self.options.Protocol,
domain: self.options.Domain,
bucket: params.Bucket,
region: params.Region,
Expand Down Expand Up @@ -1793,7 +1793,7 @@ function getAuthorizationAsync(params, callback) {
};

// 先判断是否有临时密钥
if (StsData.ExpiredTime && StsData.ExpiredTime - (Date.now() / 1000 > 60)) { // 如果缓存的临时密钥有效,并还有超过60秒有效期就直接使用
if (StsData.ExpiredTime && StsData.ExpiredTime - (Date.now() / 1000) > 10) { // 如果缓存的临时密钥有效,并还有超过60秒有效期就直接使用
calcAuthByTmpKey();
} else if (self.options.getAuthorization) { // 外部计算签名或获取临时密钥
self.options.getAuthorization.call(self, {
Expand Down

0 comments on commit b06c2f9

Please sign in to comment.