added core linux file system (kinda)
This commit is contained in:
@@ -57,7 +57,7 @@ function cd(req, res, raw_command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argument === "~" || argument === "~/"){
|
if (argument === "~" || argument === "~/"){
|
||||||
req.session.state.directory = `/home/${req.session.state.username}`;
|
req.session.state.directory = `/home/${req.session.state.username}/`;
|
||||||
respondToCommand(req, res, "", req.session.state.directory, command);
|
respondToCommand(req, res, "", req.session.state.directory, command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -114,6 +114,7 @@ function help(req, res) {
|
|||||||
Here is a list of the available commands:<br><br>
|
Here is a list of the available commands:<br><br>
|
||||||
|
|
||||||
"help" - shows you this menu<br>
|
"help" - shows you this menu<br>
|
||||||
|
"info" - shows you some information about the system<br>
|
||||||
"clear" - clears the screen from previous ran commands<br>
|
"clear" - clears the screen from previous ran commands<br>
|
||||||
"ls" - shows you the files and directories in your current directory<br>
|
"ls" - shows you the files and directories in your current directory<br>
|
||||||
"cd" - move into a folder you specify, you can use the name of the folder, or you can also use things like ../ to move back one folder<br>
|
"cd" - move into a folder you specify, you can use the name of the folder, or you can also use things like ../ to move back one folder<br>
|
||||||
|
|||||||
@@ -1,16 +1,74 @@
|
|||||||
{
|
{
|
||||||
"/": {
|
"/": {
|
||||||
|
"bin": "dir",
|
||||||
|
"etc": "dir",
|
||||||
|
"home": "dir",
|
||||||
|
"usr": "dir",
|
||||||
|
"var": "dir",
|
||||||
|
"root": "noperms",
|
||||||
|
"sys": "noperms"
|
||||||
|
},
|
||||||
|
"/home/": {
|
||||||
|
"guest": "dir"
|
||||||
|
},
|
||||||
|
"/home/guest/": {
|
||||||
"file1.txt": "this is the content of file1<br>i like cheese :)",
|
"file1.txt": "this is the content of file1<br>i like cheese :)",
|
||||||
"projects": "dir"
|
"projects": "dir"
|
||||||
},
|
},
|
||||||
"/projects/": {
|
"/home/guest/projects/": {
|
||||||
"personal": "dir"
|
"personal": "dir"
|
||||||
},
|
},
|
||||||
"/projects/personal/": {
|
"/home/guest/projects/personal/": {
|
||||||
"discord_bot_builder": "dir"
|
"discord_bot_builder": "dir"
|
||||||
},
|
},
|
||||||
"/projects/personal/discord_bot_builder/": {
|
"/home/guest/projects/personal/discord_bot_builder/": {
|
||||||
"about.txt":"This project is a pesonal project of mine. The goal is that you can easily create discord bots, with commands, to automate some stuff in your discord server!",
|
"about.txt": "This project is a personal project of mine. The goal is that you can easily create discord bots, with commands, to automate some stuff in your discord server!",
|
||||||
"links.txt": "GitHub: <a href=`` onclick='window.location.href=`https://github.com/HerpieDerpieee/PS-Discord-BotBuilder/`'>https://github.com/HerpieDerpieee/PS-Discord-BotBuilder/</a>"
|
"links.txt": "GitHub: <a href=`` onclick='window.location.href=`https://github.com/HerpieDerpieee/PS-Discord-BotBuilder/`'>https://github.com/HerpieDerpieee/PS-Discord-BotBuilder/</a>"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"/bin/": {
|
||||||
|
"clear": "executable program",
|
||||||
|
"ls": "executable program",
|
||||||
|
"whoami": "executable program",
|
||||||
|
"cd": "executable program",
|
||||||
|
"pwd": "executable program",
|
||||||
|
"cat": "executable program",
|
||||||
|
"help": "executable program",
|
||||||
|
"info": "executable program"
|
||||||
|
},
|
||||||
|
"/etc/": {
|
||||||
|
"passwd": "user account information<br>root:x:0:0:root:/root:/bin/bash<br>guest:x:1000:1000::/home/guest:/bin/bash",
|
||||||
|
"hostname": "HerpDerpOS 1.0.13<br>",
|
||||||
|
"hosts": "127.0.0.1 localhost<br>::1 localhost"
|
||||||
|
},
|
||||||
|
"/usr/": {
|
||||||
|
"bin": "dir",
|
||||||
|
"lib": "dir",
|
||||||
|
"share": "dir"
|
||||||
|
},
|
||||||
|
"/usr/bin/": {
|
||||||
|
"grep": "executable program",
|
||||||
|
"find": "executable program"
|
||||||
|
},
|
||||||
|
"/var/": {
|
||||||
|
"log": "dir",
|
||||||
|
"www": "dir"
|
||||||
|
},
|
||||||
|
"/var/log/": {
|
||||||
|
"messages": "system and application messages<br>...",
|
||||||
|
"secure": "authentication and authorization logs<br>..."
|
||||||
|
},
|
||||||
|
"/var/www/": {
|
||||||
|
"html": "dir"
|
||||||
|
},
|
||||||
|
"/var/www/html/": {
|
||||||
|
"index.html": "<!DOCTYPE html><br><html><br><head><br><title>Welcome to Fedora Server</title><br></head><br><body><br><h1>Hello, World!</h1><br></body><br></html>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,6 @@ function createNewTextLine(text){
|
|||||||
terminalContainer.appendChild(commandResponse);
|
terminalContainer.appendChild(commandResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createNewTerminalLine(){
|
function createNewTerminalLine(){
|
||||||
let newTerminalLine = document.createElement("div");
|
let newTerminalLine = document.createElement("div");
|
||||||
newTerminalLine.classList.add("terminalLine");
|
newTerminalLine.classList.add("terminalLine");
|
||||||
@@ -103,7 +102,11 @@ function createNewTerminalLine(){
|
|||||||
fetch('/currentDir')
|
fetch('/currentDir')
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
pathPath.innerHTML = "~"+data;
|
if (data.startsWith("/home/guest")){
|
||||||
|
pathPath.innerHTML = "~"+data.split("/home/guest")[1]
|
||||||
|
} else {
|
||||||
|
pathPath.innerHTML = data;
|
||||||
|
}
|
||||||
pathPath.classList.add("pathPath");
|
pathPath.classList.add("pathPath");
|
||||||
})
|
})
|
||||||
.catch(error => console.error('Error:', error));
|
.catch(error => console.error('Error:', error));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ app.get('/', (req, res) => {
|
|||||||
if (!req.session.state) {
|
if (!req.session.state) {
|
||||||
req.session.state = {
|
req.session.state = {
|
||||||
"username": "guest",
|
"username": "guest",
|
||||||
"directory": "/"
|
"directory": `/home/guest/`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
res.sendFile(documentRoot + "/index.html");
|
res.sendFile(documentRoot + "/index.html");
|
||||||
|
|||||||
Reference in New Issue
Block a user