|
|
@@ -123,26 +123,26 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
const apiV1Router = express.Router();
|
|
|
|
|
|
- apiV1Router.get('/search' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]) , loginRequired , search.api.search);
|
|
|
+ apiV1Router.get('/search' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }) , loginRequired , search.api.search);
|
|
|
|
|
|
// HTTP RPC Styled API (に徐々に移行していいこうと思う)
|
|
|
- apiV1Router.get('/pages.updatePost' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]), loginRequired, page.api.getUpdatePost);
|
|
|
- apiV1Router.get('/pages.getPageTag' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]) , loginRequired , page.api.getPageTag);
|
|
|
+ apiV1Router.get('/pages.updatePost' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }), loginRequired, page.api.getUpdatePost);
|
|
|
+ apiV1Router.get('/pages.getPageTag' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }) , loginRequired , page.api.getPageTag);
|
|
|
// allow posting to guests because the client doesn't know whether the user logged in
|
|
|
apiV1Router.post('/pages.remove' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), loginRequiredStrictly , excludeReadOnlyUser, page.validator.remove, apiV1FormValidator, page.api.remove); // (Avoid from API Token)
|
|
|
apiV1Router.post('/pages.revertRemove' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), loginRequiredStrictly , excludeReadOnlyUser, page.validator.revertRemove, apiV1FormValidator, page.api.revertRemove); // (Avoid from API Token)
|
|
|
apiV1Router.post('/pages.unlink' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), loginRequiredStrictly , excludeReadOnlyUser, page.api.unlink); // (Avoid from API Token)
|
|
|
- apiV1Router.get('/tags.list' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]), loginRequired, tag.api.list);
|
|
|
- apiV1Router.get('/tags.search' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]), loginRequired, tag.api.search);
|
|
|
- apiV1Router.post('/tags.update' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), loginRequiredStrictly, excludeReadOnlyUser, addActivity, tag.api.update);
|
|
|
- apiV1Router.get('/comments.get' , accessTokenParser([SCOPE.READ.FEATURES.PAGE]) , loginRequired , comment.api.get);
|
|
|
- apiV1Router.post('/comments.add' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), comment.api.validators.add(), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.add);
|
|
|
- apiV1Router.post('/comments.update' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), comment.api.validators.add(), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.update);
|
|
|
- apiV1Router.post('/comments.remove' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE]), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.remove);
|
|
|
-
|
|
|
- apiV1Router.post('/attachments.uploadProfileImage' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT]), uploads.single('file'), accessTokenParser , loginRequiredStrictly , excludeReadOnlyUser, uploads.single('file'), autoReap, attachmentApi.uploadProfileImage);
|
|
|
- apiV1Router.post('/attachments.remove' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT]), loginRequiredStrictly , excludeReadOnlyUser, addActivity ,attachmentApi.remove);
|
|
|
- apiV1Router.post('/attachments.removeProfileImage' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT]), loginRequiredStrictly , excludeReadOnlyUser, attachmentApi.removeProfileImage);
|
|
|
+ apiV1Router.get('/tags.list' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }), loginRequired, tag.api.list);
|
|
|
+ apiV1Router.get('/tags.search' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }), loginRequired, tag.api.search);
|
|
|
+ apiV1Router.post('/tags.update' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE], { acceptLegacy: true }), loginRequiredStrictly, excludeReadOnlyUser, addActivity, tag.api.update);
|
|
|
+ apiV1Router.get('/comments.get' , accessTokenParser([SCOPE.READ.FEATURES.PAGE], { acceptLegacy: true }) , loginRequired , comment.api.get);
|
|
|
+ apiV1Router.post('/comments.add' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE], { acceptLegacy: true }), comment.api.validators.add(), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.add);
|
|
|
+ apiV1Router.post('/comments.update' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE], { acceptLegacy: true }), comment.api.validators.add(), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.update);
|
|
|
+ apiV1Router.post('/comments.remove' , accessTokenParser([SCOPE.WRITE.FEATURES.PAGE], { acceptLegacy: true }), loginRequiredStrictly , excludeReadOnlyUserIfCommentNotAllowed, addActivity, comment.api.remove);
|
|
|
+
|
|
|
+ apiV1Router.post('/attachments.uploadProfileImage' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT], { acceptLegacy: true }), uploads.single('file'), accessTokenParser , loginRequiredStrictly , excludeReadOnlyUser, uploads.single('file'), autoReap, attachmentApi.uploadProfileImage);
|
|
|
+ apiV1Router.post('/attachments.remove' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT], { acceptLegacy: true }), loginRequiredStrictly , excludeReadOnlyUser, addActivity ,attachmentApi.remove);
|
|
|
+ apiV1Router.post('/attachments.removeProfileImage' , accessTokenParser([SCOPE.WRITE.FEATURES.ATTACHMENT], { acceptLegacy: true }), loginRequiredStrictly , excludeReadOnlyUser, attachmentApi.removeProfileImage);
|
|
|
|
|
|
// API v1
|
|
|
app.use('/_api', unavailableWhenMaintenanceModeForApi, apiV1Router);
|