@waline/vercel 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waline/vercel",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "vercel server for waline comment system",
5
5
  "repository": "https://github.com/walinejs/waline",
6
6
  "license": "MIT",
@@ -12,10 +12,12 @@ module.exports = class extends think.Controller {
12
12
  }
13
13
 
14
14
  async indexAction() {
15
- const { code, type, redirect } = this.get();
15
+ const { code, oauth_verifier, oauth_token, type, redirect } = this.get();
16
16
  const { oauthUrl } = this.config();
17
17
 
18
- if (!code) {
18
+ const hasCode =
19
+ type === 'twitter' ? oauth_token && oauth_verifier : Boolean(code);
20
+ if (!hasCode) {
19
21
  const { protocol, host } = this.ctx;
20
22
  const redirectUrl = `${protocol}://${host}/oauth?${qs.stringify({
21
23
  redirect,
@@ -29,7 +31,7 @@ module.exports = class extends think.Controller {
29
31
  /**
30
32
  * user = { id, name, email, avatar,url };
31
33
  */
32
- const params = { code };
34
+ const params = { code, oauth_verifier, oauth_token };
33
35
  if (type === 'facebook') {
34
36
  const { protocol, host } = this.ctx;
35
37
  const redirectUrl = `${protocol}://${host}/oauth?${qs.stringify({
@@ -2,9 +2,9 @@ const Base = require('./base');
2
2
 
3
3
  module.exports = class extends Base {
4
4
  /**
5
- * @api {GET} /oauth/github github oauth api
5
+ * @api {GET} /oauth oauth api
6
6
  * @apiGroup OAuth
7
7
  * @apiVersion 0.0.1
8
8
  */
9
- githubAction() {}
9
+ indexAction() {}
10
10
  };