[server] - 优化大量代码

This commit is contained in:
zeaslity
2023-02-16 16:07:03 +08:00
parent 2f2b9da5b7
commit e630b291e3
9 changed files with 171 additions and 52 deletions

View File

@@ -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