|
|
@@ -20,7 +20,7 @@ module.exports = function(crowi, app) {
|
|
|
, csrf = middleware.csrfVerify(crowi, app)
|
|
|
;
|
|
|
|
|
|
- app.get('/' , loginRequired(crowi, app) , page.pageListShow);
|
|
|
+ app.get('/' , middleware.applicationInstalled(), loginRequired(crowi, app, false) , page.pageListShow);
|
|
|
|
|
|
app.get('/installer' , middleware.applicationNotInstalled() , installer.index);
|
|
|
app.post('/installer/createAdmin' , middleware.applicationNotInstalled() , form.register , csrf, installer.createAdmin);
|
|
|
@@ -90,54 +90,55 @@ module.exports = function(crowi, app) {
|
|
|
app.post('/me/auth/google' , loginRequired(crowi, app) , me.authGoogle);
|
|
|
app.get( '/me/auth/google/callback' , loginRequired(crowi, app) , me.authGoogleCallback);
|
|
|
|
|
|
- app.get( '/:id([0-9a-z]{24})' , loginRequired(crowi, app) , page.api.redirector);
|
|
|
- app.get( '/_r/:id([0-9a-z]{24})' , loginRequired(crowi, app) , page.api.redirector); // alias
|
|
|
- app.get( '/files/:id([0-9a-z]{24})' , loginRequired(crowi, app) , attachment.api.redirector);
|
|
|
+ app.get( '/:id([0-9a-z]{24})' , loginRequired(crowi, app, false) , page.api.redirector);
|
|
|
+ app.get( '/_r/:id([0-9a-z]{24})' , loginRequired(crowi, app, false) , page.api.redirector); // alias
|
|
|
+ app.get( '/files/:id([0-9a-z]{24})' , loginRequired(crowi, app, false) , attachment.api.redirector);
|
|
|
|
|
|
- app.get( '/_search' , loginRequired(crowi, app) , search.searchPage);
|
|
|
- app.get( '/_api/search' , accessTokenParser , loginRequired(crowi, app) , search.api.search);
|
|
|
+ app.get( '/_search' , loginRequired(crowi, app, false) , search.searchPage);
|
|
|
+ app.get( '/_api/search' , accessTokenParser , loginRequired(crowi, app, false) , search.api.search);
|
|
|
|
|
|
app.get( '/_api/check_username' , user.api.checkUsername);
|
|
|
app.post('/_api/me/picture/upload' , loginRequired(crowi, app) , uploads.single('userPicture'), me.api.uploadPicture);
|
|
|
- app.get( '/_api/user/bookmarks' , loginRequired(crowi, app) , user.api.bookmarks);
|
|
|
+ app.get( '/_api/user/bookmarks' , loginRequired(crowi, app, false) , user.api.bookmarks);
|
|
|
|
|
|
- app.get( '/user/:username([^/]+)/bookmarks' , loginRequired(crowi, app) , page.userBookmarkList);
|
|
|
- app.get( '/user/:username([^/]+)/recent-create' , loginRequired(crowi, app) , page.userRecentCreatedList);
|
|
|
+ app.get( '/user/:username([^/]+)/bookmarks' , loginRequired(crowi, app, false) , page.userBookmarkList);
|
|
|
+ app.get( '/user/:username([^/]+)/recent-create' , loginRequired(crowi, app, false) , page.userRecentCreatedList);
|
|
|
|
|
|
// HTTP RPC Styled API (に徐々に移行していいこうと思う)
|
|
|
- app.get('/_api/users.list' , accessTokenParser , loginRequired(crowi, app) , user.api.list);
|
|
|
- app.get('/_api/pages.list' , accessTokenParser , loginRequired(crowi, app) , page.api.list);
|
|
|
+ app.get('/_api/users.list' , accessTokenParser , loginRequired(crowi, app, false) , user.api.list);
|
|
|
+ app.get('/_api/pages.list' , accessTokenParser , loginRequired(crowi, app, false) , page.api.list);
|
|
|
app.post('/_api/pages.create' , accessTokenParser , loginRequired(crowi, app) , csrf, page.api.create);
|
|
|
app.post('/_api/pages.update' , accessTokenParser , loginRequired(crowi, app) , csrf, page.api.update);
|
|
|
- app.get('/_api/pages.get' , accessTokenParser , loginRequired(crowi, app) , page.api.get);
|
|
|
- app.get('/_api/pages.updatePost' , accessTokenParser , loginRequired(crowi, app) , page.api.getUpdatePost);
|
|
|
- app.post('/_api/pages.seen' , accessTokenParser , loginRequired(crowi, app) , page.api.seen);
|
|
|
+ app.get('/_api/pages.get' , accessTokenParser , loginRequired(crowi, app, false) , page.api.get);
|
|
|
+ app.get('/_api/pages.updatePost' , accessTokenParser , loginRequired(crowi, app, false) , page.api.getUpdatePost);
|
|
|
+ // allow posting to guests because the client doesn't know whether the user logged in
|
|
|
+ app.post('/_api/pages.seen' , accessTokenParser , loginRequired(crowi, app, false) , page.api.seen);
|
|
|
app.post('/_api/pages.rename' , accessTokenParser , loginRequired(crowi, app) , csrf, page.api.rename);
|
|
|
app.post('/_api/pages.remove' , loginRequired(crowi, app) , csrf, page.api.remove); // (Avoid from API Token)
|
|
|
app.post('/_api/pages.revertRemove' , loginRequired(crowi, app) , csrf, page.api.revertRemove); // (Avoid from API Token)
|
|
|
app.post('/_api/pages.unlink' , loginRequired(crowi, app) , csrf, page.api.unlink); // (Avoid from API Token)
|
|
|
- app.get('/_api/comments.get' , accessTokenParser , loginRequired(crowi, app) , comment.api.get);
|
|
|
+ app.get('/_api/comments.get' , accessTokenParser , loginRequired(crowi, app, false) , comment.api.get);
|
|
|
app.post('/_api/comments.add' , form.comment, accessTokenParser , loginRequired(crowi, app) , csrf, comment.api.add);
|
|
|
- app.get( '/_api/bookmarks.get' , accessTokenParser , loginRequired(crowi, app) , bookmark.api.get);
|
|
|
+ app.get( '/_api/bookmarks.get' , accessTokenParser , loginRequired(crowi, app, false) , bookmark.api.get);
|
|
|
app.post('/_api/bookmarks.add' , accessTokenParser , loginRequired(crowi, app) , csrf, bookmark.api.add);
|
|
|
app.post('/_api/bookmarks.remove' , accessTokenParser , loginRequired(crowi, app) , csrf, bookmark.api.remove);
|
|
|
app.post('/_api/likes.add' , accessTokenParser , loginRequired(crowi, app) , csrf, page.api.like);
|
|
|
app.post('/_api/likes.remove' , accessTokenParser , loginRequired(crowi, app) , csrf, page.api.unlike);
|
|
|
- app.get( '/_api/attachments.list' , accessTokenParser , loginRequired(crowi, app) , attachment.api.list);
|
|
|
+ app.get( '/_api/attachments.list' , accessTokenParser , loginRequired(crowi, app, false) , attachment.api.list);
|
|
|
app.post('/_api/attachments.add' , uploads.single('file'), accessTokenParser, loginRequired(crowi, app) ,csrf, attachment.api.add);
|
|
|
app.post('/_api/attachments.remove' , accessTokenParser , loginRequired(crowi, app) , csrf, attachment.api.remove);
|
|
|
|
|
|
- app.get( '/_api/revisions.get' , accessTokenParser , loginRequired(crowi, app) , revision.api.get);
|
|
|
- app.get( '/_api/revisions.ids' , accessTokenParser , loginRequired(crowi, app) , revision.api.ids);
|
|
|
- app.get( '/_api/revisions.list' , accessTokenParser , loginRequired(crowi, app) , revision.api.list);
|
|
|
+ app.get( '/_api/revisions.get' , accessTokenParser , loginRequired(crowi, app, false) , revision.api.get);
|
|
|
+ app.get( '/_api/revisions.ids' , accessTokenParser , loginRequired(crowi, app, false) , revision.api.ids);
|
|
|
+ app.get( '/_api/revisions.list' , accessTokenParser , loginRequired(crowi, app, false) , revision.api.list);
|
|
|
|
|
|
//app.get('/_api/revision/:id' , user.useUserData() , revision.api.get);
|
|
|
//app.get('/_api/r/:revisionId' , user.useUserData() , page.api.get);
|
|
|
|
|
|
app.post('/_/edit' , form.revision , loginRequired(crowi, app) , csrf, page.pageEdit);
|
|
|
- app.get('/trash/$' , loginRequired(crowi, app) , page.deletedPageListShow);
|
|
|
- app.get('/trash/*/$' , loginRequired(crowi, app) , page.deletedPageListShow);
|
|
|
- app.get('/*/$' , loginRequired(crowi, app) , page.pageListShow);
|
|
|
- app.get('/*' , loginRequired(crowi, app) , page.pageShow);
|
|
|
+ app.get('/trash/$' , loginRequired(crowi, app, false) , page.deletedPageListShow);
|
|
|
+ app.get('/trash/*/$' , loginRequired(crowi, app, false) , page.deletedPageListShow);
|
|
|
+ app.get('/*/$' , loginRequired(crowi, app, false) , page.pageListShow);
|
|
|
+ app.get('/*' , loginRequired(crowi, app, false) , page.pageShow);
|
|
|
|
|
|
};
|