update @ Sat 9 Oct 04:12:07 EEST 2021

This commit is contained in:
Ari Archer 2021-10-09 04:12:07 +03:00
parent 068ed5acd3
commit e6dc1c4fc5
2 changed files with 2 additions and 11 deletions

View file

@ -117,7 +117,7 @@ function su(cmd) {
if (cmd[0]) {
if (cmd[0] == '.') {
root = !root
return `Switched to the <b>${root ? '<b>root</b>' : localStorage.getItem('username')}</b> user.`
return `Switched to the <b>${root ? 'root' : localStorage.getItem('username')}</b> user.`
} else {
root = true;
let ret = 'Command not found';

View file

@ -4,15 +4,6 @@ let cmd_history = document.getElementById('cmd_hist');
let shell = document.getElementById('shell');
var is_root = false;
const html_bad_tags = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
};
function replaceTag(tag) {
return html_bad_tags[tag] || tag;
}
function main() {
cmd_prompt.onkeypress = (e) => {
@ -27,7 +18,7 @@ function main() {
if (commands[command]) {
if (commands[command]['root_only'] && !root) {
cmd_output.innerHTML = `'${command.replace(/[&<>]/g, replaceTag)}' can <i>only</i> be ran as <b>root</b>. see <b>help su</b>`
cmd_output.innerHTML = `'${command}' can <i>only</i> be ran as <b>root</b>. see <b>help su</b>`
} else {
cmd_output.innerHTML = commands[command]['func'](argv);
}