Commit c4d5cbe3 authored by Liang Ding's avatar Liang Ding

重构请求路由 #61

parent 68fbab4b
......@@ -73,7 +73,7 @@
</scm>
<properties>
<org.b3log.latke.version>3.2.3</org.b3log.latke.version>
<org.b3log.latke.version>3.2.4-SNAPSHOT</org.b3log.latke.version>
<jsoup.version>1.12.1</jsoup.version>
<flexmark.version>0.50.40</flexmark.version>
......
......@@ -47,7 +47,7 @@ import org.json.JSONObject;
* Server.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.0.9, Jan 24, 2020
* @version 3.0.0.0, Feb 9, 2020
* @since 1.2.0
*/
public final class Server extends BaseServer {
......@@ -370,10 +370,19 @@ public final class Server extends BaseServer {
*/
public static void routeConsoleProcessors() {
final BeanManager beanManager = BeanManager.getInstance();
final ConsoleAuthAdvice consoleAuthAdvice = beanManager.getReference(ConsoleAuthAdvice.class);
final ConsoleAdminAuthAdvice consoleAdminAuthAdvice = beanManager.getReference(ConsoleAdminAuthAdvice.class);
final AdminConsole adminConsole = beanManager.getReference(AdminConsole.class);
Dispatcher.get("/admin-index.do", adminConsole::showAdminIndex);
Dispatcher.get("/admin-preference.do", adminConsole::showAdminPreferenceFunction);
Dispatcher.route().get(new String[]{"/admin-article.do",
final Dispatcher.RouterGroup adminConsoleGroup = Dispatcher.group();
adminConsoleGroup.middlewares(consoleAuthAdvice::handle);
adminConsoleGroup.get("/admin-index.do", adminConsole::showAdminIndex).
get("/admin-preference.do", adminConsole::showAdminPreferenceFunction).
get("/console/export/sql", adminConsole::exportSQL).
get("/console/export/json", adminConsole::exportJSON).
get("/console/export/hexo", adminConsole::exportHexo);
adminConsoleGroup.route().get(new String[]{"/admin-article.do",
"/admin-article-list.do",
"/admin-comment-list.do",
"/admin-link-list.do",
......@@ -387,85 +396,110 @@ public final class Server extends BaseServer {
"/admin-staticsite.do",
"/admin-main.do",
"/admin-about.do"}, adminConsole::showAdminFunctions);
Dispatcher.get("/console/export/sql", adminConsole::exportSQL);
Dispatcher.get("/console/export/json", adminConsole::exportJSON);
Dispatcher.get("/console/export/hexo", adminConsole::exportHexo);
final ArticleConsole articleConsole = beanManager.getReference(ArticleConsole.class);
Dispatcher.get("/console/article/push2rhy", articleConsole::pushArticleToCommunity);
Dispatcher.get("/console/thumbs", articleConsole::getArticleThumbs);
Dispatcher.get("/console/article/{id}", articleConsole::getArticle);
Dispatcher.get("/console/articles/status/{status}/{page}/{pageSize}/{windowSize}", articleConsole::getArticles);
Dispatcher.delete("/console/article/{id}", articleConsole::removeArticle);
Dispatcher.put("/console/article/unpublish/{id}", articleConsole::cancelPublishArticle);
Dispatcher.put("/console/article/canceltop/{id}", articleConsole::cancelTopArticle);
Dispatcher.put("/console/article/puttop/{id}", articleConsole::putTopArticle);
Dispatcher.put("/console/article/", articleConsole::updateArticle);
Dispatcher.post("/console/article/", articleConsole::addArticle);
final CategoryConsole categoryConsole = beanManager.getReference(CategoryConsole.class);
Dispatcher.put("/console/category/order/", categoryConsole::changeOrder);
Dispatcher.get("/console/category/{id}", categoryConsole::getCategory);
Dispatcher.delete("/console/category/{id}", categoryConsole::removeCategory);
Dispatcher.put("/console/category/", categoryConsole::updateCategory);
Dispatcher.post("/console/category/", categoryConsole::addCategory);
Dispatcher.get("/console/categories/{page}/{pageSize}/{windowSize}", categoryConsole::getCategories);
final Dispatcher.RouterGroup articleConsoleGroup = Dispatcher.group();
articleConsoleGroup.middlewares(consoleAuthAdvice::handle);
articleConsoleGroup.get("/console/article/push2rhy", articleConsole::pushArticleToCommunity).
get("/console/thumbs", articleConsole::getArticleThumbs).
get("/console/article/{id}", articleConsole::getArticle).
get("/console/articles/status/{status}/{page}/{pageSize}/{windowSize}", articleConsole::getArticles).
delete("/console/article/{id}", articleConsole::removeArticle).
put("/console/article/unpublish/{id}", articleConsole::cancelPublishArticle).
put("/console/article/canceltop/{id}", articleConsole::cancelTopArticle).
put("/console/article/puttop/{id}", articleConsole::putTopArticle).
put("/console/article/", articleConsole::updateArticle).
post("/console/article/", articleConsole::addArticle);
final CommentConsole commentConsole = beanManager.getReference(CommentConsole.class);
Dispatcher.delete("/console/article/comment/{id}", commentConsole::removeArticleComment);
Dispatcher.get("/console/comments/{page}/{pageSize}/{windowSize}", commentConsole::getComments);
Dispatcher.get("/console/comments/article/{id}", commentConsole::getArticleComments);
final Dispatcher.RouterGroup commentConsoleGroup = Dispatcher.group();
commentConsoleGroup.middlewares(consoleAuthAdvice::handle);
commentConsoleGroup.delete("/console/article/comment/{id}", commentConsole::removeArticleComment).
get("/console/comments/{page}/{pageSize}/{windowSize}", commentConsole::getComments).
get("/console/comments/article/{id}", commentConsole::getArticleComments);
final TagConsole tagConsole = beanManager.getReference(TagConsole.class);
final Dispatcher.RouterGroup tagConsoleGroup = Dispatcher.group();
tagConsoleGroup.middlewares(consoleAuthAdvice::handle);
tagConsoleGroup.get("/console/tags", tagConsole::getTags).
get("/console/tag/unused", tagConsole::getUnusedTags);
final CategoryConsole categoryConsole = beanManager.getReference(CategoryConsole.class);
final Dispatcher.RouterGroup categoryGroup = Dispatcher.group();
categoryGroup.middlewares(consoleAdminAuthAdvice::handle);
categoryGroup.put("/console/category/order/", categoryConsole::changeOrder).
get("/console/category/{id}", categoryConsole::getCategory).
delete("/console/category/{id}", categoryConsole::removeCategory).
put("/console/category/", categoryConsole::updateCategory).
post("/console/category/", categoryConsole::addCategory).
get("/console/categories/{page}/{pageSize}/{windowSize}", categoryConsole::getCategories);
final LinkConsole linkConsole = beanManager.getReference(LinkConsole.class);
Dispatcher.delete("/console/link/{id}", linkConsole::removeLink);
Dispatcher.put("/console/link/", linkConsole::updateLink);
Dispatcher.put("/console/link/order/", linkConsole::changeOrder);
Dispatcher.post("/console/link/", linkConsole::addLink);
Dispatcher.get("/console/links/{page}/{pageSize}/{windowSize}", linkConsole::getLinks);
Dispatcher.get("/console/link/{id}", linkConsole::getLink);
final Dispatcher.RouterGroup linkConsoleGroup = Dispatcher.group();
linkConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
linkConsoleGroup.delete("/console/link/{id}", linkConsole::removeLink).
put("/console/link/", linkConsole::updateLink).
put("/console/link/order/", linkConsole::changeOrder).
post("/console/link/", linkConsole::addLink).
get("/console/links/{page}/{pageSize}/{windowSize}", linkConsole::getLinks).
get("/console/link/{id}", linkConsole::getLink);
final PageConsole pageConsole = beanManager.getReference(PageConsole.class);
Dispatcher.put("/console/page/", pageConsole::updatePage);
Dispatcher.delete("/console/page/{id}", pageConsole::removePage);
Dispatcher.post("/console/page/", pageConsole::addPage);
Dispatcher.put("/console/page/order/", pageConsole::changeOrder);
Dispatcher.get("/console/page/{id}", pageConsole::getPage);
Dispatcher.get("/console/pages/{page}/{pageSize}/{windowSize}", pageConsole::getPages);
final Dispatcher.RouterGroup pageConsoleGroup = Dispatcher.group();
pageConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
pageConsoleGroup.put("/console/page/", pageConsole::updatePage).
delete("/console/page/{id}", pageConsole::removePage).
post("/console/page/", pageConsole::addPage).
put("/console/page/order/", pageConsole::changeOrder).
get("/console/page/{id}", pageConsole::getPage).
get("/console/pages/{page}/{pageSize}/{windowSize}", pageConsole::getPages);
final PluginConsole pluginConsole = beanManager.getReference(PluginConsole.class);
Dispatcher.put("/console/plugin/status/", pluginConsole::setPluginStatus);
Dispatcher.get("/console/plugins/{page}/{pageSize}/{windowSize}", pluginConsole::getPlugins);
Dispatcher.post("/console/plugin/toSetting", pluginConsole::toSetting);
Dispatcher.post("/console/plugin/updateSetting", pluginConsole::updateSetting);
final Dispatcher.RouterGroup pluginConsoleGroup = Dispatcher.group();
pluginConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
pluginConsoleGroup.put("/console/plugin/status/", pluginConsole::setPluginStatus).
get("/console/plugins/{page}/{pageSize}/{windowSize}", pluginConsole::getPlugins).
post("/console/plugin/toSetting", pluginConsole::toSetting).
post("/console/plugin/updateSetting", pluginConsole::updateSetting);
final PreferenceConsole preferenceConsole = beanManager.getReference(PreferenceConsole.class);
Dispatcher.get("/console/signs/", preferenceConsole::getSigns);
Dispatcher.get("/console/preference/", preferenceConsole::getPreference);
Dispatcher.put("/console/preference/", preferenceConsole::updatePreference);
final Dispatcher.RouterGroup preferenceConsoleGroup = Dispatcher.group();
preferenceConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
preferenceConsoleGroup.get("/console/signs/", preferenceConsole::getSigns).
get("/console/preference/", preferenceConsole::getPreference).
put("/console/preference/", preferenceConsole::updatePreference);
final SkinConsole skinConsole = beanManager.getReference(SkinConsole.class);
Dispatcher.get("/console/skin", skinConsole::getSkin);
Dispatcher.put("/console/skin", skinConsole::updateSkin);
final Dispatcher.RouterGroup skinConsoleGroup = Dispatcher.group();
skinConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
skinConsoleGroup.get("/console/skin", skinConsole::getSkin).
put("/console/skin", skinConsole::updateSkin);
final RepairConsole repairConsole = beanManager.getReference(RepairConsole.class);
Dispatcher.get("/fix/restore-signs", repairConsole::restoreSigns);
Dispatcher.get("/fix/archivedate-articles", repairConsole::cleanArchiveDateArticles);
final TagConsole tagConsole = beanManager.getReference(TagConsole.class);
Dispatcher.get("/console/tags", tagConsole::getTags);
Dispatcher.get("/console/tag/unused", tagConsole::getUnusedTags);
final Dispatcher.RouterGroup repairConsoleGroup = Dispatcher.group();
repairConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
repairConsoleGroup.get("/fix/restore-signs", repairConsole::restoreSigns).
get("/fix/archivedate-articles", repairConsole::cleanArchiveDateArticles);
final OtherConsole otherConsole = beanManager.getReference(OtherConsole.class);
Dispatcher.delete("/console/archive/unused", otherConsole::removeUnusedArchives);
Dispatcher.delete("/console/tag/unused", otherConsole::removeUnusedTags);
final Dispatcher.RouterGroup otherConsoleGroup = Dispatcher.group();
otherConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
otherConsoleGroup.delete("/console/archive/unused", otherConsole::removeUnusedArchives).
delete("/console/tag/unused", otherConsole::removeUnusedTags);
final UserConsole userConsole = beanManager.getReference(UserConsole.class);
Dispatcher.put("/console/user/", userConsole::updateUser);
Dispatcher.delete("/console/user/{id}", userConsole::removeUser);
Dispatcher.get("/console/users/{page}/{pageSize}/{windowSize}", userConsole::getUsers);
Dispatcher.get("/console/user/{id}", userConsole::getUser);
Dispatcher.get("/console/changeRole/{id}", userConsole::changeUserRole);
final Dispatcher.RouterGroup userConsoleGroup = Dispatcher.group();
userConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
userConsoleGroup.put("/console/user/", userConsole::updateUser).
delete("/console/user/{id}", userConsole::removeUser).
get("/console/users/{page}/{pageSize}/{windowSize}", userConsole::getUsers).
get("/console/user/{id}", userConsole::getUser).
get("/console/changeRole/{id}", userConsole::changeUserRole);
final StaticSiteConsole staticSiteConsole = beanManager.getReference(StaticSiteConsole.class);
final Dispatcher.RouterGroup staticSiteConsoleGroup = Dispatcher.group();
staticSiteConsoleGroup.middlewares(consoleAdminAuthAdvice::handle);
staticSiteConsoleGroup.put("/console/staticsite", staticSiteConsole::genSite);
Dispatcher.mapping();
}
......
......@@ -30,7 +30,6 @@ import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.Response;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
......@@ -61,11 +60,10 @@ import java.util.*;
* Admin console render processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.0.18, Jan 25, 2020
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.1
*/
@Singleton
@Before(ConsoleAuthAdvice.class)
public class AdminConsole {
/**
......
......@@ -26,7 +26,6 @@ import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.Request;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
......@@ -50,11 +49,10 @@ import java.util.stream.Collectors;
* Article console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.0.4, Jan 11, 2020
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@Singleton
@Before(ConsoleAuthAdvice.class)
public class ArticleConsole {
/**
......
......@@ -25,10 +25,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.util.URLs;
......@@ -52,11 +51,10 @@ import java.util.Set;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/lzh984294471">lzh984294471</a>
* @version 1.1.3.6, Sep 1, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 2.0.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class CategoryConsole {
/**
......
......@@ -23,10 +23,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.model.Comment;
import org.b3log.solo.service.CommentMgmtService;
......@@ -40,11 +39,10 @@ import java.util.List;
* Comment console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.0, Apr 18, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Before(ConsoleAuthAdvice.class)
@Singleton
public class CommentConsole {
/**
......
......@@ -17,32 +17,26 @@
*/
package org.b3log.solo.processor.console;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.advice.ProcessAdvice;
import org.b3log.latke.http.advice.RequestProcessAdviceException;
import org.b3log.latke.ioc.Singleton;
import org.b3log.solo.util.Solos;
import org.json.JSONObject;
/**
* The common auth check before advice for admin console.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.3, Oct 5, 2018
* @version 2.0.0.0, Feb 9, 2020
* @since 2.9.5
*/
@Singleton
public class ConsoleAdminAuthAdvice extends ProcessAdvice {
public class ConsoleAdminAuthAdvice {
@Override
public void doAdvice(final RequestContext context) throws RequestProcessAdviceException {
public void handle(final RequestContext context) {
if (!Solos.isAdminLoggedIn(context)) {
final JSONObject exception401 = new JSONObject();
exception401.put(Keys.MSG, "Unauthorized to request [" + context.requestURI() + "], please signin using admin account");
exception401.put(Keys.STATUS_CODE, 401);
throw new RequestProcessAdviceException(exception401);
context.sendError(401);
context.abort();
}
context.handle();
}
}
......@@ -17,10 +17,7 @@
*/
package org.b3log.solo.processor.console;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.advice.ProcessAdvice;
import org.b3log.latke.http.advice.RequestProcessAdviceException;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.model.Role;
import org.b3log.latke.model.User;
......@@ -31,30 +28,25 @@ import org.json.JSONObject;
* The common auth check before advice for admin console.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.3, Feb 7, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 2.9.5
*/
@Singleton
public class ConsoleAuthAdvice extends ProcessAdvice {
public class ConsoleAuthAdvice {
@Override
public void doAdvice(final RequestContext context) throws RequestProcessAdviceException {
public void handle(final RequestContext context) {
final JSONObject currentUser = Solos.getCurrentUser(context.getRequest(), context.getResponse());
if (null == currentUser) {
final JSONObject exception401 = new JSONObject();
exception401.put(Keys.MSG, "Unauthorized to request [" + context.requestURI() + "], please signin");
exception401.put(Keys.STATUS_CODE, 401);
throw new RequestProcessAdviceException(exception401);
context.sendError(401);
context.abort();
}
final String userRole = currentUser.optString(User.USER_ROLE);
if (Role.VISITOR_ROLE.equals(userRole)) {
final JSONObject exception403 = new JSONObject();
exception403.put(Keys.MSG, "Forbidden to request [" + context.requestURI() + "]");
exception403.put(Keys.STATUS_CODE, 403);
throw new RequestProcessAdviceException(exception403);
context.sendError(403);
context.abort();
}
context.handle();
}
}
......@@ -24,10 +24,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Link;
......@@ -41,11 +40,10 @@ import org.json.JSONObject;
* Link console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.4, Dec 11, 2018
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class LinkConsole {
/**
......
......@@ -22,10 +22,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.service.ArchiveDateMgmtService;
import org.b3log.solo.service.TagMgmtService;
......@@ -35,10 +34,10 @@ import org.json.JSONObject;
* Other console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 20, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 3.4.0
*/
@RequestProcessor
@Singleton
public class OtherConsole {
/**
......@@ -77,7 +76,6 @@ public class OtherConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void removeUnusedArchives(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -109,7 +107,6 @@ public class OtherConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void removeUnusedTags(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......
......@@ -24,10 +24,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Common;
......@@ -43,11 +42,10 @@ import org.json.JSONObject;
* Plugin console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.12, Apr 22, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class PageConsole {
/**
......
......@@ -23,10 +23,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.model.Plugin;
import org.b3log.latke.service.LangPropsService;
import org.b3log.solo.service.PluginMgmtService;
......@@ -41,11 +40,10 @@ import java.util.Map;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/mainlove">Love Yao</a>
* @version 1.1.0.5, Dec 11, 2018
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class PluginConsole {
/**
......
......@@ -22,10 +22,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Option;
......@@ -41,11 +40,10 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/hzchendou">hzchendou</a>
* @version 1.2.0.26, Jan 25, 2020
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class PreferenceConsole {
/**
......
......@@ -22,10 +22,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.TextHtmlRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.repository.*;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.ArchiveDateArticleRepository;
......@@ -44,11 +43,10 @@ import java.util.List;
* Provides patches on some special issues.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.0, Nov 11, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 0.3.1
*/
@RequestProcessor
@Before(ConsoleAuthAdvice.class)
@Singleton
public class RepairConsole {
/**
......
......@@ -25,10 +25,9 @@ import org.b3log.latke.Latkes;
import org.b3log.latke.http.Cookie;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.Response;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.solo.model.Common;
......@@ -45,11 +44,10 @@ import java.util.Set;
* Skin console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Mar 29, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 3.5.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class SkinConsole {
/**
......
......@@ -25,13 +25,10 @@ import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.HttpMethod;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessing;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Strings;
......@@ -52,11 +49,10 @@ import java.util.List;
* Static site console request processing. HTML 静态站点生成 https://github.com/88250/solo/issues/19
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.1, Jan 14, 2020
* @version 2.0.0.0, Feb 9, 2020
* @since 3.9.0
*/
@RequestProcessor
@Before(ConsoleAdminAuthAdvice.class)
@Singleton
public class StaticSiteConsole {
/**
......@@ -75,7 +71,6 @@ public class StaticSiteConsole {
*
* @param context the specified request context
*/
@RequestProcessing(value = "/console/staticsite", method = HttpMethod.PUT)
public synchronized void genSite(final RequestContext context) {
try {
final JSONObject requestJSONObject = context.requestJSON();
......
......@@ -22,10 +22,9 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Tag;
import org.b3log.solo.service.TagQueryService;
......@@ -38,10 +37,10 @@ import java.util.List;
* Tag console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.3, Dec 11, 2018
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Singleton
public class TagConsole {
/**
......@@ -72,7 +71,6 @@ public class TagConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAuthAdvice.class)
public void getTags(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -106,7 +104,6 @@ public class TagConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void getUnusedTags(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......
......@@ -24,10 +24,9 @@ import org.apache.logging.log4j.Logger;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.http.annotation.Before;
import org.b3log.latke.http.annotation.RequestProcessor;
import org.b3log.latke.http.renderer.JsonRenderer;
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.model.User;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
......@@ -42,10 +41,10 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/DASHU">DASHU</a>
* @version 1.2.1.7, Mar 29, 2019
* @version 2.0.0.0, Feb 9, 2020
* @since 0.4.0
*/
@RequestProcessor
@Singleton
public class UserConsole {
/**
......@@ -99,7 +98,6 @@ public class UserConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void updateUser(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -135,7 +133,6 @@ public class UserConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void removeUser(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -182,7 +179,6 @@ public class UserConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void getUsers(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -229,7 +225,6 @@ public class UserConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void getUser(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -262,7 +257,6 @@ public class UserConsole {
*
* @param context the specified request context
*/
@Before(ConsoleAdminAuthAdvice.class)
public void changeUserRole(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment