Skip to content

Commit f9e3b4a

Browse files
committed
Merge pull request #111 from qiniu/develop
Release 6.1.5
2 parents 580ba7b + d9d6f49 commit f9e3b4a

File tree

10 files changed

+51
-29
lines changed

10 files changed

+51
-29
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
language: node_js
22
node_js:
33
- 0.10
4-
- 0.8
5-
- 0.6
64
before_script:
7-
- export QINIU_ACCESS_KEY="nnwjTeUgpQdfZp9cb4-iHK0EUlebKCNk4kXwoStq"
8-
- export QINIU_SECRET_KEY="Ia9pXC-XEcGF6hvu1V5fdRhwFLpeUkCbt0Gxk5NW"
9-
- export QINIU_TEST_BUCKET="test741"
10-
- export QINIU_TEST_DOMAIN="test741.qiniudn.com"
5+
- export QINIU_ACCESS_KEY=QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm
6+
- export QINIU_SECRET_KEY=Bxckh6FA-Fbs9Yt3i3cbKVK22UPBmAOHJcL95pGz
7+
- export QINIU_TEST_BUCKET="nodesdk"
8+
- export QINIU_TEST_DOMAIN="nodesdk.qiniudn.com"

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
## CHANGE LOG
22

3+
### v6.1.5
4+
5+
2014-7-23 issue [#111](https://github.com/qiniu/nodejs-sdk/pull/111)
6+
7+
- [#109] 统一user agent
8+
- [#110] 更新put policy
9+
10+
### v6.1.4
11+
12+
2014-7-10 issue [#108](https://github.com/qiniu/nodejs-sdk/pull/108)
13+
14+
- [#107] 调整上传host
15+
16+
317
### v6.1.3
418

519
2014-4-03 issue [#102](https://github.com/qiniu/nodejs-sdk/pull/102)

gopher.png

5.46 KB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qiniu",
3-
"version": "6.1.3",
3+
"version": "6.1.5",
44
"description": "Node wrapper for Qiniu Resource (Cloud) Storage API",
55
"main": "index.js",
66
"directories": {

qiniu/conf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
var fs = require('fs');
2+
var path = require('path');
3+
var os = require('os');
14

25
exports.ACCESS_KEY = '<PLEASE APPLY YOUR ACCESS KEY>';
36
exports.SECRET_KEY = '<DONT SEND YOUR SECRET KEY TO ANYONE>';
47

5-
exports.USER_AGENT = 'qiniu nodejs-sdk v6.1.3';
8+
var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../', 'package.json')));
9+
var ua = function(){
10+
return 'QiniuNodejs/' + pkg.version + ' (' + os.type() + '; ' + os.platform() + '; ' + os.arch() + '; )';
11+
}
12+
13+
exports.USER_AGENT = ua();
614

715
exports.UP_HOST = 'http://upload.qiniu.com';
816
exports.RS_HOST = 'http://rs.qbox.me';

qiniu/rs.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ function getEncodedEntryUri(bucket, key) {
136136
// ----- token --------
137137
// @gist PutPolicy
138138
function PutPolicy(scope, callbackUrl, callbackBody, returnUrl, returnBody,
139-
asyncOps, endUser, expires) {
139+
asyncOps, endUser, expires, persistentOps, persistentNotifyUrl) {
140140
this.scope = scope || null;
141141
this.callbackUrl = callbackUrl || null;
142142
this.callbackBody = callbackBody || null;
143143
this.returnUrl = returnUrl || null;
144144
this.returnBody = returnBody || null;
145-
this.asyncOps = asyncOps || null;
146145
this.endUser = endUser || null;
147146
this.expires = expires || 3600;
147+
this.persistentOps = persistentOps || null;
148+
this.persistentNotifyUrl = persistentNotifyUrl || null;
148149
}
149150
// @endgist
150151

@@ -177,9 +178,6 @@ PutPolicy.prototype.getFlags = function(putPolicy) {
177178
if (this.returnBody != null) {
178179
flags['returnBody'] = this.returnBody;
179180
}
180-
if (this.asyncOps != null) {
181-
flags['asyncOps'] = this.asyncOps;
182-
}
183181
if (this.endUser != null) {
184182
flags['endUser'] = this.endUser;
185183
}
@@ -189,11 +187,25 @@ PutPolicy.prototype.getFlags = function(putPolicy) {
189187
if (this.persistentNotifyUrl != null) {
190188
flags['persistentNotifyUrl'] = this.persistentNotifyUrl;
191189
}
190+
if (this.persistentPipeline != null) {
191+
flags['persistentPipeline'] = this.persistentPipeline;
192+
}
193+
if (this.mimeLimit != null) {
194+
flags['mimeLimit'] = this.mimeLimit;
195+
}
196+
if (this.insertOnly != null) {
197+
flags['insertOnly'] = this.insertOnly;
198+
}
199+
if (this.detectMime != null) {
200+
flags['detectMime'] = this.detectMime;
201+
}
202+
if (this.saveKey != null) {
203+
flags['saveKey'] = this.saveKey;
204+
}
192205
flags['deadline'] = this.expires + Math.floor(Date.now() / 1000);
193206
return flags;
194207
}
195208

196-
197209
function GetPolicy(expires) {
198210
this.expires = expires || 3600;
199211
}

qiniu/util.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ exports.generateAccessToken = function(uri, body) {
4545
}
4646

4747
function isQiniuCallback(path, body, callbackAuth) {
48-
49-
var auth = exports.generateAccessToken(path, body)
48+
var auth = exports.generateAccessToken(path, body);
5049
return auth === callbackAuth;
5150
}

test/fop.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var fop = require('../').fop;
22

33
describe('test start step 0', function() {
44
describe('fop.js', function() {
5-
var pic = 'http://test963.qiniudn.com/logo.png';
5+
var pic = 'http://private-res.qiniudn.com/gogopher.jpg';
66

77
describe('fop.Exif#makeRequest()', function() {
88
it('test makeRequest', function(done) {

test/logo.png

4.36 KB
Loading

test/rs.test.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('test start step2:', function() {
8888
describe('rs.Client#batchStat()', function() {
8989
it('get the stat of logo.png and logo2.png', function(done) {
9090
var entries = [
91-
new EntryPath(TEST_BUCKET, logo),
91+
new EntryPath(TEST_BUCKET, logo),
9292
new EntryPath(TEST_BUCKET, logo2)];
9393

9494
client.batchStat(entries, function(err, ret) {
@@ -105,7 +105,7 @@ describe('test start step2:', function() {
105105
it('should return code 298 when partial ok', function(done) {
106106

107107
var entries = [
108-
new EntryPath(TEST_BUCKET, logo),
108+
new EntryPath(TEST_BUCKET, logo),
109109
new EntryPath(TEST_BUCKET, 'not exist file')];
110110

111111
client.batchStat(entries, function(err, ret) {
@@ -167,23 +167,14 @@ describe('test start step2:', function() {
167167
describe('rs.isQiniuCallBack', function() {
168168

169169
it('test isQiniuCallback true', function(done) {
170-
// @gist isQiniuCallback
171-
// ------ auth应该是来自请求的header的'Authrization'字段,path是请求的路径,content是请求的内容
172-
var auth = 'QBox nnwjTeUgpQdfZp9cb4-iHK0EUlebKCNk4kXwoStq:kyFuG6yYh6FlX1fZO0alTgJK2Jw=';
170+
var auth = 'QBox QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm:4GcOC2_eiw97QBNsHiwLzSqxelI=';
173171
var path = '/callback';
174172
var content = 'key=43850.6579994258936495&hash=FllOJrhvzorEKnyMwE-o7pfciiha';
175-
// ------
176-
177173
var ok = qiniu.util.isQiniuCallback(path, content, auth);
178174
ok.should.be.ok;
179-
// @endgist
180175
done();
181176
});
182-
183-
184177
});
185178

186-
// rs.GetPolicy#makeRequest()
187-
188179
});
189180
});

0 commit comments

Comments
 (0)