-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmc_server.html
31 lines (31 loc) · 1.16 KB
/
mc_server.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!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>