mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-22 08:46:54 -06:00
ClientLocal -> OAuthClientLocal
This commit is contained in:
parent
d58cdea854
commit
0a381679e0
@ -11,13 +11,13 @@ import { NotificationsService } from 'angular2-notifications'
|
||||
|
||||
import { AuthStatus } from './auth-status.model'
|
||||
import { AuthUser } from './auth-user.model'
|
||||
import { ClientLocal } from '../../../../../shared'
|
||||
import { OAuthClientLocal } from '../../../../../shared'
|
||||
// Do not use the barrel (dependency loop)
|
||||
import { RestExtractor } from '../../shared/rest'
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
private static BASE_CLIENT_URL = API_URL + '/api/v1/clients/local'
|
||||
private static BASE_CLIENT_URL = API_URL + '/api/v1/oauth-clients/local'
|
||||
private static BASE_TOKEN_URL = API_URL + '/api/v1/users/token'
|
||||
private static BASE_USER_INFORMATIONS_URL = API_URL + '/api/v1/users/me'
|
||||
|
||||
@ -43,7 +43,7 @@ export class AuthService {
|
||||
.map(this.restExtractor.extractDataGet)
|
||||
.catch(res => this.restExtractor.handleError(res))
|
||||
.subscribe(
|
||||
(result: ClientLocal) => {
|
||||
(result: OAuthClientLocal) => {
|
||||
this.clientId = result.client_id
|
||||
this.clientSecret = result.client_secret
|
||||
console.log('Client credentials loaded.')
|
||||
|
@ -2,7 +2,7 @@ import * as express from 'express'
|
||||
|
||||
import { badRequest } from '../../helpers'
|
||||
|
||||
import { clientsRouter } from './clients'
|
||||
import { oauthClientsRouter } from './oauth-clients'
|
||||
import { configRouter } from './config'
|
||||
import { podsRouter } from './pods'
|
||||
import { remoteRouter } from './remote'
|
||||
@ -12,7 +12,7 @@ import { videosRouter } from './videos'
|
||||
|
||||
const apiRouter = express.Router()
|
||||
|
||||
apiRouter.use('/clients', clientsRouter)
|
||||
apiRouter.use('/oauth-clients', oauthClientsRouter)
|
||||
apiRouter.use('/config', configRouter)
|
||||
apiRouter.use('/pods', podsRouter)
|
||||
apiRouter.use('/remote', remoteRouter)
|
||||
|
@ -3,11 +3,11 @@ import * as express from 'express'
|
||||
import { CONFIG } from '../../initializers'
|
||||
import { logger } from '../../helpers'
|
||||
import { database as db } from '../../initializers/database'
|
||||
import { ClientLocal } from '../../../shared'
|
||||
import { OAuthClientLocal } from '../../../shared'
|
||||
|
||||
const clientsRouter = express.Router()
|
||||
const oauthClientsRouter = express.Router()
|
||||
|
||||
clientsRouter.get('/local', getLocalClient)
|
||||
oauthClientsRouter.get('/local', getLocalClient)
|
||||
|
||||
// Get the client credentials for the PeerTube front end
|
||||
function getLocalClient (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
@ -28,7 +28,7 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
|
||||
if (err) return next(err)
|
||||
if (!client) return next(new Error('No client available.'))
|
||||
|
||||
const json: ClientLocal = {
|
||||
const json: OAuthClientLocal = {
|
||||
client_id: client.clientId,
|
||||
client_secret: client.clientSecret
|
||||
}
|
||||
@ -39,5 +39,5 @@ function getLocalClient (req: express.Request, res: express.Response, next: expr
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
clientsRouter
|
||||
oauthClientsRouter
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
export * from './client-local.model'
|
||||
export * from './job.model'
|
||||
export * from './oauth-client-local.model'
|
||||
export * from './pod.model'
|
||||
export * from './request-scheduler.model'
|
||||
export * from './user-video-rate.model'
|
||||
|
@ -1,4 +1,4 @@
|
||||
export interface ClientLocal {
|
||||
export interface OAuthClientLocal {
|
||||
client_id: string
|
||||
client_secret: string
|
||||
}
|
Loading…
Reference in New Issue
Block a user