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:
@@ -1,4 +1,5 @@
|
||||
import type { Bash } from "./bash";
|
||||
import type { User } from "./etc/userData";
|
||||
import type { Permission, TimeStamps } from "./metadata";
|
||||
|
||||
export enum Type {
|
||||
@@ -14,8 +15,8 @@ export type NodePerms = {
|
||||
};
|
||||
|
||||
export type FsInitArgs = {
|
||||
fs: any;
|
||||
bash: Bash;
|
||||
fs: Map<number, TreeNode>;
|
||||
user: User;
|
||||
};
|
||||
|
||||
export type TreeNode = {
|
||||
@@ -38,7 +39,7 @@ export type TreeNode = {
|
||||
export class VirtualFS {
|
||||
private FsTable: Map<number, TreeNode>;
|
||||
private rootINode: number;
|
||||
private _Bash: Bash;
|
||||
private user: User;
|
||||
|
||||
home: number;
|
||||
cwd: number;
|
||||
@@ -46,11 +47,12 @@ export class VirtualFS {
|
||||
|
||||
constructor(args: FsInitArgs) {
|
||||
this.FsTable = args.fs;
|
||||
this.user = args.user;
|
||||
this.rootINode = 1;
|
||||
this._Bash = args.bash;
|
||||
this.home = this._pathStringToINode(args.bash.getUser().home);
|
||||
this.cwd = args.bash.getUser().cwd ? args.bash.getUser().cwd! : this.home;
|
||||
this.pwd = args.bash.getUser().pwd ? args.bash.getUser().pwd! : this.cwd;
|
||||
|
||||
this.home = this._pathStringToINode(args.user.home);
|
||||
this.cwd = args.user.cwd ? args.user.cwd! : this.home;
|
||||
this.pwd = args.user.pwd ? args.user.pwd! : this.cwd;
|
||||
|
||||
console.log(this.home);
|
||||
console.log(this.cwd);
|
||||
@@ -59,10 +61,12 @@ export class VirtualFS {
|
||||
|
||||
private _iNodeToPathString(inode: number): string {
|
||||
const currentNode = this.FsTable.get(inode);
|
||||
|
||||
if (!currentNode)
|
||||
throw new Error('could not find the node in the fs table - inodetopathstring');
|
||||
|
||||
if (!currentNode.parent) {
|
||||
if (!currentNode.parent ||
|
||||
currentNode.inode === this.rootINode) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user