Skip to content

Commit

Permalink
review update
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjcw committed May 21, 2015
1 parent 20eab0f commit 8166b13
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 200 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -2,20 +2,20 @@

LeanEngine Node.js SDK

## Install
## 安装

```bash
npm install leanengine-sdk
```

## Document
## 文档

Guide: [https://leancloud.cn/docs/leanengine_guide-node.htm](https://leancloud.cn/docs/leanengine_guide-node.htm)
开发指南: [https://leancloud.cn/docs/leanengine_guide-node.htm](https://leancloud.cn/docs/leanengine_guide-node.htm)

Demo: [https://github.com/leancloud/node-js-getting-started](https://github.com/leancloud/node-js-getting-started)
示例: [https://github.com/leancloud/node-js-getting-started](https://github.com/leancloud/node-js-getting-started)

## License
## 许可协议

License: MIT
许可协议: MIT

Author: wchen (wchen@leancloud.rocks)
作者: wchen (wchen@leancloud.rocks)
10 changes: 5 additions & 5 deletions lib/av-extra.js
@@ -1,5 +1,6 @@
var AV = require('avoscloud-sdk').AV;
var debug = require('debug')('AV:LeanEngine');
var version = require('../package.json').version;

// 调用 API 时增加 prod 信息
if (!AV._old_request) {
Expand All @@ -24,15 +25,14 @@ AV.User.logOut = function() {
currentUser._isCurrentUser = false;
process.domain._currentUser = null;
}
} else {
console.error("AV.User.logOut 出现问题:没有 domain 环境,请联系技术支持。");
}
};

// 重写 User.current 方法,因为云代码的 currentUser 是保存在 process.domain 中
AV.User.current = function() {
if (process.domain) {
return process.domain._currentUser;
}
return null;
return process.domain && process.domain._currentUser;
};

// 重写 User._saveCurrentUser 方法,因为云代码的 currentUser 是保存在 process.domain 中
Expand Down Expand Up @@ -96,7 +96,7 @@ AV._ajax = function(method, url, data, success, error) {
if (AV._isNode) {
// Add a special user agent just for request from node.js.
xhr.setRequestHeader("User-Agent",
"AVOS Cloud Code Node 2.1");
"AVOS Cloud Code Node " + version);
}
xhr.send(data);
return promise._thenRunCallbacks(options);
Expand Down
4 changes: 0 additions & 4 deletions lib/avosExpressCookieSession/index.js
Expand Up @@ -26,10 +26,6 @@

if (!keys && opts.signed) throw new Error('.keys required for avos cookie sessions.');

if (!opts.fetchUser) {
opts.fetchUser = false;
}

debug('session options %j', opts);

return function cookieSession(req, res, next) {
Expand Down

0 comments on commit 8166b13

Please sign in to comment.