diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-11 21:50:51 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-19 21:22:28 +0100 |
commit | feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch) | |
tree | 2abc9fbc9569760e218fd52835850b757344b420 /server/controllers/api/clients.js | |
parent | 108626609eda75e4ecc0a83a650a4d53c46220e0 (diff) | |
download | PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip |
First version with PostgreSQL
Diffstat (limited to 'server/controllers/api/clients.js')
-rw-r--r-- | server/controllers/api/clients.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/server/controllers/api/clients.js b/server/controllers/api/clients.js index 7755f6c2b..cf83cb835 100644 --- a/server/controllers/api/clients.js +++ b/server/controllers/api/clients.js | |||
@@ -1,13 +1,11 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const express = require('express') | 3 | const express = require('express') |
4 | const mongoose = require('mongoose') | ||
5 | 4 | ||
6 | const constants = require('../../initializers/constants') | 5 | const constants = require('../../initializers/constants') |
6 | const db = require('../../initializers/database') | ||
7 | const logger = require('../../helpers/logger') | 7 | const logger = require('../../helpers/logger') |
8 | 8 | ||
9 | const Client = mongoose.model('OAuthClient') | ||
10 | |||
11 | const router = express.Router() | 9 | const router = express.Router() |
12 | 10 | ||
13 | router.get('/local', getLocalClient) | 11 | router.get('/local', getLocalClient) |
@@ -27,12 +25,12 @@ function getLocalClient (req, res, next) { | |||
27 | return res.type('json').status(403).end() | 25 | return res.type('json').status(403).end() |
28 | } | 26 | } |
29 | 27 | ||
30 | Client.loadFirstClient(function (err, client) { | 28 | db.OAuthClient.loadFirstClient(function (err, client) { |
31 | if (err) return next(err) | 29 | if (err) return next(err) |
32 | if (!client) return next(new Error('No client available.')) | 30 | if (!client) return next(new Error('No client available.')) |
33 | 31 | ||
34 | res.json({ | 32 | res.json({ |
35 | client_id: client._id, | 33 | client_id: client.clientId, |
36 | client_secret: client.clientSecret | 34 | client_secret: client.clientSecret |
37 | }) | 35 | }) |
38 | }) | 36 | }) |