Skip to content

Commit 0a3a323

Browse files
committed
AV._useMasterKey -> AV._config.isUseMasterKey
1 parent 6757218 commit 0a3a323

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

src/utils.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ module.exports = function(AV) {
2424
region: 'cn',
2525

2626
// 服务器的 URL,默认初始化时被设置为大陆节点地址
27-
apiServerUrl: AVConfig.apiServerUrl || ''
27+
apiServerUrl: AVConfig.apiServerUrl || '',
28+
29+
// 当前是否为 nodejs 环境
30+
isNode: false,
31+
32+
// 是否启用 masterKey
33+
isUseMasterKey: false
2834
});
2935

3036
/**
@@ -105,7 +111,6 @@ module.exports = function(AV) {
105111
AV.applicationId = appId;
106112
AV.applicationKey = appKey;
107113
AV.masterKey = masterKey;
108-
AV._useMasterKey = false;
109114
};
110115

111116
const setRegionServer = (region) => {
@@ -172,7 +177,7 @@ module.exports = function(AV) {
172177
* </p>
173178
*/
174179
AV.Cloud.useMasterKey = function() {
175-
AV._useMasterKey = true;
180+
AVConfig.isUseMasterKey = true;
176181
};
177182
}
178183

@@ -380,7 +385,7 @@ module.exports = function(AV) {
380385
if(!AV._isNullOrUndefined(AV.applicationProduction)) {
381386
dataObject._ApplicationProduction = AV.applicationProduction;
382387
}
383-
if(AV._useMasterKey)
388+
if(AVConfig.isUseMasterKey)
384389
dataObject._MasterKey = AV.masterKey;
385390
dataObject._ClientVersion = AV.VERSION;
386391
// Pass the session token on every request.

test/cloud.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ describe("AV.Cloud", function() {
77
originalServerURL = AV._config.apiServerUrl;
88
originalAppId = AV.applicationId;
99
originalAppKey = AV.applicationKey;
10-
originalUseMasterKey = AV._useMasterKey;
10+
originalUseMasterKey = AV._config.isUseMasterKey;
1111

1212
AV._config.apiServerUrl = 'https://leancloud.cn'
1313
AV.applicationId = '4h2h4okwiyn8b6cle0oig00vitayum8ephrlsvg7xo8o19ne';
1414
AV.applicationKey = '3xjj1qw91cr3ygjq9lt0g8c3qpet38rrxtwmmp0yffyoy2t4';
15-
AV._useMasterKey = false;
15+
AV._config.isUseMasterKey = false;
1616

1717
AV.User._currentUser = null;
1818
});
@@ -119,6 +119,6 @@ describe("AV.Cloud", function() {
119119
AV._config.apiServerUrl = originalServerURL;
120120
AV.applicationId = originalAppId;
121121
AV.applicationKey = originalAppKey;
122-
AV._useMasterKey = originalUseMasterKey;
122+
AV._config.isUseMasterKey = originalUseMasterKey;
123123
});
124124
});

test/file_blob.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
function upload (){
7070
AV._config.apiServerUrl="https://cn-stg1.avoscloud.com";
7171
AV.init('mxrb5nn3qz7drek0etojy5lh4yrwjnk485lqajnsgjwfxrb5', 'd7sbus0d81mrum4tko4t8gl74b27vl0rh762ff7ngrb6ymmq', 'l0n9wu3kwnrtf2cg1b6w2l87nphzpypgff6240d0lxui2mm4');
72-
AV._useMasterKey = true;
72+
AV._config.isUseMasterKey = true;
7373
AV.setProduction(true);
7474

7575
var name = "photo.png";

test/file_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
function upload (){
1919
AV._config.apiServerUrl="https://cn.avoscloud.com";
2020
AV.init('u8d277gijfac1ysldfyb92zn9fwhxsiecjs3wnrnj4yi7i00', 'nblwmv06uzbjp170pm1zw3umhrbhs75wp6djgutcglh5sopr', 'c2cbbq9fnrewpvtwm7lm25exs62hk0tnkmbs4q16c4podmdc');
21-
AV._useMasterKey = true;
21+
AV._config.isUseMasterKey = true;
2222

2323
var fileUploadControl = document.getElementById ('profilePhotoFileUpload');
2424
console.log(fileUploadControl);

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ AV.init({
1414
masterKey: 'l0n9wu3kwnrtf2cg1b6w2l87nphzpypgff6240d0lxui2mm4'
1515
});
1616
AV.setProduction(true);
17-
AV._useMasterKey = true;
17+
AV._config.isUseMasterKey = true;

0 commit comments

Comments
 (0)