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
7b90be19
Unverified
Commit
7b90be19
authored
Jan 02, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
改进社区备份
parent
73afcea7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
14 deletions
+23
-14
src/main/java/org/b3log/solo/event/B3ArticleSender.java
src/main/java/org/b3log/solo/event/B3ArticleSender.java
+2
-8
src/main/java/org/b3log/solo/event/B3CommentSender.java
src/main/java/org/b3log/solo/event/B3CommentSender.java
+1
-1
src/main/java/org/b3log/solo/service/ExportService.java
src/main/java/org/b3log/solo/service/ExportService.java
+6
-3
src/main/java/org/b3log/solo/util/Solos.java
src/main/java/org/b3log/solo/util/Solos.java
+14
-2
No files found.
src/main/java/org/b3log/solo/event/B3ArticleSender.java
View file @
7b90be19
...
...
@@ -29,7 +29,6 @@ import org.b3log.latke.ioc.Singleton;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.Server
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Common
;
...
...
@@ -95,8 +94,8 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
return
;
}
if
(
isLocalServer
())
{
LOGGER
.
log
(
Level
.
INFO
,
"Solo is running on
a
local server [servePath="
+
Latkes
.
getServePath
()
+
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
;
...
...
@@ -134,11 +133,6 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
}
}
static
boolean
isLocalServer
()
{
return
StringUtils
.
containsIgnoreCase
(
Latkes
.
getServePath
(),
"localhost"
)
||
Strings
.
isIPv4
(
Latkes
.
getServerHost
())
||
(
StringUtils
.
isNotBlank
(
Latkes
.
getServerPort
()))
&&
!
"80"
.
equals
(
Latkes
.
getServerPort
())
&&
!
"443"
.
equals
(
Latkes
.
getServerPort
());
}
/**
* Gets the event type {@linkplain EventTypes#ADD_ARTICLE}.
*
...
...
src/main/java/org/b3log/solo/event/B3CommentSender.java
View file @
7b90be19
...
...
@@ -87,7 +87,7 @@ public class B3CommentSender extends AbstractEventListener<JSONObject> {
return
;
}
if
(
B3ArticleSender
.
isLocalServer
())
{
if
(
Solos
.
isLocalServer
())
{
return
;
}
...
...
src/main/java/org/b3log/solo/service/ExportService.java
View file @
7b90be19
...
...
@@ -58,7 +58,7 @@ import java.util.stream.Collectors;
* Export service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.
4, Dec 15, 2019
* @version 1.1.1.
5, Jan 2, 2020
* @since 2.5.0
*/
@Service
...
...
@@ -273,11 +273,14 @@ public class ExportService {
return
;
}
if
(
Latkes
.
getServePath
().
contains
(
"localhost"
)
||
Strings
.
isIPv4
(
Latkes
.
getServerHost
()
))
{
if
(
Latkes
.
RuntimeMode
.
PRODUCTION
!=
Latkes
.
getRuntimeMode
(
))
{
return
;
}
if
(
Latkes
.
RuntimeMode
.
PRODUCTION
!=
Latkes
.
getRuntimeMode
())
{
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
;
}
...
...
src/main/java/org/b3log/solo/util/Solos.java
View file @
7b90be19
...
...
@@ -40,13 +40,15 @@ import org.b3log.solo.model.UserExt;
import
org.b3log.solo.repository.UserRepository
;
import
org.json.JSONObject
;
import
java.util.*
;
import
java.util.MissingResourceException
;
import
java.util.ResourceBundle
;
import
java.util.Set
;
/**
* Solo utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.9.0.
4, Nov 18, 2019
* @version 1.9.0.
5, Jan 2, 2020
* @since 2.8.0
*/
public
final
class
Solos
{
...
...
@@ -115,6 +117,16 @@ public final class Solos {
return
new
JSONObject
().
put
(
Keys
.
CODE
,
0
).
put
(
Keys
.
MSG
,
""
);
}
/**
* Checks whether Solo is running on the local server.
*
* @return {@code true} if it is, returns {@code false} otherwise
*/
public
static
boolean
isLocalServer
()
{
return
StringUtils
.
containsIgnoreCase
(
Latkes
.
getServePath
(),
"localhost"
)
||
Strings
.
isIPv4
(
Latkes
.
getServerHost
())
||
(
StringUtils
.
isNotBlank
(
Latkes
.
getServerPort
()))
&&
!
"80"
.
equals
(
Latkes
.
getServerPort
())
&&
!
"443"
.
equals
(
Latkes
.
getServerPort
());
}
/**
* Constructs a failed result.
*
...
...
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