Svelte: Restore welcome message

Compared to the side bar is much more visible
This commit is contained in:
Alessandro Pignotti 2024-10-13 22:14:40 +02:00
parent 854b93ec07
commit 134a947547
2 changed files with 36 additions and 0 deletions

29
src/lib/messages.js Normal file
View file

@ -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",
"",
];

View file

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