Svelte: Expose more extensive configuration from the main WebVM component
This commit is contained in:
parent
bb46f1340e
commit
f7fc244db4
4 changed files with 26 additions and 24 deletions
|
@ -1,2 +1,23 @@
|
||||||
|
// The root filesystem location
|
||||||
export const diskImageUrl = "wss://disks.webvm.io/debian_large_20230522_5044875331.ext2";
|
export const diskImageUrl = "wss://disks.webvm.io/debian_large_20230522_5044875331.ext2";
|
||||||
|
// The root filesystem backend type
|
||||||
export const diskImageType = "cloud";
|
export const diskImageType = "cloud";
|
||||||
|
// Print an introduction message about the technology
|
||||||
|
export const printIntro = true;
|
||||||
|
// Is a graphical display needed
|
||||||
|
export const needsDisplay = false;
|
||||||
|
// Executable full path (Required)
|
||||||
|
export const cmd = "/bin/bash";
|
||||||
|
// Arguments, as an array (Required)
|
||||||
|
export const args = ["--login"];
|
||||||
|
// Optional extra parameters
|
||||||
|
export const opts = {
|
||||||
|
// Environment variables
|
||||||
|
env: ["HOME=/home/user", "TERM=xterm", "USER=user", "SHELL=/bin/bash", "EDITOR=vim", "LANG=en_US.UTF-8", "LC_ALL=C"],
|
||||||
|
// Current working directory
|
||||||
|
cwd: "/home/user",
|
||||||
|
// User id
|
||||||
|
uid: 1000,
|
||||||
|
// Group id
|
||||||
|
gid: 1000
|
||||||
|
};
|
||||||
|
|
|
@ -64,6 +64,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);
|
||||||
|
if(configObj.printIntro)
|
||||||
printMessage(introMessage);
|
printMessage(introMessage);
|
||||||
initCheerpX();
|
initCheerpX();
|
||||||
}
|
}
|
||||||
|
@ -133,30 +134,10 @@
|
||||||
cx.registerCallback("diskActivity", hddCallback);
|
cx.registerCallback("diskActivity", hddCallback);
|
||||||
term.scrollToBottom();
|
term.scrollToBottom();
|
||||||
cxReadFunc = cx.setCustomConsole(writeData, term.cols, term.rows);
|
cxReadFunc = cx.setCustomConsole(writeData, term.cols, term.rows);
|
||||||
// Reasonable defaults for local deployments
|
|
||||||
// var cmd = "/bin/bash";
|
|
||||||
// var args = ["--login"];
|
|
||||||
// var env = ["HOME=/home/user", "TERM=xterm", "USER=user", "SHELL=/bin/bash", "EDITOR=vim", "LANG=en_US.UTF-8", "LC_ALL=C"];
|
|
||||||
// var cwd = "/home/user";
|
|
||||||
// Executable full path (Required)
|
|
||||||
var cmd = "/bin/bash";
|
|
||||||
// Arguments, as an array (Required)
|
|
||||||
var args = ["--login"]
|
|
||||||
// Optional extra parameters
|
|
||||||
var opts = {
|
|
||||||
// Environment variables
|
|
||||||
env: ["HOME=/home/user", "TERM=xterm", "USER=user", "SHELL=/bin/bash", "EDITOR=vim", "LANG=en_US.UTF-8", "LC_ALL=C"],
|
|
||||||
// Current working directory
|
|
||||||
cwd: "/home/user",
|
|
||||||
// User id
|
|
||||||
uid: 1000,
|
|
||||||
// Group id
|
|
||||||
gid: 1000
|
|
||||||
};
|
|
||||||
// Run the command in a loop, in case the user exits
|
// Run the command in a loop, in case the user exits
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
await cx.run(cmd, args, opts);
|
await cx.run(configObj.cmd, configObj.args, configObj.opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMount(initTerminal);
|
onMount(initTerminal);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import WebVM from '$lib/WebVM.svelte';
|
import WebVM from '$lib/WebVM.svelte';
|
||||||
import * as configObj from 'config_terminal'
|
import * as configObj from '/config_terminal'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<WebVM configObj={configObj} />
|
<WebVM configObj={configObj} />
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'config_terminal': 'config_public_terminal.js'
|
'/config_terminal': 'config_public_terminal.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
|
Loading…
Reference in a new issue