refs #317 Use forked repository for mastodon-api, and set website url when register application

This commit is contained in:
AkiraFukushima 2018-05-19 16:41:44 +09:00
parent 9b628eb504
commit 07cddf48b9
3 changed files with 16 additions and 12 deletions

16
package-lock.json generated
View File

@ -7583,7 +7583,7 @@
"resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz",
"integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==",
"requires": {
"sparkles": "1.0.0"
"sparkles": "1.0.1"
}
},
"got": {
@ -7757,7 +7757,7 @@
},
"onetime": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
"integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k="
},
"pluralize": {
@ -8070,7 +8070,7 @@
"resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz",
"integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=",
"requires": {
"sparkles": "1.0.0"
"sparkles": "1.0.1"
}
},
"has-unicode": {
@ -10593,9 +10593,7 @@
}
},
"mastodon-api": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/mastodon-api/-/mastodon-api-1.3.0.tgz",
"integrity": "sha1-s7z/z1HgBfdUt+huRMICPY4sY9E=",
"version": "github:h3poteto/mastodon-api#c567f019c8f1ffa19b21d73be183c9ceedac4d78",
"requires": {
"gulp-eslint": "3.0.1",
"mime": "1.6.0",
@ -15005,9 +15003,9 @@
"dev": true
},
"sparkles": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz",
"integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz",
"integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw=="
},
"spdx-correct": {
"version": "3.0.0",

View File

@ -95,7 +95,7 @@
"hawk": "^7.0.7",
"hoek": "^5.0.3",
"is-empty": "^1.2.0",
"mastodon-api": "^1.3.0",
"mastodon-api": "github:h3poteto/mastodon-api#lib",
"moment": "^2.21.0",
"nedb": "^1.8.0",
"object-assign-deep": "^0.4.0",

View File

@ -1,6 +1,7 @@
import Mastodon from 'mastodon-api'
const appName = 'Whalebird'
const appURL = 'https://whalebird.org'
const scope = 'read write follow'
export default class Authentication {
@ -22,8 +23,13 @@ export default class Authentication {
async getAuthorizationUrl (domain = 'mastodon.social') {
this.setOtherInstance(domain)
// Waiting for merge this pull request: https://github.com/vanita5/mastodon-api/pull/8
const res = await Mastodon.createOAuthApp(this.baseURL + '/api/v1/apps', appName, scope)
const res = await Mastodon.createOAuthApp(
this.baseURL + '/api/v1/apps',
appName,
scope,
'urn:ietf:wg:oauth:2.0:oob',
appURL
)
this.clientId = res.client_id
this.clientSecret = res.client_secret