Przeglądaj źródła

Svelte: Restore welcome message

Compared to the side bar is much more visible
Alessandro Pignotti 9 miesięcy temu
rodzic
commit
134a947547
2 zmienionych plików z 36 dodań i 0 usunięć
  1. 29 0
      src/lib/messages.js
  2. 7 0
      src/routes/+page.svelte

+ 29 - 0
src/lib/messages.js

@@ -0,0 +1,29 @@
+const underline= "\x1b[94;4m";
+const normal= "\x1b[0m";
+export const introMessage = [
+	"+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+",
+	"|                                                                             |",
+	"| WebVM is a server-less virtual Linux environment running fully client-side  |",
+	"| in HTML5/WebAssembly.                                                       |",
+	"|                                                                             |",
+	"| WebVM is powered by the CheerpX virtualization engine, which enables safe,  |",
+	"| sandboxed client-side execution of x86 binaries on any browser.             |",
+	"|                                                                             |",
+	"| CheerpX includes an x86-to-WebAssembly JIT compiler, a virtual block-based  |",
+	"| file system, and a Linux syscall emulator.                                  |",
+	"|                                                                             |",
+	"| Your own WebVM with custom images via Dockerfile:                           |",
+	"|                                                                             |",
+	"| " + underline + "https://leaningtech.com/mini-webvm-your-linux-box-from-dockerfile-via-wasm" + normal +"  |",
+	"|                                                                             |",
+	"+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+",
+	"",
+	"   Welcome to WebVM. If unsure, try these examples:",
+	"",
+	"     python3 examples/python3/fibonacci.py ",
+	"     gcc -o helloworld examples/c/helloworld.c && ./helloworld",
+	"     objdump -d ./helloworld | less -M",
+	"     vim examples/c/helloworld.c",
+	"     curl --max-time 15 parrot.live  # requires networking",
+	"",
+];

+ 7 - 0
src/routes/+page.svelte

@@ -12,6 +12,7 @@
 	import '@fortawesome/fontawesome-free/css/all.min.css'
 	import { networkInterface, startLogin } from '$lib/network.js'
 	import { cpuActivity, diskActivity } from '$lib/activities.js'
+	import { introMessage } from '$lib/messages.js'
 
 	var term = new Terminal({cursorBlink:true, convertEol:true, fontFamily:"monospace", fontWeight: 400, fontWeightBold: 700});
 	var cx = null;
@@ -31,6 +32,11 @@
 		for(var i=0;i<str.length;i++)
 			cxReadFunc(str.charCodeAt(i));
 	}
+	function printMessage(msg)
+	{
+		for(var i=0;i<msg.length;i++)
+			term.write(msg[i] + "\n");
+	}
 	function hddCallback(state)
 	{
 		diskActivity.set(state != "ready");
@@ -57,6 +63,7 @@
 		consoleDiv.addEventListener("dragenter", preventDefaults, false);
 		consoleDiv.addEventListener("dragleave", preventDefaults, false);
 		consoleDiv.addEventListener("drop", preventDefaults, false);
+		printMessage(introMessage);
 		initCheerpX();
 	}
 	async function initCheerpX()