forked from epic-developer/CloudVM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv2.html
More file actions
55 lines (52 loc) · 1.92 KB
/
v2.html
File metadata and controls
55 lines (52 loc) · 1.92 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!doctype html>
<html lang="en" style="height: 100%;">
<head>
<meta charset="utf-8" />
<title>CheerpX Getting Started</title>
<script src="https://cxrtnc.leaningtech.com/1.1.2/cx.js"></script>
<script type="module">
// The read-only disk image from Leaning Technologies' fast cloud backend
const cloudDevice = await CheerpX.CloudDevice.create(
"wss://disks.webvm.io/debian_large_20230522_5044875331.ext2"
);
// Read-write local storage for disk blocks, it is used both as a cache and as persisteny writable storage
const idbDevice = await CheerpX.IDBDevice.create("block1");
// A device to overlay the local changes to the disk with the remote read-only image
const overlayDevice = await CheerpX.OverlayDevice.create(
cloudDevice,
idbDevice
);
// Direct acces to files in your HTTP server
const webDevice = await CheerpX.WebDevice.create("");
// Convenient access to JavaScript binary data and strings
const dataDevice = await CheerpX.DataDevice.create();
const cx = await CheerpX.Linux.create({
mounts: [
{ type: "ext2", path: "/", dev: overlayDevice },
{ type: "dir", path: "/app", dev: webDevice },
{ type: "dir", path: "/data", dev: dataDevice },
{ type: "devs", path: "/dev" },
],
});
// Interact with a console
cx.setConsole(document.getElementById("console"));
// Run a full-featured shell in your browser.
await cx.run("/bin/bash", ["--login"], {
env: [
"HOME=/home/user",
"USER=user",
"SHELL=/bin/bash",
"EDITOR=vim",
"LANG=en_US.UTF-8",
"LC_ALL=C",
],
cwd: "/home/user",
uid: 1000,
gid: 1000,
});
</script>
</head>
<body style="height: 100%; background: black;">
<pre id="console" style="height: 100%;"></pre>
</body>
</html>