2018-04-13 16:20:57 +00:00
|
|
|
const config = require('./../config')
|
2018-01-23 20:06:30 +00:00
|
|
|
const routes = require('express').Router()
|
2018-04-13 16:20:57 +00:00
|
|
|
const uploadController = require('./../controllers/uploadController')
|
|
|
|
const albumsController = require('./../controllers/albumsController')
|
|
|
|
const tokenController = require('./../controllers/tokenController')
|
|
|
|
const authController = require('./../controllers/authController')
|
2019-04-05 17:32:52 +00:00
|
|
|
const utilsController = require('./../controllers/utilsController')
|
2017-01-15 01:36:24 +00:00
|
|
|
|
2017-10-04 00:13:38 +00:00
|
|
|
routes.get('/check', (req, res, next) => {
|
2018-01-23 20:06:30 +00:00
|
|
|
return res.json({
|
|
|
|
private: config.private,
|
2018-04-03 18:54:42 +00:00
|
|
|
enableUserAccounts: config.enableUserAccounts,
|
2018-03-28 11:36:28 +00:00
|
|
|
maxFileSize: config.uploads.maxSize,
|
2018-05-09 08:41:30 +00:00
|
|
|
chunkSize: config.uploads.chunkSize
|
2018-01-23 20:06:30 +00:00
|
|
|
})
|
|
|
|
})
|
2017-01-17 03:37:54 +00:00
|
|
|
|
2018-01-23 20:06:30 +00:00
|
|
|
routes.post('/login', (req, res, next) => authController.verify(req, res, next))
|
|
|
|
routes.post('/register', (req, res, next) => authController.register(req, res, next))
|
|
|
|
routes.post('/password/change', (req, res, next) => authController.changePassword(req, res, next))
|
|
|
|
routes.get('/uploads', (req, res, next) => uploadController.list(req, res, next))
|
|
|
|
routes.get('/uploads/:page', (req, res, next) => uploadController.list(req, res, next))
|
|
|
|
routes.post('/upload', (req, res, next) => uploadController.upload(req, res, next))
|
|
|
|
routes.post('/upload/delete', (req, res, next) => uploadController.delete(req, res, next))
|
2018-03-29 23:22:08 +00:00
|
|
|
routes.post('/upload/bulkdelete', (req, res, next) => uploadController.bulkDelete(req, res, next))
|
2018-03-28 11:36:28 +00:00
|
|
|
routes.post('/upload/finishchunks', (req, res, next) => uploadController.finishChunks(req, res, next))
|
2018-01-23 20:06:30 +00:00
|
|
|
routes.post('/upload/:albumid', (req, res, next) => uploadController.upload(req, res, next))
|
|
|
|
routes.get('/album/get/:identifier', (req, res, next) => albumsController.get(req, res, next))
|
|
|
|
routes.get('/album/zip/:identifier', (req, res, next) => albumsController.generateZip(req, res, next))
|
|
|
|
routes.get('/album/:id', (req, res, next) => uploadController.list(req, res, next))
|
|
|
|
routes.get('/album/:id/:page', (req, res, next) => uploadController.list(req, res, next))
|
|
|
|
routes.get('/albums', (req, res, next) => albumsController.list(req, res, next))
|
|
|
|
routes.get('/albums/:sidebar', (req, res, next) => albumsController.list(req, res, next))
|
|
|
|
routes.post('/albums', (req, res, next) => albumsController.create(req, res, next))
|
2018-03-30 02:39:53 +00:00
|
|
|
routes.post('/albums/addfiles', (req, res, next) => albumsController.addFiles(req, res, next))
|
2018-01-23 20:06:30 +00:00
|
|
|
routes.post('/albums/delete', (req, res, next) => albumsController.delete(req, res, next))
|
2018-04-28 17:26:39 +00:00
|
|
|
routes.post('/albums/edit', (req, res, next) => albumsController.edit(req, res, next))
|
2018-01-23 20:06:30 +00:00
|
|
|
routes.post('/albums/rename', (req, res, next) => albumsController.rename(req, res, next))
|
|
|
|
routes.get('/albums/test', (req, res, next) => albumsController.test(req, res, next))
|
|
|
|
routes.get('/tokens', (req, res, next) => tokenController.list(req, res, next))
|
|
|
|
routes.post('/tokens/verify', (req, res, next) => tokenController.verify(req, res, next))
|
|
|
|
routes.post('/tokens/change', (req, res, next) => tokenController.change(req, res, next))
|
2018-03-28 11:36:28 +00:00
|
|
|
routes.get('/filelength/config', (req, res, next) => authController.getFileLengthConfig(req, res, next))
|
|
|
|
routes.post('/filelength/change', (req, res, next) => authController.changeFileLength(req, res, next))
|
2018-10-09 19:52:41 +00:00
|
|
|
routes.get('/users', (req, res, next) => authController.listUsers(req, res, next))
|
|
|
|
routes.get('/users/:page', (req, res, next) => authController.listUsers(req, res, next))
|
|
|
|
routes.post('/users/edit', (req, res, next) => authController.editUser(req, res, next))
|
2019-01-01 19:39:08 +00:00
|
|
|
routes.post('/users/disable', (req, res, next) => authController.disableUser(req, res, next))
|
2019-04-05 17:32:52 +00:00
|
|
|
routes.get('/stats', (req, res, next) => utilsController.stats(req, res, next))
|
2017-01-29 07:20:25 +00:00
|
|
|
|
2018-01-23 20:06:30 +00:00
|
|
|
module.exports = routes
|