Commit e9200f95 authored by Liang Ding's avatar Liang Ding

🐛 修复生成静态站点链接问题 Fix #70

parent be29ff9c
...@@ -49,7 +49,7 @@ import java.util.List; ...@@ -49,7 +49,7 @@ import java.util.List;
* Static site console request processing. HTML 静态站点生成 https://github.com/88250/solo/issues/19 * Static site console request processing. HTML 静态站点生成 https://github.com/88250/solo/issues/19
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.0.0, Feb 9, 2020 * @version 2.0.1.0, Feb 27, 2020
* @since 3.9.0 * @since 3.9.0
*/ */
@Singleton @Singleton
...@@ -93,18 +93,12 @@ public class StaticSiteConsole { ...@@ -93,18 +93,12 @@ public class StaticSiteConsole {
FileUtils.forceMkdir(new File(staticSitePath)); FileUtils.forceMkdir(new File(staticSitePath));
final URL u = new URL(url); final URL u = new URL(url);
Latkes.setScheme(u.getProtocol());
final String curScheme = Latkes.getServerScheme(); Latkes.setHost(u.getHost());
final String curHost = Latkes.getServerHost();
final String curPort = Latkes.getServerPort();
// 切换至静态站点生成模式
Latkes.setServerScheme(u.getProtocol());
Latkes.setServerHost(u.getHost());
if (-1 != u.getPort()) { if (-1 != u.getPort()) {
Latkes.setServerPort(String.valueOf(u.getPort())); Latkes.setPort(String.valueOf(u.getPort()));
} else { } else {
Latkes.setServerPort(""); Latkes.setPort("");
} }
Solos.GEN_STATIC_SITE = true; Solos.GEN_STATIC_SITE = true;
...@@ -129,10 +123,6 @@ public class StaticSiteConsole { ...@@ -129,10 +123,6 @@ public class StaticSiteConsole {
genFile("robots.txt"); genFile("robots.txt");
genFile("CHANGE_LOGS.md"); genFile("CHANGE_LOGS.md");
// 恢复之前的动态运行模式
Latkes.setServerScheme(curScheme);
Latkes.setServerHost(curHost);
Latkes.setServerPort(curPort);
Solos.GEN_STATIC_SITE = false; Solos.GEN_STATIC_SITE = false;
LOGGER.log(Level.INFO, "Static site generated [dir=" + staticSitePath + "]"); LOGGER.log(Level.INFO, "Static site generated [dir=" + staticSitePath + "]");
......
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