terminal initializes successfully, scuffed intro visuals, termianl still visible with the login form, user temporarily locked to gornodox only. all algorithms work for now, needs to check for bugs and merge to master befpre build. SIDE NOTE - *Make domain builds only from the* master *branch.*
This commit is contained in:
+28
-21
@@ -10,6 +10,17 @@
|
||||
|
||||
const printOutput = (e: HTMLElement, d: PrintData): void => print(e, d);
|
||||
|
||||
export async function init(password: string) {
|
||||
try {
|
||||
terminal = await initTerminal({ username: 'gornodox', password}, callbackInit, 'en_US');
|
||||
updateTerminal();
|
||||
} catch (error) {
|
||||
console.error('onMount trycatch failed', error);
|
||||
}
|
||||
|
||||
runTerminal();
|
||||
}
|
||||
|
||||
function updateTerminal() {
|
||||
username = terminal!.getUser().username;
|
||||
cwd = terminal!.getCwd();
|
||||
@@ -66,6 +77,10 @@
|
||||
elem.scrollTop = elem.scrollHeight;
|
||||
}
|
||||
|
||||
function runTerminal() {
|
||||
document.getElementById('terminal-window')?.classList.remove('hidden');
|
||||
}
|
||||
|
||||
//Callback initializer
|
||||
const callbackInit = {
|
||||
print: (data: any) => {
|
||||
@@ -78,35 +93,17 @@
|
||||
getFontSize: getFontSize
|
||||
};
|
||||
|
||||
//Test user with basic data so the bash can run
|
||||
let testUser: User = {
|
||||
username: 'kamil',
|
||||
passwd: '123',
|
||||
uid: 0,
|
||||
gid: 0,
|
||||
home: '/home/kamil',
|
||||
history: []
|
||||
};
|
||||
|
||||
//Empty terminal variable where the terminal class instance will be stored
|
||||
let terminal: Terminal;
|
||||
let username: string = $state(testUser.username);
|
||||
let cwd: string = $state(testUser.home);
|
||||
let username: string = $state('');
|
||||
let cwd: string = $state('');
|
||||
|
||||
let inputValue = $state<string>('');
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
terminal = await initTerminal({ username: 'root', password: '123'}, callbackInit, 'en_US');
|
||||
updateTerminal();
|
||||
} catch (error) {
|
||||
console.error('onMount trycatch failed', error);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<label for="input" onkeydowncapture={(event) => inputHandler(event)} class="w-11/12">
|
||||
<div id="terminal" class="terminal-window shadow-() h-full w-full rounded-md shadow-bg">
|
||||
<div id="terminal" class=" transition-discrete terminal-window shadow-() h-full w-full rounded-md shadow-bg">
|
||||
<div
|
||||
class="terminal-bar flex h-9 w-full flex-row items-center rounded-t-md bg-bg-dark text-center font-terminal text-sm font-bold text-primary-dark light:bg-bg-dark-light light:text-primary-light"
|
||||
>
|
||||
@@ -136,6 +133,16 @@
|
||||
* {
|
||||
transition: var(--transition-standard);
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
display: none;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.dots-wrapper {
|
||||
& > button {
|
||||
border: none;
|
||||
|
||||
Reference in New Issue
Block a user