[server] - 优化大量代码
This commit is contained in:
@@ -40,6 +40,25 @@ public class XrayConfigDistribute {
|
||||
private static final String updateCommandType = "OctopusXray";
|
||||
|
||||
static {
|
||||
|
||||
ArrayList<String> zero = new ArrayList<>(
|
||||
List.of(
|
||||
"if",
|
||||
"[",
|
||||
"!",
|
||||
"-f",
|
||||
"/usr/local/etc/xray/config.json",
|
||||
"]",
|
||||
";",
|
||||
"then",
|
||||
"touch",
|
||||
"/usr/local/etc/xray/config.json",
|
||||
";",
|
||||
"fi"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
ArrayList<String> first = new ArrayList<>(
|
||||
List.of(
|
||||
"mv",
|
||||
@@ -79,6 +98,7 @@ public class XrayConfigDistribute {
|
||||
);
|
||||
|
||||
|
||||
updateXrayCommandList.add(zero);
|
||||
updateXrayCommandList.add(first);
|
||||
updateXrayCommandList.add(second);
|
||||
updateXrayCommandList.add(third);
|
||||
@@ -146,19 +166,21 @@ public class XrayConfigDistribute {
|
||||
}
|
||||
// 修改命令中的时间
|
||||
String s = updateXrayCommandList
|
||||
.get(0)
|
||||
.get(1)
|
||||
.get(2);
|
||||
updateXrayCommandList
|
||||
.get(0)
|
||||
.get(1)
|
||||
.set(
|
||||
2,
|
||||
s.replace("TIME",
|
||||
formatTimeString)
|
||||
s.replace(
|
||||
"TIME",
|
||||
formatTimeString
|
||||
)
|
||||
);
|
||||
|
||||
// 修改命令中的下载url
|
||||
updateXrayCommandList
|
||||
.get(1)
|
||||
.get(2)
|
||||
.set(
|
||||
1,
|
||||
realUrl
|
||||
|
||||
Reference in New Issue
Block a user