spee.ch/server/routes/api/index.js

66 lines
4.5 KiB
JavaScript
Raw Permalink Normal View History

// middleware
2018-10-29 21:43:15 +01:00
const { autoblockPublishMiddleware, autoblockPublishBodyMiddleware } = require('../../middleware/autoblockPublishMiddleware');
const multipartMiddleware = require('../../middleware/multipartMiddleware');
const torCheckMiddleware = require('../../middleware/torCheckMiddleware');
// route handlers
2018-04-27 18:54:36 +02:00
const channelAvailability = require('../../controllers/api/channel/availability');
const channelClaims = require('../../controllers/api/channel/claims');
const channelData = require('../../controllers/api/channel/data');
const channelShortId = require('../../controllers/api/channel/shortId');
const claimAvailability = require('../../controllers/api/claim/availability');
const claimData = require('../../controllers/api/claim/data/');
const claimGet = require('../../controllers/api/claim/get');
const claimList = require('../../controllers/api/claim/list');
2018-04-27 18:54:36 +02:00
const claimLongId = require('../../controllers/api/claim/longId');
const claimPublish = require('../../controllers/api/claim/publish');
const claimAbandon = require('../../controllers/api/claim/abandon');
const claimUpdate = require('../../controllers/api/claim/update');
2018-04-27 18:54:36 +02:00
const claimResolve = require('../../controllers/api/claim/resolve');
const claimShortId = require('../../controllers/api/claim/shortId');
const claimViews = require('../../controllers/api/claim/views');
2018-04-27 18:54:36 +02:00
const fileAvailability = require('../../controllers/api/file/availability');
2018-10-24 10:43:30 +02:00
const specialClaims = require('../../controllers/api/special/claims');
const userPassword = require('../../controllers/api/user/password');
const publishingConfig = require('../../controllers/api/config/site/publishing');
const getTorList = require('../../controllers/api/tor');
const getBlockedList = require('../../controllers/api/blocked');
2018-07-28 00:56:56 +02:00
const getOEmbedData = require('../../controllers/api/oEmbed');
2018-03-29 02:35:41 +02:00
export default {
// homepage routes
2018-11-11 01:11:12 +01:00
'/api/homepage/data/channels' : { controller: [ torCheckMiddleware, channelData ] },
2018-03-29 20:24:52 +02:00
// channel routes
2018-11-11 01:11:12 +01:00
'/api/channel/availability/:name' : { controller: [ torCheckMiddleware, channelAvailability ] },
'/api/channel/short-id/:longId/:name' : { controller: [ torCheckMiddleware, channelShortId ] },
'/api/channel/data/:channelName/:channelClaimId' : { controller: [ torCheckMiddleware, channelData ] },
'/api/channel/claims/:channelName/:channelClaimId/:page': { controller: [ torCheckMiddleware, channelClaims ] },
2018-10-24 10:43:30 +02:00
// sepcial routes
'/api/special/:name/:page': { controller: [ torCheckMiddleware, specialClaims ] },
2018-03-29 20:24:52 +02:00
// claim routes
2018-11-11 01:11:12 +01:00
'/api/claim/availability/:name' : { controller: [ torCheckMiddleware, claimAvailability ] },
'/api/claim/data/:claimName/:claimId' : { controller: [ torCheckMiddleware, claimData ] },
'/api/claim/get/:name/:claimId' : { controller: [ torCheckMiddleware, claimGet ] },
'/api/claim/list/:name' : { controller: [ torCheckMiddleware, claimList ] },
'/api/claim/long-id' : { method: 'post', controller: [ torCheckMiddleware, claimLongId ] }, // note: should be a 'get'
'/api/claim/publish' : { method: 'post', controller: [ torCheckMiddleware, autoblockPublishMiddleware, multipartMiddleware, autoblockPublishBodyMiddleware, claimPublish ] },
'/api/claim/update' : { method: 'post', controller: [ torCheckMiddleware, multipartMiddleware, claimUpdate ] },
'/api/claim/abandon' : { method: 'post', controller: [ torCheckMiddleware, multipartMiddleware, claimAbandon ] },
'/api/claim/resolve/:name/:claimId' : { controller: [ torCheckMiddleware, claimResolve ] },
'/api/claim/short-id/:longId/:name' : { controller: [ torCheckMiddleware, claimShortId ] },
'/api/claim/views/:claimId' : { controller: [ torCheckMiddleware, claimViews ] },
2018-03-29 20:24:52 +02:00
// file routes
'/api/file/availability/:name/:claimId': { controller: [ torCheckMiddleware, fileAvailability ] },
// user routes
2018-11-11 01:11:12 +01:00
'/api/user/password/' : { method: 'put', controller: [ torCheckMiddleware, userPassword ] },
// configs
2018-11-11 01:11:12 +01:00
'/api/config/site/publishing' : { controller: [ torCheckMiddleware, publishingConfig ] },
// tor
2018-11-11 01:11:12 +01:00
'/api/tor' : { controller: [ torCheckMiddleware, getTorList ] },
// blocked
2018-11-11 01:11:12 +01:00
'/api/blocked' : { controller: [ torCheckMiddleware, getBlockedList ] },
2018-07-28 00:56:56 +02:00
// open embed
2018-11-11 01:11:12 +01:00
'/api/oembed' : { controller: [ torCheckMiddleware, getOEmbedData ] },
2018-03-29 02:35:41 +02:00
};