api.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. const config = require('../config.js');
  2. const routes = require('express').Router();
  3. const uploadController = require('../controllers/uploadController');
  4. const albumsController = require('../controllers/albumsController');
  5. const tokenController = require('../controllers/tokenController');
  6. const authController = require('../controllers/authController');
  7. const appearanceController = require('../controllers/appearanceController');
  8. routes.get('/check', (req, res, next) => {
  9. return res.json({
  10. private: config.private,
  11. maxFileSize: config.uploads.maxSize
  12. });
  13. });
  14. routes.post('/appearance/toggle', (req, res, next) => appearanceController.toggleDarkMode(req, res, next));
  15. routes.post('/login', (req, res, next) => authController.verify(req, res, next));
  16. routes.post('/register', (req, res, next) => authController.register(req, res, next));
  17. routes.post('/password/change', (req, res, next) => authController.changePassword(req, res, next));
  18. routes.get('/uploads', (req, res, next) => uploadController.list(req, res, next));
  19. routes.get('/uploads/:page', (req, res, next) => uploadController.list(req, res, next));
  20. routes.post('/upload', (req, res, next) => uploadController.upload(req, res, next));
  21. routes.post('/upload/delete', (req, res, next) => uploadController.delete(req, res, next));
  22. routes.post('/upload/:albumid', (req, res, next) => uploadController.upload(req, res, next));
  23. routes.get('/album/get/:identifier', (req, res, next) => albumsController.get(req, res, next));
  24. routes.get('/album/zip/:identifier', (req, res, next) => albumsController.generateZip(req, res, next));
  25. routes.get('/album/:id', (req, res, next) => uploadController.list(req, res, next));
  26. routes.get('/album/:id/:page', (req, res, next) => uploadController.list(req, res, next));
  27. routes.get('/albums', (req, res, next) => albumsController.list(req, res, next));
  28. routes.get('/albums/:sidebar', (req, res, next) => albumsController.list(req, res, next));
  29. routes.post('/albums', (req, res, next) => albumsController.create(req, res, next));
  30. routes.post('/albums/delete', (req, res, next) => albumsController.delete(req, res, next));
  31. routes.post('/albums/rename', (req, res, next) => albumsController.rename(req, res, next));
  32. routes.get('/albums/test', (req, res, next) => albumsController.test(req, res, next));
  33. routes.get('/tokens', (req, res, next) => tokenController.list(req, res, next));
  34. routes.post('/tokens/verify', (req, res, next) => tokenController.verify(req, res, next));
  35. routes.post('/tokens/change', (req, res, next) => tokenController.change(req, res, next));
  36. module.exports = routes;