aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-25 17:44:19 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-25 17:44:19 +0200
commit0a381679e04bc7adf097da9a6fb4e2c8f41bbda2 (patch)
tree02c6745db0cc36517ceffad3bee129f833fd3341
parentd58cdea854904369c2dcce905ce42f4f6db836a8 (diff)
downloadPeerTube-0a381679e04bc7adf097da9a6fb4e2c8f41bbda2.tar.gz
PeerTube-0a381679e04bc7adf097da9a6fb4e2c8f41bbda2.tar.zst
PeerTube-0a381679e04bc7adf097da9a6fb4e2c8f41bbda2.zip
ClientLocal -> OAuthClientLocal
-rw-r--r--client/src/app/core/auth/auth.service.ts6
-rw-r--r--server/controllers/api/index.ts4
-rw-r--r--server/controllers/api/oauth-clients.ts (renamed from server/controllers/api/clients.ts)10
-rw-r--r--shared/models/index.ts2
-rw-r--r--shared/models/oauth-client-local.model.ts (renamed from shared/models/client-local.model.ts)2
5 files changed, 12 insertions, 12 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index fcc6b9bb6..d5aa80512 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -11,13 +11,13 @@ import { NotificationsService } from 'angular2-notifications'
11 11
12import { AuthStatus } from './auth-status.model' 12import { AuthStatus } from './auth-status.model'
13import { AuthUser } from './auth-user.model' 13import { AuthUser } from './auth-user.model'
14import { ClientLocal } from '../../../../../shared' 14import { OAuthClientLocal } from '../../../../../shared'
15// Do not use the barrel (dependency loop) 15// Do not use the barrel (dependency loop)
16import { RestExtractor } from '../../shared/rest' 16import { RestExtractor } from '../../shared/rest'
17 17
18@Injectable() 18@Injectable()
19export class AuthService { 19export class AuthService {
20 private static BASE_CLIENT_URL = API_URL + '/api/v1/clients/local' 20 private static BASE_CLIENT_URL = API_URL + '/api/v1/oauth-clients/local'
21 private static BASE_TOKEN_URL = API_URL + '/api/v1/users/token' 21 private static BASE_TOKEN_URL = API_URL + '/api/v1/users/token'
22 private static BASE_USER_INFORMATIONS_URL = API_URL + '/api/v1/users/me' 22 private static BASE_USER_INFORMATIONS_URL = API_URL + '/api/v1/users/me'
23 23
@@ -43,7 +43,7 @@ export class AuthService {
43 .map(this.restExtractor.extractDataGet) 43 .map(this.restExtractor.extractDataGet)
44 .catch(res => this.restExtractor.handleError(res)) 44 .catch(res => this.restExtractor.handleError(res))
45 .subscribe( 45 .subscribe(
46 (result: ClientLocal) => { 46 (result: OAuthClientLocal) => {
47 this.clientId = result.client_id 47 this.clientId = result.client_id
48 this.clientSecret = result.client_secret 48 this.clientSecret = result.client_secret
49 console.log('Client credentials loaded.') 49 console.log('Client credentials loaded.')
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts
index 3abe9bcf8..a9205b33c 100644
--- a/server/controllers/api/index.ts
+++ b/server/controllers/api/index.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2 2
3import { badRequest } from '../../helpers' 3import { badRequest } from '../../helpers'
4 4
5import { clientsRouter } from './clients' 5import { oauthClientsRouter } from './oauth-clients'
6import { configRouter } from './config' 6import { configRouter } from './config'
7import { podsRouter } from './pods' 7import { podsRouter } from './pods'
8import { remoteRouter } from './remote' 8import { remoteRouter } from './remote'
@@ -12,7 +12,7 @@ import { videosRouter } from './videos'
12 12
13const apiRouter = express.Router() 13const apiRouter = express.Router()
14 14
15apiRouter.use('/clients', clientsRouter) 15apiRouter.use('/oauth-clients', oauthClientsRouter)
16apiRouter.use('/config', configRouter) 16apiRouter.use('/config', configRouter)
17apiRouter.use('/pods', podsRouter) 17apiRouter.use('/pods', podsRouter)
18apiRouter.use('/remote', remoteRouter) 18apiRouter.use('/remote', remoteRouter)
diff --git a/server/controllers/api/clients.ts b/server/controllers/api/oauth-clients.ts
index 96490d04a..b9bc0534f 100644
--- a/server/controllers/api/clients.ts
+++ b/server/controllers/api/oauth-clients.ts
@@ -3,11 +3,11 @@ import * as express from 'express'
3import { CONFIG } from '../../initializers' 3import { CONFIG } from '../../initializers'
4import { logger } from '../../helpers' 4import { logger } from '../../helpers'
5import { database as db } from '../../initializers/database' 5import { database as db } from '../../initializers/database'
6import { ClientLocal } from '../../../shared' 6import { OAuthClientLocal } from '../../../shared'
7 7
8const clientsRouter = express.Router() 8const oauthClientsRouter = express.Router()
9 9
10clientsRouter.get('/local', getLocalClient) 10oauthClientsRouter.get('/local', getLocalClient)
11 11
12// Get the client credentials for the PeerTube front end 12// Get the client credentials for the PeerTube front end
13function getLocalClient (req: express.Request, res: express.Response, next: express.NextFunction) { 13function getLocalClient (req: express.Request, res: express.Response, next: express.NextFunction) {
@@ -28,7 +28,7 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
28 if (err) return next(err) 28 if (err) return next(err)
29 if (!client) return next(new Error('No client available.')) 29 if (!client) return next(new Error('No client available.'))
30 30
31 const json: ClientLocal = { 31 const json: OAuthClientLocal = {
32 client_id: client.clientId, 32 client_id: client.clientId,
33 client_secret: client.clientSecret 33 client_secret: client.clientSecret
34 } 34 }
@@ -39,5 +39,5 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
39// --------------------------------------------------------------------------- 39// ---------------------------------------------------------------------------
40 40
41export { 41export {
42 clientsRouter 42 oauthClientsRouter
43} 43}
diff --git a/shared/models/index.ts b/shared/models/index.ts
index fffac795e..95d95ab47 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -1,5 +1,5 @@
1export * from './client-local.model'
2export * from './job.model' 1export * from './job.model'
2export * from './oauth-client-local.model'
3export * from './pod.model' 3export * from './pod.model'
4export * from './request-scheduler.model' 4export * from './request-scheduler.model'
5export * from './user-video-rate.model' 5export * from './user-video-rate.model'
diff --git a/shared/models/client-local.model.ts b/shared/models/oauth-client-local.model.ts
index c27963e88..0c6ce6c5d 100644
--- a/shared/models/client-local.model.ts
+++ b/shared/models/oauth-client-local.model.ts
@@ -1,4 +1,4 @@
1export interface ClientLocal { 1export interface OAuthClientLocal {
2 client_id: string 2 client_id: string
3 client_secret: string 3 client_secret: string
4} 4}