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
324e6fc6
Unverified
Commit
324e6fc6
authored
Jan 12, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#37
parent
fb427cc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
20 deletions
+9
-20
src/main/java/org/b3log/solo/event/B3ArticleSender.java
src/main/java/org/b3log/solo/event/B3ArticleSender.java
+1
-8
src/main/java/org/b3log/solo/service/ExportService.java
src/main/java/org/b3log/solo/service/ExportService.java
+8
-12
No files found.
src/main/java/org/b3log/solo/event/B3ArticleSender.java
View file @
324e6fc6
...
@@ -47,7 +47,7 @@ import org.json.JSONObject;
...
@@ -47,7 +47,7 @@ import org.json.JSONObject;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/armstrong">ArmstrongCN</a>
* @author <a href="https://hacpai.com/member/armstrong">ArmstrongCN</a>
* @version 1.0.2.2
4, Jan 5
, 2020
* @version 1.0.2.2
5, Jan 12
, 2020
* @since 0.3.1
* @since 0.3.1
*/
*/
@Singleton
@Singleton
...
@@ -94,13 +94,6 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
...
@@ -94,13 +94,6 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
return
;
return
;
}
}
if
(
Solos
.
isLocalServer
())
{
LOGGER
.
log
(
Level
.
INFO
,
"Solo is running on the local server [servePath="
+
Latkes
.
getServePath
()
+
", serverHost="
+
Latkes
.
getServerHost
()
+
", serverPort="
+
Latkes
.
getServerPort
()
+
"], ignored push article [title="
+
title
+
"] to Rhy"
);
return
;
}
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
final
OptionQueryService
optionQueryService
=
beanManager
.
getReference
(
OptionQueryService
.
class
);
final
OptionQueryService
optionQueryService
=
beanManager
.
getReference
(
OptionQueryService
.
class
);
final
ArticleQueryService
articleQueryService
=
beanManager
.
getReference
(
ArticleQueryService
.
class
);
final
ArticleQueryService
articleQueryService
=
beanManager
.
getReference
(
ArticleQueryService
.
class
);
...
...
src/main/java/org/b3log/solo/service/ExportService.java
View file @
324e6fc6
...
@@ -58,7 +58,7 @@ import java.util.stream.Collectors;
...
@@ -58,7 +58,7 @@ import java.util.stream.Collectors;
* Export service.
* Export service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.
5, Jan
2, 2020
* @version 1.1.1.
6, Jan 1
2, 2020
* @since 2.5.0
* @since 2.5.0
*/
*/
@Service
@Service
...
@@ -262,7 +262,6 @@ public class ExportService {
...
@@ -262,7 +262,6 @@ public class ExportService {
* Exports public articles to admin's HacPai account.
* Exports public articles to admin's HacPai account.
*/
*/
public
void
exportHacPai
()
{
public
void
exportHacPai
()
{
LOGGER
.
log
(
Level
.
INFO
,
"Backup public articles to HacPai...."
);
try
{
try
{
final
JSONObject
preference
=
optionQueryService
.
getPreference
();
final
JSONObject
preference
=
optionQueryService
.
getPreference
();
if
(
null
==
preference
)
{
if
(
null
==
preference
)
{
...
@@ -273,19 +272,12 @@ public class ExportService {
...
@@ -273,19 +272,12 @@ public class ExportService {
return
;
return
;
}
}
if
(
Latkes
.
RuntimeMode
.
PRODUCTION
!=
Latkes
.
getRuntimeMode
())
{
LOGGER
.
log
(
Level
.
INFO
,
"Backup all articles to HacPai...."
);
return
;
}
if
(
Solos
.
isLocalServer
())
{
LOGGER
.
log
(
Level
.
INFO
,
"Solo is running on the local server [servePath="
+
Latkes
.
getServePath
()
+
", serverHost="
+
Latkes
.
getServerHost
()
+
", serverPort="
+
Latkes
.
getServerPort
()
+
"], ignored backup articles to HacPai"
);
return
;
}
final
JSONObject
mds
=
exportHexoMDs
();
final
JSONObject
mds
=
exportHexoMDs
();
final
List
<
JSONObject
>
posts
=
(
List
<
JSONObject
>)
mds
.
opt
(
"posts"
);
final
List
<
JSONObject
>
posts
=
(
List
<
JSONObject
>)
mds
.
opt
(
"posts"
);
final
List
<
JSONObject
>
passwords
=
(
List
<
JSONObject
>)
mds
.
opt
(
"passwords"
);
final
List
<
JSONObject
>
drafts
=
(
List
<
JSONObject
>)
mds
.
opt
(
"drafts"
);
final
String
tmpDir
=
System
.
getProperty
(
"java.io.tmpdir"
);
final
String
tmpDir
=
System
.
getProperty
(
"java.io.tmpdir"
);
final
String
date
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMddHHmmss"
);
final
String
date
=
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMddHHmmss"
);
...
@@ -294,6 +286,10 @@ public class ExportService {
...
@@ -294,6 +286,10 @@ public class ExportService {
final
File
postDir
=
new
File
(
localFilePath
+
File
.
separator
+
"posts"
);
final
File
postDir
=
new
File
(
localFilePath
+
File
.
separator
+
"posts"
);
exportHexoMd
(
posts
,
postDir
.
getPath
());
exportHexoMd
(
posts
,
postDir
.
getPath
());
final
File
passwordDir
=
new
File
(
localFilePath
+
File
.
separator
+
"passwords"
);
exportHexoMd
(
passwords
,
passwordDir
.
getPath
());
final
File
draftDir
=
new
File
(
localFilePath
+
File
.
separator
+
"drafts"
);
exportHexoMd
(
drafts
,
draftDir
.
getPath
());
final
File
zipFile
=
ZipUtil
.
zip
(
localFile
);
final
File
zipFile
=
ZipUtil
.
zip
(
localFile
);
byte
[]
zipData
;
byte
[]
zipData
;
...
...
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