diff options
| author | Henry Jameson <me@hjkos.com> | 2018-11-26 05:21:58 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-11-26 05:21:58 +0300 |
| commit | a806d43f05ddded69a00156bc31fe33806426ecb (patch) | |
| tree | afa9a3f43043bbce92739fb48d048605e0c45c2b /src/services/api/api.service.js | |
| parent | 08838774e41b9beba8f884da15ab1314eddf28f8 (diff) | |
| parent | 91272dc5558e1326dac872f927dc8da7f9109cd0 (diff) | |
Merge remote-tracking branch 'upstream/develop' into feature/theming2
* upstream/develop: (60 commits)
whoops
whoops
DM timeline: stream new statuses
update-japanese-translation
Add actual user search.
incorporate most translation changes from MR 368
update french translation
Always show dm panel.
Add direct message tab.
api service url
remove deploy stage
remove deploy stage
updated and completed German translation
On logout switch to public timeline.
minor modification of Chinese translation
update Chinese translation
Add Chinese language
Fix posting.
Put oauth text into description.
Display OAuth login on login form button.
...
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index ab746918..714c0fc7 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -15,6 +15,7 @@ const STATUS_URL = '/api/statuses/show' const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload' const CONVERSATION_URL = '/api/statusnet/conversation' const MENTIONS_URL = '/api/statuses/mentions.json' +const DM_TIMELINE_URL = '/api/statuses/dm_timeline.json' const FOLLOWERS_URL = '/api/statuses/followers.json' const FRIENDS_URL = '/api/statuses/friends.json' const FOLLOWING_URL = '/api/friendships/create.json' @@ -52,16 +53,6 @@ let fetch = (url, options) => { return oldfetch(fullUrl, options) } -// from https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding -let utoa = (str) => { - // first we use encodeURIComponent to get percent-encoded UTF-8, - // then we convert the percent encodings into raw bytes which - // can be fed into btoa. - return btoa(encodeURIComponent(str) - .replace(/%([0-9A-F]{2})/g, - (match, p1) => { return String.fromCharCode('0x' + p1) })) -} - // Params // cropH // cropW @@ -175,9 +166,9 @@ const register = (params) => { }) } -const authHeaders = (user) => { - if (user && user.username && user.password) { - return { 'Authorization': `Basic ${utoa(`${user.username}:${user.password}`)}` } +const authHeaders = (accessToken) => { + if (accessToken) { + return { 'Authorization': `Bearer ${accessToken}` } } else { return { } } @@ -302,6 +293,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use public: PUBLIC_TIMELINE_URL, friends: FRIENDS_TIMELINE_URL, mentions: MENTIONS_URL, + dms: DM_TIMELINE_URL, notifications: QVITTER_USER_NOTIFICATIONS_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, user: QVITTER_USER_TIMELINE_URL, |
