32 lines
1.2 KiB
HTML
32 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>CheerpJ test</title>
|
|
<script src="mcutils.js"></script>
|
|
<script src="https://cjrtnc.leaningtech.com/3_20231222_329/cj3loader.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="display" style="width:100%;height:100%;position:absolute;top:0;left:0px;"></div>
|
|
<p id="ip"></p>
|
|
<script>
|
|
function ipCallback(ip)
|
|
{
|
|
document.getElementById("ip").textContent = "Server IP: "+ip;
|
|
}
|
|
async function runServer()
|
|
{
|
|
await cheerpjInit({tailscaleAuthKey:"tskey-auth-k9RsJp3CNTRL-xcmTEoqDeYjUVQpzCwwUejtL5bLq9MZVS",tailscaleIpCb:ipCallback});
|
|
// TODO: Run with nogui
|
|
cheerpjCreateDisplay(-1, -1, document.getElementById("display"));
|
|
// The server needs to write a few files to its cwd, copy it over to /files/
|
|
await installFile("https://piston-data.mojang.com/v1/objects/d8321edc9470e56b8ad5c67bbd16beba25843336/server.jar", "/files/server_1.2.5.jar");
|
|
// Copy over a modified configuration allowing any client to connect
|
|
await installFile("/server.properties", "/files/server.properties");
|
|
await cheerpjRunJar("/files/server_1.2.5.jar");
|
|
}
|
|
runServer();
|
|
</script>
|
|
</body>
|
|
</html>
|