Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
2d43e74f
Unverified
Commit
2d43e74f
authored
Jan 13, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#19 静态站点生成
parent
f0537aa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
src/main/java/org/b3log/solo/processor/console/StaticSiteConsole.java
...a/org/b3log/solo/processor/console/StaticSiteConsole.java
+17
-6
No files found.
src/main/java/org/b3log/solo/processor/console/StaticSiteConsole.java
View file @
2d43e74f
...
...
@@ -43,6 +43,7 @@ import org.json.JSONObject;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
...
...
@@ -88,10 +89,20 @@ public class StaticSiteConsole {
FileUtils
.
deleteDirectory
(
new
File
(
staticSitePath
));
FileUtils
.
forceMkdir
(
new
File
(
staticSitePath
));
final
URL
u
=
new
URL
(
url
);
final
String
curScheme
=
Latkes
.
getServerScheme
();
final
String
curHost
=
Latkes
.
getServerHost
();
final
String
curPort
=
Latkes
.
getServerPort
();
// 切换至静态站点生成模式
Latkes
.
setServerScheme
(
"https"
);
Latkes
.
setServerHost
(
url
);
Latkes
.
setServerPort
(
""
);
Latkes
.
setServerScheme
(
u
.
getProtocol
());
Latkes
.
setServerHost
(
u
.
getHost
());
if
(-
1
!=
u
.
getPort
())
{
Latkes
.
setServerPort
(
String
.
valueOf
(
u
.
getPort
()));
}
else
{
Latkes
.
setServerPort
(
""
);
}
Solos
.
GEN_STATIC_SITE
=
true
;
genURI
(
"/tags.html"
);
...
...
@@ -116,9 +127,9 @@ public class StaticSiteConsole {
genFile
(
"CHANGE_LOGS.md"
);
// 恢复之前的动态运行模式
Latkes
.
setServerScheme
(
"http"
);
Latkes
.
setServerHost
(
"localhost"
);
Latkes
.
setServerPort
(
"8080"
);
Latkes
.
setServerScheme
(
curScheme
);
Latkes
.
setServerHost
(
curHost
);
Latkes
.
setServerPort
(
curPort
);
Solos
.
GEN_STATIC_SITE
=
false
;
LOGGER
.
log
(
Level
.
INFO
,
"Static site generated [dir="
+
staticSitePath
+
"]"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment