diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-08-13 15:07:23 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 11:07:56 +0100 |
commit | afff310e50f2fa8419bb4242470cbde46ab54463 (patch) | |
tree | 34efda2daf8f7cdfd89ef6616a79e2222082f93a /shared | |
parent | f619de0e435f7ac3abad2ec772397486358b56e7 (diff) | |
download | PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.tar.gz PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.tar.zst PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.zip |
allow private syndication feeds via a user feedToken
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/users/users.ts | 14 | ||||
-rw-r--r-- | shared/models/users/user-scoped-token.ts | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts index 9f193680d..4d0986ce3 100644 --- a/shared/extra-utils/users/users.ts +++ b/shared/extra-utils/users/users.ts | |||
@@ -109,6 +109,17 @@ function getMyUserInformation (url: string, accessToken: string, specialStatus = | |||
109 | .expect('Content-Type', /json/) | 109 | .expect('Content-Type', /json/) |
110 | } | 110 | } |
111 | 111 | ||
112 | function getUserScopedTokens (url: string, accessToken: string, specialStatus = 200) { | ||
113 | const path = '/api/v1/users/scoped-tokens' | ||
114 | |||
115 | return request(url) | ||
116 | .get(path) | ||
117 | .set('Accept', 'application/json') | ||
118 | .set('Authorization', 'Bearer ' + accessToken) | ||
119 | .expect(specialStatus) | ||
120 | .expect('Content-Type', /json/) | ||
121 | } | ||
122 | |||
112 | function deleteMe (url: string, accessToken: string, specialStatus = 204) { | 123 | function deleteMe (url: string, accessToken: string, specialStatus = 204) { |
113 | const path = '/api/v1/users/me' | 124 | const path = '/api/v1/users/me' |
114 | 125 | ||
@@ -351,5 +362,6 @@ export { | |||
351 | updateMyAvatar, | 362 | updateMyAvatar, |
352 | askSendVerifyEmail, | 363 | askSendVerifyEmail, |
353 | generateUserAccessToken, | 364 | generateUserAccessToken, |
354 | verifyEmail | 365 | verifyEmail, |
366 | getUserScopedTokens | ||
355 | } | 367 | } |
diff --git a/shared/models/users/user-scoped-token.ts b/shared/models/users/user-scoped-token.ts new file mode 100644 index 000000000..f9d9b0a8b --- /dev/null +++ b/shared/models/users/user-scoped-token.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export type ScopedTokenType = 'feedToken' | ||
2 | |||
3 | export type ScopedToken = { | ||
4 | feedToken: string | ||
5 | } | ||