diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/friends.ts | 10 | ||||
-rw-r--r-- | server/lib/oauth-model.ts | 7 |
2 files changed, 9 insertions, 8 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts index 4d56e9eb2..a65820191 100644 --- a/server/lib/friends.ts +++ b/server/lib/friends.ts | |||
@@ -38,7 +38,9 @@ import { | |||
38 | RemoteVideoCreateData, | 38 | RemoteVideoCreateData, |
39 | RemoteVideoUpdateData, | 39 | RemoteVideoUpdateData, |
40 | RemoteVideoRemoveData, | 40 | RemoteVideoRemoveData, |
41 | RemoteVideoReportAbuseData | 41 | RemoteVideoReportAbuseData, |
42 | ResultList, | ||
43 | Pod as FormatedPod | ||
42 | } from '../../shared' | 44 | } from '../../shared' |
43 | 45 | ||
44 | type QaduParam = { videoId: string, type: RequestVideoQaduType } | 46 | type QaduParam = { videoId: string, type: RequestVideoQaduType } |
@@ -268,8 +270,8 @@ export { | |||
268 | 270 | ||
269 | function computeForeignPodsList (host: string, podsScore: { [ host: string ]: number }) { | 271 | function computeForeignPodsList (host: string, podsScore: { [ host: string ]: number }) { |
270 | // TODO: type res | 272 | // TODO: type res |
271 | return getForeignPodsList(host).then((res: any) => { | 273 | return getForeignPodsList(host).then(res => { |
272 | const foreignPodsList = res.data | 274 | const foreignPodsList: { host: string }[] = res.data |
273 | 275 | ||
274 | // Let's give 1 point to the pod we ask the friends list | 276 | // Let's give 1 point to the pod we ask the friends list |
275 | foreignPodsList.push({ host }) | 277 | foreignPodsList.push({ host }) |
@@ -302,7 +304,7 @@ function computeWinningPods (hosts: string[], podsScore: { [ host: string ]: num | |||
302 | } | 304 | } |
303 | 305 | ||
304 | function getForeignPodsList (host: string) { | 306 | function getForeignPodsList (host: string) { |
305 | return new Promise((res, rej) => { | 307 | return new Promise< ResultList<FormatedPod> >((res, rej) => { |
306 | const path = '/api/' + API_VERSION + '/pods' | 308 | const path = '/api/' + API_VERSION + '/pods' |
307 | 309 | ||
308 | request.get(REMOTE_SCHEME.HTTP + '://' + host + path, function (err, response, body) { | 310 | request.get(REMOTE_SCHEME.HTTP + '://' + host + path, function (err, response, body) { |
diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index f34c9c667..2d7e56756 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts | |||
@@ -68,11 +68,10 @@ function saveToken (token: TokenInfo, client: OAuthClientInstance, user: UserIns | |||
68 | userId: user.id | 68 | userId: user.id |
69 | } | 69 | } |
70 | 70 | ||
71 | return db.OAuthToken.create(tokenToCreate).then(function (tokenCreated: any) { | 71 | return db.OAuthToken.create(tokenToCreate).then(tokenCreated => { |
72 | tokenCreated.client = client | 72 | const tokenToReturn = Object.assign(tokenCreated, { client, user }) |
73 | tokenCreated.user = user | ||
74 | 73 | ||
75 | return tokenCreated | 74 | return tokenToReturn |
76 | }) | 75 | }) |
77 | } | 76 | } |
78 | 77 | ||