diff --git a/src/controllers/api.js b/src/controllers/api.js index ae2af4fa76..e3e697498e 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -2,7 +2,6 @@ const validator = require('validator'); const nconf = require('nconf'); -const winston = require('winston'); const meta = require('../meta'); const user = require('../user'); @@ -10,7 +9,6 @@ const categories = require('../categories'); const plugins = require('../plugins'); const translator = require('../translator'); const languages = require('../languages'); -const api = require('../api'); const apiController = module.exports; @@ -116,36 +114,6 @@ apiController.getConfig = async function (req, res) { res.json(config); }; -// TODO: Deprecate these four controllers in 1.17.0 -apiController.getPostData = async (pid, uid) => api.posts.get({ uid }, { pid }); -apiController.getTopicData = async (tid, uid) => api.topics.get({ uid }, { tid }); -apiController.getCategoryData = async (cid, uid) => api.categories.get({ uid }, { cid }); -apiController.getObject = async function (req, res, next) { - const methods = { - post: apiController.getPostData, - topic: apiController.getTopicData, - category: apiController.getCategoryData, - }; - const method = methods[req.params.type]; - if (!method) { - return next(); - } - - winston.warn('[api] This route has been deprecated and will likely be removed in v1.17.0'); - winston.warn('[api] Use GET /api/v3/(posts|topics|categories)/:id instead'); - - try { - const result = await method(req.params.id, req.uid); - if (!result) { - return next(); - } - - res.json(result); - } catch (err) { - next(err); - } -}; - apiController.getModerators = async function (req, res) { const moderators = await categories.getModerators(req.params.cid); res.json({ moderators: moderators }); diff --git a/src/routes/api.js b/src/routes/api.js index 3461a28550..b316d38d2e 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -19,11 +19,6 @@ module.exports = function (app, middleware, controllers) { router.get('/user/uid/:userslug/export/uploads', middleware.checkAccountPermissions, middleware.exposeUid, controllers.user.exportUploads); router.get('/user/uid/:userslug/export/profile', middleware.checkAccountPermissions, middleware.exposeUid, controllers.user.exportProfile); - // TODO: Deprecate in v1.17.0 - router.get('/:type/pid/:id', middleware.authenticateOrGuest, controllers.api.getObject); - router.get('/:type/tid/:id', middleware.authenticateOrGuest, controllers.api.getObject); - router.get('/:type/cid/:id', middleware.authenticateOrGuest, controllers.api.getObject); - router.get('/categories/:cid/moderators', controllers.api.getModerators); router.get('/recent/posts/:term?', controllers.posts.getRecentPosts); router.get('/unread/total', middleware.authenticate, controllers.unread.unreadTotal);