Commit b93deb7e authored by Liang Ding's avatar Liang Ding

💥 #12530

parent 2ce472df
...@@ -35,7 +35,7 @@ import java.util.regex.Pattern; ...@@ -35,7 +35,7 @@ import java.util.regex.Pattern;
* Permalink query service. * Permalink query service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.4, Sep 7, 2018 * @version 1.0.0.5, Sep 26, 2018
* @since 0.6.1 * @since 0.6.1
*/ */
@Service @Service
...@@ -62,8 +62,7 @@ public class PermalinkQueryService { ...@@ -62,8 +62,7 @@ public class PermalinkQueryService {
* Reserved permalinks. * Reserved permalinks.
*/ */
public static final String[] RESERVED_LINKS = new String[]{ public static final String[] RESERVED_LINKS = new String[]{
"/", "/article", "/tags.html", "/tags", "/page", "/blog-articles-feed.do", "/tag-articles-feed.do", "/blog-articles-rss.do", "/", "/article", "/tags.html", "/tags", "/page", "/atom.xml", "/rss.xml", "/get-random-articles.do", "/captcha.do", "/kill-browser",
"/tag-articles-rss.do", "/get-random-articles.do", "/captcha.do", "/kill-browser",
"/add-article-comment.do", "/add-article-from-symphony-comment.do", "/add-page-comment.do", "/get-article-content", "/sitemap.xml", "/add-article-comment.do", "/add-article-from-symphony-comment.do", "/add-page-comment.do", "/get-article-content", "/sitemap.xml",
"/login", "/logout", "/forgot", "/get-article-content", "/admin-index.do", "/admin-article.do", "/admin-article-list.do", "/login", "/logout", "/forgot", "/get-article-content", "/admin-index.do", "/admin-article.do", "/admin-article-list.do",
"/admin-link-list.do", "/admin-preference.do", "/admin-file-list.do", "/admin-page-list.do", "/admin-others.do", "/admin-link-list.do", "/admin-preference.do", "/admin-file-list.do", "/admin-page-list.do", "/admin-others.do",
......
...@@ -117,7 +117,7 @@ var soloKanbanniang = { ...@@ -117,7 +117,7 @@ var soloKanbanniang = {
}); });
$('#soloKanbanniangRSS').click(function() { $('#soloKanbanniangRSS').click(function() {
window.location = latkeConfig.servePath + '/blog-articles-rss.do'; window.location = latkeConfig.servePath + '/rss.xml';
}); });
$('#soloKanbanniangGithub').click(function() { $('#soloKanbanniangGithub').click(function() {
......
User-agent: * User-agent: *
Allow: /blog-articles-feed.do
Allow: /tag-articles-feed.do*
Disallow: /*.do Disallow: /*.do
Disallow: /login Disallow: /login
Disallow: /logout Disallow: /logout
......
Subproject commit c2c29ee93631faf3b69292de03345cc8740e5b8c Subproject commit f197f14243b60c389a334fa39dabd563ea6e039a
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
package org.b3log.solo.processor; package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.model.User; import org.b3log.latke.model.User;
import org.b3log.latke.repository.Query;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.service.InitService; import org.b3log.solo.service.InitService;
import org.b3log.solo.service.UserQueryService; import org.b3log.solo.service.UserQueryService;
...@@ -41,7 +39,7 @@ import static org.mockito.Mockito.when; ...@@ -41,7 +39,7 @@ import static org.mockito.Mockito.when;
* {@link FeedProcessor} test case. * {@link FeedProcessor} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.2, Oct 21, 2017 * @version 1.0.0.3, Sep 26, 2018
* @since 1.7.0 * @since 1.7.0
*/ */
@Test(suiteName = "processor") @Test(suiteName = "processor")
...@@ -76,7 +74,7 @@ public class FeedProcessorTestCase extends AbstractTestCase { ...@@ -76,7 +74,7 @@ public class FeedProcessorTestCase extends AbstractTestCase {
public void blogArticlesAtom() throws Exception { public void blogArticlesAtom() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class); final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getServletContext()).thenReturn(mock(ServletContext.class)); when(request.getServletContext()).thenReturn(mock(ServletContext.class));
when(request.getRequestURI()).thenReturn("/blog-articles-feed.do"); when(request.getRequestURI()).thenReturn("/atom.xml");
when(request.getMethod()).thenReturn("GET"); when(request.getMethod()).thenReturn("GET");
final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet(); final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet();
...@@ -94,36 +92,6 @@ public class FeedProcessorTestCase extends AbstractTestCase { ...@@ -94,36 +92,6 @@ public class FeedProcessorTestCase extends AbstractTestCase {
Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\"")); Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\""));
} }
/**
* tagArticlesAtom.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void tagArticlesAtom() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getServletContext()).thenReturn(mock(ServletContext.class));
when(request.getRequestURI()).thenReturn("/tag-articles-feed.do");
when(request.getMethod()).thenReturn("GET");
final JSONObject tag = getTagRepository().get(new Query()).optJSONArray(Keys.RESULTS).optJSONObject(0);
when(request.getParameter(Keys.OBJECT_ID)).thenReturn(tag.optString(Keys.OBJECT_ID));
final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet();
dispatcherServlet.init();
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
final HttpServletResponse response = mock(HttpServletResponse.class);
when(response.getWriter()).thenReturn(printWriter);
dispatcherServlet.service(request, response);
final String content = stringWriter.toString();
Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\""));
}
/** /**
* blogArticlesRSS. * blogArticlesRSS.
* *
...@@ -133,7 +101,7 @@ public class FeedProcessorTestCase extends AbstractTestCase { ...@@ -133,7 +101,7 @@ public class FeedProcessorTestCase extends AbstractTestCase {
public void blogArticlesRSS() throws Exception { public void blogArticlesRSS() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class); final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getServletContext()).thenReturn(mock(ServletContext.class)); when(request.getServletContext()).thenReturn(mock(ServletContext.class));
when(request.getRequestURI()).thenReturn("/blog-articles-rss.do"); when(request.getRequestURI()).thenReturn("/rss.xml");
when(request.getMethod()).thenReturn("GET"); when(request.getMethod()).thenReturn("GET");
final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet(); final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet();
dispatcherServlet.init(); dispatcherServlet.init();
...@@ -149,33 +117,4 @@ public class FeedProcessorTestCase extends AbstractTestCase { ...@@ -149,33 +117,4 @@ public class FeedProcessorTestCase extends AbstractTestCase {
final String content = stringWriter.toString(); final String content = stringWriter.toString();
Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\"")); Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\""));
} }
/**
* tagArticlesRSS.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void tagArticlesRSS() throws Exception {
final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getServletContext()).thenReturn(mock(ServletContext.class));
when(request.getRequestURI()).thenReturn("/tag-articles-rss.do");
when(request.getMethod()).thenReturn("GET");
final JSONObject tag = getTagRepository().get(new Query()).optJSONArray(Keys.RESULTS).optJSONObject(0);
when(request.getParameter(Keys.OBJECT_ID)).thenReturn(tag.optString(Keys.OBJECT_ID));
final MockDispatcherServlet dispatcherServlet = new MockDispatcherServlet();
dispatcherServlet.init();
final StringWriter stringWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter(stringWriter);
final HttpServletResponse response = mock(HttpServletResponse.class);
when(response.getWriter()).thenReturn(printWriter);
dispatcherServlet.service(request, response);
final String content = stringWriter.toString();
Assert.assertTrue(StringUtils.startsWith(content, "<?xml version=\"1.0\""));
}
} }
====
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-2018, b3log.org & hacpai.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
====
User-agent: * User-agent: *
Allow: /blog-articles-feed.do
Allow: /tag-articles-feed.do*
Disallow: /*.do Disallow: /*.do
Disallow: /login Disallow: /login
Disallow: /logout Disallow: /logout
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<meta name="copyright" content="B3log" /> <meta name="copyright" content="B3log" />
<meta http-equiv="Window-target" content="_top" /> <meta http-equiv="Window-target" content="_top" />
<link type="text/css" rel="stylesheet" href="${staticServePath}/skins/${skinDirName}/css/base${miniPostfix}.css?${staticResourceVersion}" charset="utf-8" /> <link type="text/css" rel="stylesheet" href="${staticServePath}/skins/${skinDirName}/css/base${miniPostfix}.css?${staticResourceVersion}" charset="utf-8" />
<link href="${servePath}/blog-articles-rss.do" title="RSS" type="application/rss+xml" rel="alternate" /> <link href="${servePath}/rss.xml" title="RSS" type="application/rss+xml" rel="alternate" />
<link rel="icon" type="image/png" href="${servePath}/favicon.png" /> <link rel="icon" type="image/png" href="${servePath}/favicon.png" />
<link rel="manifest" href="${servePath}/manifest.json"> <link rel="manifest" href="${servePath}/manifest.json">
<link rel="search" type="application/opensearchdescription+xml" title="${title}" href="/opensearch.xml"> <link rel="search" type="application/opensearchdescription+xml" title="${title}" href="/opensearch.xml">
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</svg> ${linkLabel} </svg> ${linkLabel}
</a> </a>
<a rel="alternate" href="${servePath}/blog-articles-rss.do" rel="section"> <a rel="alternate" href="${servePath}/rss.xml" rel="section">
<svg> <svg>
<use xlink:href="#icon-feed"></use> <use xlink:href="#icon-feed"></use>
</svg> </svg>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<#list pageNavigations as page> <#list pageNavigations as page>
<li><a href="${page.pagePermalink}" target="${page.pageOpenTarget}"><#if page.pageIcon != ''><img class="page-icon" src="${page.pageIcon}"></#if>${page.pageTitle}</a></li> <li><a href="${page.pagePermalink}" target="${page.pageOpenTarget}"><#if page.pageIcon != ''><img class="page-icon" src="${page.pageIcon}"></#if>${page.pageTitle}</a></li>
</#list> </#list>
<li><a rel="alternate" href="${servePath}/blog-articles-rss.do"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/RSS.png" alt="" />RSS Feed</a></li> <li><a rel="alternate" href="${servePath}/rss.xml"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/RSS.png" alt="" />RSS Feed</a></li>
<li><a href="${servePath}/search?keyword=">Search</a></li> <li><a href="${servePath}/search?keyword=">Search</a></li>
</ul> </ul>
<ul id="head-tags"> <ul id="head-tags">
......
...@@ -63,7 +63,7 @@ overflow: hidden; ...@@ -63,7 +63,7 @@ overflow: hidden;
} }
</style> </style>
<link href="${servePath}/blog-articles-rss.do" title="RSS" type="application/rss+xml" rel="alternate" /> <link href="${servePath}/rss.xml" title="RSS" type="application/rss+xml" rel="alternate" />
<link rel="icon" type="image/png" href="${servePath}/favicon.png" /> <link rel="icon" type="image/png" href="${servePath}/favicon.png" />
<script type='text/javascript' src='${staticServePath}/skins/${skinDirName}/js/l10n${miniPostfix}.js?${staticResourceVersion}'></script> <script type='text/javascript' src='${staticServePath}/skins/${skinDirName}/js/l10n${miniPostfix}.js?${staticResourceVersion}'></script>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script> <script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
......
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