Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d59d08b7e1
|
|||
|
13a7306d5b
|
+571
-455
File diff suppressed because it is too large
Load Diff
+4
-658
@@ -78,7 +78,7 @@ function createServerRack() {
|
|||||||
|
|
||||||
const isSwitch = i > 0 && (i % 7 === 0 || i % 11 === 0);
|
const isSwitch = i > 0 && (i % 7 === 0 || i % 11 === 0);
|
||||||
|
|
||||||
if (isSwitch) {
|
if (isSwitch) {
|
||||||
const switchFace = document.createElement('div');
|
const switchFace = document.createElement('div');
|
||||||
switchFace.className = 'eth-switch-face';
|
switchFace.className = 'eth-switch-face';
|
||||||
|
|
||||||
@@ -128,472 +128,8 @@ function createServerRack() {
|
|||||||
|
|
||||||
const serverType = Math.random();
|
const serverType = Math.random();
|
||||||
|
|
||||||
const isTerminal = i === 0;
|
if (i === 0) {
|
||||||
|
createTerminal(face);
|
||||||
if (isTerminal) {
|
|
||||||
// Terminal display
|
|
||||||
const terminal = document.createElement('div');
|
|
||||||
terminal.className = 'terminal-display';
|
|
||||||
terminal.setAttribute('tabindex', '0');
|
|
||||||
|
|
||||||
const mobileInput = document.createElement('input');
|
|
||||||
mobileInput.type = 'text';
|
|
||||||
mobileInput.style.opacity = '0';
|
|
||||||
mobileInput.style.position = 'absolute';
|
|
||||||
mobileInput.style.width = '1px';
|
|
||||||
mobileInput.style.height = '1px';
|
|
||||||
mobileInput.style.padding = '0';
|
|
||||||
mobileInput.style.border = '0';
|
|
||||||
mobileInput.style.outline = 'none';
|
|
||||||
mobileInput.style.background = 'transparent';
|
|
||||||
mobileInput.setAttribute('autocorrect', 'off');
|
|
||||||
mobileInput.setAttribute('spellcheck', 'false');
|
|
||||||
mobileInput.setAttribute('autocomplete', 'off');
|
|
||||||
mobileInput.setAttribute('autocapitalize', 'off');
|
|
||||||
mobileInput.autocapitalize = 'off';
|
|
||||||
terminal.appendChild(mobileInput);
|
|
||||||
terminal._mobileInput = mobileInput;
|
|
||||||
|
|
||||||
const content = document.createElement('div');
|
|
||||||
content.className = 'terminal-content';
|
|
||||||
|
|
||||||
const line1 = document.createElement('div');
|
|
||||||
line1.innerHTML = '<span class="terminal-prompt">$</span> uptime';
|
|
||||||
content.appendChild(line1);
|
|
||||||
|
|
||||||
const line2 = document.createElement('div');
|
|
||||||
line2.textContent = 'optional';
|
|
||||||
content.appendChild(line2);
|
|
||||||
|
|
||||||
const line3 = document.createElement('div');
|
|
||||||
line3.innerHTML = '<span class="terminal-prompt">$</span> ';
|
|
||||||
content.appendChild(line3);
|
|
||||||
|
|
||||||
const cursor = document.createElement('span');
|
|
||||||
cursor.className = 'terminal-cursor';
|
|
||||||
line3.appendChild(cursor);
|
|
||||||
|
|
||||||
terminal.appendChild(content);
|
|
||||||
face.appendChild(terminal);
|
|
||||||
|
|
||||||
activeTerminal = terminal;
|
|
||||||
|
|
||||||
terminal.addEventListener('click', () => {
|
|
||||||
mobileInput.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
const commandHistory = [];
|
|
||||||
let historyIndex = -1;
|
|
||||||
let isRoot = false;
|
|
||||||
let isLoginScreen = false;
|
|
||||||
|
|
||||||
terminal.addEventListener('keydown', (e) => {
|
|
||||||
if (e.key === 'ArrowUp') {
|
|
||||||
e.preventDefault();
|
|
||||||
if (historyIndex < commandHistory.length - 1) {
|
|
||||||
historyIndex++;
|
|
||||||
const cmdLine = commandHistory[historyIndex];
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ' + cmdLine + ' ';
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor';
|
|
||||||
lastLine.appendChild(newCursor);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key === 'ArrowDown') {
|
|
||||||
e.preventDefault();
|
|
||||||
if (historyIndex > 0) {
|
|
||||||
historyIndex--;
|
|
||||||
const cmdLine = commandHistory[historyIndex];
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ' + cmdLine + ' ';
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor';
|
|
||||||
lastLine.appendChild(newCursor);
|
|
||||||
} else {
|
|
||||||
historyIndex = -1;
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor';
|
|
||||||
lastLine.appendChild(newCursor);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
mobileInput.value = '';
|
|
||||||
lastInputValue = '';
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
const oldCursor = lastLine?.querySelector('.terminal-cursor');
|
|
||||||
if (oldCursor) oldCursor.remove();
|
|
||||||
|
|
||||||
const cmdText = lastLine.textContent.replace(/^[\$#]\s*/, '').trim();
|
|
||||||
|
|
||||||
if (cmdText) {
|
|
||||||
commandHistory.unshift(cmdText);
|
|
||||||
historyIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText.startsWith('ls')) {
|
|
||||||
const output = [
|
|
||||||
'total 20K',
|
|
||||||
'drwxr-xr-x 5 reese reese 4.0K May 28 14:30 .',
|
|
||||||
'drwx------ 42 reese reese 4.0K May 28 10:15 ..',
|
|
||||||
'-rw-r--r-- 1 reese reese 245 May 27 09:00 .gitignore',
|
|
||||||
'-rw-r--r-- 1 reese reese 1.2K May 27 11:45 Dockerfile',
|
|
||||||
'-rw-r--r-- 1 reese reese 4.8K May 28 13:50 index.html',
|
|
||||||
'-rw-r--r-- 1 reese reese 680 May 27 09:00 nginx.conf',
|
|
||||||
'-rw-r--r-- 1 reese reese 32K May 28 14:28 profile.jpeg',
|
|
||||||
'-rw-r--r-- 1 reese reese 14K May 28 12:00 script.js',
|
|
||||||
'-rw-r--r-- 1 reese reese 42K May 28 14:25 style.css',
|
|
||||||
'drwxr-xr-x 2 reese reese 4.0K May 27 09:00 src'
|
|
||||||
].join('\n');
|
|
||||||
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.style.color = '#ccc';
|
|
||||||
outLine.textContent = output;
|
|
||||||
content.appendChild(outLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText.startsWith('ss')) {
|
|
||||||
const output = 'Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port\ntcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:222 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3000 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3001 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3002 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8096 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:9090 0.0.0.0:*\ntcp LISTEN 0 128 [::]:22 [::]:*';
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.style.color = '#ccc';
|
|
||||||
outLine.textContent = output;
|
|
||||||
content.appendChild(outLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText === 'clear') {
|
|
||||||
content.innerHTML = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText === 'exit') {
|
|
||||||
if (!isRoot) {
|
|
||||||
const newAchievements = checkAchievements(cmdText, false);
|
|
||||||
if (newAchievements.length > 0) {
|
|
||||||
revealAchievements();
|
|
||||||
newAchievements.forEach(a => showToast(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
isLoginScreen = true;
|
|
||||||
document.body.innerHTML = '';
|
|
||||||
document.body.style.background = '#000';
|
|
||||||
document.body.style.color = '#fff';
|
|
||||||
document.body.style.fontFamily = 'monospace';
|
|
||||||
document.body.style.padding = '20px';
|
|
||||||
document.body.style.minHeight = '100vh';
|
|
||||||
document.body.style.margin = '0';
|
|
||||||
document.body.style.lineHeight = '1.6';
|
|
||||||
|
|
||||||
const loginContainer = document.createElement('div');
|
|
||||||
loginContainer.style.marginBottom = '10px';
|
|
||||||
loginContainer.textContent = 'homelab tty1';
|
|
||||||
document.body.appendChild(loginContainer);
|
|
||||||
|
|
||||||
const loginInput = document.createElement('input');
|
|
||||||
loginInput.type = 'text';
|
|
||||||
loginInput.style.background = 'transparent';
|
|
||||||
loginInput.style.border = 'none';
|
|
||||||
loginInput.style.outline = 'none';
|
|
||||||
loginInput.style.color = '#fff';
|
|
||||||
loginInput.style.fontFamily = 'monospace';
|
|
||||||
loginInput.style.fontSize = '14px';
|
|
||||||
loginInput.style.width = '300px';
|
|
||||||
loginInput.style.caretColor = '#fff';
|
|
||||||
loginInput.autofocus = true;
|
|
||||||
|
|
||||||
const loginLine = document.createElement('div');
|
|
||||||
loginLine.style.marginBottom = '20px';
|
|
||||||
loginLine.appendChild(document.createTextNode('homelab login: '));
|
|
||||||
loginLine.appendChild(loginInput);
|
|
||||||
|
|
||||||
document.body.appendChild(loginLine);
|
|
||||||
|
|
||||||
loginInput.focus();
|
|
||||||
|
|
||||||
const handleLogin = (e) => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
const deniedLine = document.createElement('div');
|
|
||||||
deniedLine.textContent = 'Access denied';
|
|
||||||
deniedLine.style.marginTop = '10px';
|
|
||||||
document.body.appendChild(deniedLine);
|
|
||||||
|
|
||||||
const newLoginLine = document.createElement('div');
|
|
||||||
newLoginLine.style.marginTop = '10px';
|
|
||||||
const newInput = document.createElement('input');
|
|
||||||
newInput.type = 'text';
|
|
||||||
newInput.style.background = 'transparent';
|
|
||||||
newInput.style.border = 'none';
|
|
||||||
newInput.style.outline = 'none';
|
|
||||||
newInput.style.color = '#fff';
|
|
||||||
newInput.style.fontFamily = 'monospace';
|
|
||||||
newInput.style.fontSize = '14px';
|
|
||||||
newInput.style.width = '300px';
|
|
||||||
newInput.style.caretColor = '#fff';
|
|
||||||
newInput.autofocus = true;
|
|
||||||
newLoginLine.appendChild(document.createTextNode('homelab login: '));
|
|
||||||
newLoginLine.appendChild(newInput);
|
|
||||||
|
|
||||||
document.body.appendChild(newLoginLine);
|
|
||||||
|
|
||||||
loginInput.remove();
|
|
||||||
newInput.focus();
|
|
||||||
|
|
||||||
newInput.addEventListener('keydown', handleLogin);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
loginInput.addEventListener('keydown', handleLogin);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
isRoot = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newLine = document.createElement('div');
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
|
||||||
content.appendChild(newLine);
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor';
|
|
||||||
newLine.appendChild(newCursor);
|
|
||||||
content.scrollTop = content.scrollHeight;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText === 'rm -rf /') {
|
|
||||||
if (!isRoot) {
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.style.color = '#ef4444';
|
|
||||||
outLine.textContent = 'nice try';
|
|
||||||
content.appendChild(outLine);
|
|
||||||
} else {
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.style.color = '#ef4444';
|
|
||||||
outLine.textContent = 'System destruction initiated...';
|
|
||||||
content.appendChild(outLine);
|
|
||||||
setTimeout(() => {
|
|
||||||
document.body.innerHTML = '';
|
|
||||||
document.title = '';
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
const newLine = document.createElement('div');
|
|
||||||
if (isRoot) {
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
|
||||||
newLine.style.color = '#ef4444';
|
|
||||||
} else {
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
|
||||||
}
|
|
||||||
content.appendChild(newLine);
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
|
||||||
newLine.appendChild(newCursor);
|
|
||||||
content.scrollTop = content.scrollHeight;
|
|
||||||
|
|
||||||
const newAchievements = checkAchievements(cmdText, isRoot);
|
|
||||||
if (newAchievements.length > 0) {
|
|
||||||
revealAchievements();
|
|
||||||
newAchievements.forEach(a => showToast(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmdText === 'sudo su -' || cmdText === 'sudo -i') {
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.style.color = '#ef4444';
|
|
||||||
outLine.textContent = 'I hope you know what you\'re doing';
|
|
||||||
content.appendChild(outLine);
|
|
||||||
|
|
||||||
isRoot = true;
|
|
||||||
|
|
||||||
const newLine = document.createElement('div');
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
|
||||||
newLine.style.color = '#ef4444';
|
|
||||||
content.appendChild(newLine);
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor red';
|
|
||||||
newLine.appendChild(newCursor);
|
|
||||||
content.scrollTop = content.scrollHeight;
|
|
||||||
|
|
||||||
const newAchievements = checkAchievements(cmdText, isRoot);
|
|
||||||
if (newAchievements.length > 0) {
|
|
||||||
revealAchievements();
|
|
||||||
newAchievements.forEach(a => showToast(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const commands = {
|
|
||||||
'pwd': '/home/reese/portfolio',
|
|
||||||
'whoami': 'reese',
|
|
||||||
'hostname': 'homelab',
|
|
||||||
'date': new Date().toString(),
|
|
||||||
'uname': 'Linux homelab 7.0.0 #1 SMP x86_64 GNU/Linux',
|
|
||||||
'uname -a': 'Linux homelab 6.8.0 #1 SMP x86_64 GNU/Linux',
|
|
||||||
'uptime': ' 14:30:00 up 42 days, 3:15, 1 user, load average: 0.42, 0.38, 0.35',
|
|
||||||
'id': 'uid=1000(reese) gid=1000(reese) groups=1000(reese),985(podman)',
|
|
||||||
'cat /etc/os-release': 'PRETTY_NAME="Fedora Linux 69 (Workstation Edition)"\nNAME="Fedora Linux"\nVERSION_ID="69"\nVERSION="69 (Workstation Edition)"\nID=fedora\nVARIANT=Workstation Edition\nVARIANT_ID=workstation\nLOGO=fedora-logo-icon\nCPE_NAME="cpe:/o:fedoralinux:fedora:69"\nDEFAULT_HOSTNAME="fedora"\nHOME_URL="https://fedoraproject.org/"\nDOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f69/system-administrators-guide/"\nSUPPORT_URL="https://ask.fedoraproject.org/"\nBUG_REPORT_URL="https://bugzilla.redhat.com/"\nREDHAT_BUGZILLA_PRODUCT="Fedora"\nREDHAT_BUGZILLA_PRODUCT_VERSION=69\nREDHAT_SUPPORT_PRODUCT="Fedora"\nREDHAT_SUPPORT_PRODUCT_VERSION=69',
|
|
||||||
'cat ~/.ssh/id_ed25519.pub': 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpFmKLqRKzMwRe3WkqJvQrN5mHjF2pRn8sT6yUvWxRe reese@homelab',
|
|
||||||
'docker ps': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
|
||||||
'docker ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
|
||||||
'docker container ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
|
||||||
'podman ps': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
|
||||||
'podman ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
|
||||||
'podman container ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
|
||||||
'systemctl list-units': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
|
||||||
'systemctl list-units --type=service --state=running --no-pager': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
|
||||||
'ss': 'Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port\ntcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:222 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3000 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3001 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3002 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8096 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:9090 0.0.0.0:*\ntcp LISTEN 0 128 [::]:22 [::]:*',
|
|
||||||
'ip addr show': '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN\n inet 127.0.0.1/8 scope host lo\n inet6 ::1/128 scope host\n2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP\n inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic eth0\n inet6 fe80::1/64 scope link',
|
|
||||||
'df -h': 'Filesystem Size Used Avail Use% Mounted on\n/dev/sda2 465G 182G 258G 42% /\nudev 16G 0 16G 0% /dev\ntmpfs 16G 2.1M 16G 1% /dev/shm\n/dev/sda1 511M 6.6M 505M 2% /boot/efi\n/dev/sdb1 1.8T 945G 793G 55% /mnt/data\noverlay 1.8T 945G 793G 55% /var/lib/docker/overlay2',
|
|
||||||
'free -h': ' total used free shared buff/cache available\nMem: 31Gi 8.2Gi 12Gi 512Mi 11Gi 22Gi\nSwap: 2.0Gi 0B 2.0Gi',
|
|
||||||
'ps aux': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
|
||||||
'ps aux --sort=-%mem | head -10': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
|
||||||
'neofetch': ` 'c. reese@homelab\n ,xNMM. ----------------------\n .OMMMMo OS: Fedora Linux 69 (Workstation Edition) x86_64\n OMMM0, Host: custom-build\n .;loddo:' loolloddol;. Kernel: 6.8.0\n cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 42 days, 3 hours\n .KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 2847 (dnf)\n XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: bash 5.2.26\n;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 2560x1440\n:MMMMMMMMMMMMMMMMMMMMMMMM: DE: GNOME 46.1\n.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Mutter\n kMMMMMMMMMMMMMMMMMMMMMMMMWd. Terminal: /dev/pts/0\n .XMMMMMMMMMMMMMMMMMMMMMMMMMMk CPU: AMD Ryzen 9 7900X (24) @ 5.6GHz\n .XMMMMMMMMMMMMMMMMMMMMMMK. GPU: NVIDIA GeForce RTX 4090\n kMMMMMMMMMMMMMMMMMMMMd GPU: AMD Ryzen Built-in\n ;KMMMMMMMWXXWMMMMMMMk. Memory: 8.2Gi / 31Gi\n .cooc,. .,coo:.\n\n<span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span>`,
|
|
||||||
'sl': '____\n|DD|____T_\n|_ |_____|<\n @-@-@-oo\\',
|
|
||||||
'help': 'Available commands:\n ls List directory contents\n pwd Print working directory\n whoami Print current user\n hostname Print hostname\n date Print current date/time\n uname Print system information\n uptime Print system uptime\n id Print user identity\n cat Print file contents (try: cat /etc/os-release)\n docker List running containers\n podman List running pods\n systemctl List running systemd services\n ss Show listening ports\n ip Show network interfaces\n df Show disk usage\n free Show memory usage\n ps Show running processes\n neofetch System info display\n sl Steam locomotive\n help Show this help message',
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cmdText.startsWith('echo ')) {
|
|
||||||
const output = cmdText.replace(/^echo\s+/, '');
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
outLine.textContent = output;
|
|
||||||
outLine.style.color = '#ccc';
|
|
||||||
content.appendChild(outLine);
|
|
||||||
} else if (commands[cmdText] !== undefined) {
|
|
||||||
const output = commands[cmdText];
|
|
||||||
const outLine = document.createElement('div');
|
|
||||||
outLine.style.whiteSpace = 'pre-wrap';
|
|
||||||
if (cmdText === 'neofetch') {
|
|
||||||
outLine.innerHTML = output;
|
|
||||||
} else {
|
|
||||||
outLine.textContent = output;
|
|
||||||
outLine.style.color = '#ccc';
|
|
||||||
}
|
|
||||||
content.appendChild(outLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
const newAchievements = checkAchievements(cmdText, isRoot);
|
|
||||||
if (newAchievements.length > 0) {
|
|
||||||
revealAchievements();
|
|
||||||
newAchievements.forEach(a => showToast(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
const newLine = document.createElement('div');
|
|
||||||
if (isRoot) {
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
|
||||||
newLine.style.color = '#ef4444';
|
|
||||||
} else {
|
|
||||||
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
|
||||||
}
|
|
||||||
content.appendChild(newLine);
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
|
||||||
newLine.appendChild(newCursor);
|
|
||||||
content.scrollTop = content.scrollHeight;
|
|
||||||
} else if (e.key === 'Backspace') {
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
if (lastLine) {
|
|
||||||
const textNodes = [];
|
|
||||||
lastLine.childNodes.forEach(node => {
|
|
||||||
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== '') {
|
|
||||||
textNodes.push(node);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (textNodes.length > 0) {
|
|
||||||
e.preventDefault();
|
|
||||||
const lastChar = textNodes[textNodes.length - 1];
|
|
||||||
if (lastChar.textContent.length > 1) {
|
|
||||||
lastChar.textContent = lastChar.textContent.slice(0, -1);
|
|
||||||
} else {
|
|
||||||
lastChar.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
terminal.addEventListener('focus', () => {
|
|
||||||
mobileInput.focus();
|
|
||||||
terminal.style.boxShadow = '0 0 8px rgba(234, 179, 8, 0.3), inset 0 0 20px rgba(34, 197, 94, 0.1)';
|
|
||||||
terminal.style.borderColor = '#eab308';
|
|
||||||
terminal.classList.add('grown');
|
|
||||||
terminal.classList.add('opaque');
|
|
||||||
const face = terminal.closest('.server-face');
|
|
||||||
const unit = face?.closest('.rack-unit');
|
|
||||||
face?.classList.add('grown');
|
|
||||||
unit?.classList.add('grown');
|
|
||||||
document.getElementById('hero').classList.add('shifted');
|
|
||||||
document.querySelector('.rack-container')?.classList.add('opaque');
|
|
||||||
});
|
|
||||||
|
|
||||||
terminal.addEventListener('blur', () => {
|
|
||||||
if (heroMouseDown) return;
|
|
||||||
terminal.style.boxShadow = '';
|
|
||||||
terminal.style.borderColor = '#2a2a2e';
|
|
||||||
terminal.classList.remove('grown');
|
|
||||||
terminal.classList.remove('opaque');
|
|
||||||
const face = terminal.closest('.server-face');
|
|
||||||
const unit = face?.closest('.rack-unit');
|
|
||||||
face?.classList.remove('grown');
|
|
||||||
unit?.classList.remove('grown');
|
|
||||||
document.getElementById('hero').classList.remove('shifted');
|
|
||||||
document.querySelector('.rack-container')?.classList.remove('opaque');
|
|
||||||
});
|
|
||||||
|
|
||||||
mobileInput.addEventListener('keydown', (e) => {
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
mobileInput.blur();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mobileInput.addEventListener('blur', () => {
|
|
||||||
if (heroMouseDown) return;
|
|
||||||
terminal.style.boxShadow = '';
|
|
||||||
terminal.style.borderColor = '#2a2a2e';
|
|
||||||
terminal.classList.remove('grown');
|
|
||||||
terminal.classList.remove('opaque');
|
|
||||||
const face = terminal.closest('.server-face');
|
|
||||||
const unit = face?.closest('.rack-unit');
|
|
||||||
face?.classList.remove('grown');
|
|
||||||
unit?.classList.remove('grown');
|
|
||||||
document.getElementById('hero').classList.remove('shifted');
|
|
||||||
document.querySelector('.rack-container')?.classList.remove('opaque');
|
|
||||||
});
|
|
||||||
|
|
||||||
let lastInputValue = '';
|
|
||||||
|
|
||||||
mobileInput.addEventListener('input', () => {
|
|
||||||
const lastLine = content.lastElementChild;
|
|
||||||
if (!lastLine) return;
|
|
||||||
|
|
||||||
const cursorEl = lastLine.querySelector('.terminal-cursor');
|
|
||||||
const inputText = mobileInput.value;
|
|
||||||
const addedText = inputText.slice(lastInputValue.length);
|
|
||||||
|
|
||||||
if (addedText) {
|
|
||||||
if (cursorEl) cursorEl.remove();
|
|
||||||
lastLine.insertAdjacentText('beforeend', addedText);
|
|
||||||
const newCursor = document.createElement('span');
|
|
||||||
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
|
||||||
lastLine.appendChild(newCursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastInputValue = inputText;
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if (serverType < 0.35) {
|
} else if (serverType < 0.35) {
|
||||||
// Vertical grill + fans
|
// Vertical grill + fans
|
||||||
const grillV = document.createElement('div');
|
const grillV = document.createElement('div');
|
||||||
@@ -731,7 +267,7 @@ function createServerRack() {
|
|||||||
face.appendChild(ledGroup);
|
face.appendChild(ledGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isTerminal) {
|
if (i !== 0) {
|
||||||
const serviceLabel = document.createElement('div');
|
const serviceLabel = document.createElement('div');
|
||||||
serviceLabel.className = 'service-label';
|
serviceLabel.className = 'service-label';
|
||||||
serviceLabel.textContent = services[Math.floor(Math.random() * services.length)];
|
serviceLabel.textContent = services[Math.floor(Math.random() * services.length)];
|
||||||
@@ -771,8 +307,6 @@ function createServerRack() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference to the first rack unit's terminal display (the interactive easter egg)
|
|
||||||
let activeTerminal = null;
|
|
||||||
createServerRack();
|
createServerRack();
|
||||||
|
|
||||||
const heroEl = document.getElementById('hero');
|
const heroEl = document.getElementById('hero');
|
||||||
@@ -810,192 +344,4 @@ heroEl.addEventListener('click', (e) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Achievement System
|
|
||||||
const ACHIEVEMENTS_STORAGE_KEY = 'reese-terminal-achievements';
|
|
||||||
|
|
||||||
const ACHIEVEMENTS = {
|
|
||||||
time_flies: { name: 'Time Flies', desc: 'Check the system uptime', icon: '⏱️', cmd: 'uptime' },
|
|
||||||
curious: { name: 'Curious', desc: 'List directory contents', icon: '📁', cmd: 'ls', prefix: true },
|
|
||||||
port_scanner: { name: 'Port Scanner', desc: 'Check listening ports', icon: '🔍', cmd: 'ss', prefix: true },
|
|
||||||
password_reset: { name: 'Password Reset Request', desc: 'Submit a SNOW request', icon: '🚪', cmd: 'exit' },
|
|
||||||
power_user: { name: 'Power User', desc: 'Gain root access', icon: '👑', cmd: 'sudo su -' },
|
|
||||||
nice_try: { name: 'Nice Try', desc: 'Attempt rm -rf / as a normal user', icon: '😏', cmd: 'rm -rf /' },
|
|
||||||
restore_backup: { name: 'Restore from Backup', desc: 'Actually destroy the system as root', icon: '💥', cmd: 'rm -rf / root' },
|
|
||||||
where_am_i: { name: 'Where Am I?', desc: 'Print working directory', icon: '📍', cmd: 'pwd' },
|
|
||||||
self_aware: { name: 'Self-Aware', desc: 'Print current user', icon: '🪞', cmd: 'whoami' },
|
|
||||||
identity: { name: 'Identity Crisis', desc: 'Print hostname', icon: '🖥️', cmd: 'hostname' },
|
|
||||||
time_keeper: { name: 'Time Keeper', desc: 'Print current date', icon: '📅', cmd: 'date' },
|
|
||||||
system_explorer: { name: 'System Explorer', desc: 'Print system information', icon: '🔧', cmd: 'uname' },
|
|
||||||
access_granted: { name: 'Access Granted', desc: 'Check user identity', icon: '🆔', cmd: 'id' },
|
|
||||||
os_detective: { name: 'OS Detective', desc: 'Read the OS release file', icon: '🐧', cmd: 'cat /etc/os-release' },
|
|
||||||
ssh_explorer: { name: 'SSH Explorer', desc: 'View SSH public key', icon: '🔑', cmd: 'cat ~/.ssh/id_ed25519.pub' },
|
|
||||||
container_watcher: { name: 'Container Watcher', desc: 'List Docker containers', icon: '🐳', cmd: 'docker ps', prefix: true },
|
|
||||||
docker_confused: { name: 'Docker Confused', desc: 'Use wrong Docker command', icon: '🤔', cmd: 'docker ls', prefix: true },
|
|
||||||
container_pro: { name: 'Container Pro', desc: 'Use correct container command', icon: '✅', cmd: 'docker container ls', prefix: true },
|
|
||||||
podman_fan: { name: 'Podman Fan', desc: 'List Podman containers', icon: '📦', cmd: 'podman ps', prefix: true },
|
|
||||||
podman_confused: { name: 'Podman Confused', desc: 'Use wrong Podman command', icon: '🤔', cmd: 'podman ls', prefix: true },
|
|
||||||
podman_pro: { name: 'Podman Pro', desc: 'Use correct Podman command', icon: '✅', cmd: 'podman container ls', prefix: true },
|
|
||||||
service_hunter: { name: 'Service Hunter', desc: 'List systemd units', icon: '🔎', cmd: 'systemctl list-units', prefix: true },
|
|
||||||
service_filter: { name: 'Service Filter', desc: 'Filter running services', icon: '🎯', cmd: 'systemctl list-units --type=service --state=running --no-pager' },
|
|
||||||
network_ninja: { name: 'Network Ninja', desc: 'Show network interfaces', icon: '🌐', cmd: 'ip addr show', prefix: true },
|
|
||||||
disk_detective: { name: 'Disk Detective', desc: 'Check disk usage', icon: '💾', cmd: 'df -h' },
|
|
||||||
memory_minded: { name: 'Memory Minded', desc: 'Check memory usage', icon: '🧠', cmd: 'free -h' },
|
|
||||||
process_watcher: { name: 'Process Watcher', desc: 'List running processes', icon: '👁️', cmd: 'ps aux', prefix: true },
|
|
||||||
memory_hog: { name: 'Memory Hog', desc: 'Find top memory consumers', icon: '🐗', cmd: 'ps aux --sort=-%mem | head -10' },
|
|
||||||
aesthetic_mode: { name: 'Aesthetic Mode', desc: 'Display system info with style', icon: '✨', cmd: 'neofetch' },
|
|
||||||
help_seeker: { name: 'Help Seeker', desc: 'Look up available commands', icon: '📖', cmd: 'help' },
|
|
||||||
clean_slate: { name: 'Clean Slate', desc: 'Clear the terminal', icon: '🧹', cmd: 'clear' },
|
|
||||||
train_spotter: { name: 'Train Spotter', desc: 'Run the steam locomotive', icon: '🚂', cmd: 'sl' },
|
|
||||||
tain: { name: 'I like trains', desc: 'Choo chooooooo', icon: '🧹', cmd: 'sl' },
|
|
||||||
};
|
|
||||||
|
|
||||||
// Load unlocked achievement keys from localStorage
|
|
||||||
function loadAchievements() {
|
|
||||||
try {
|
|
||||||
const saved = localStorage.getItem(ACHIEVEMENTS_STORAGE_KEY);
|
|
||||||
return saved ? JSON.parse(saved) : [];
|
|
||||||
} catch {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Persist unlocked achievement keys to localStorage
|
|
||||||
function saveAchievements(achieved) {
|
|
||||||
localStorage.setItem(ACHIEVEMENTS_STORAGE_KEY, JSON.stringify(achieved));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the given command triggers any new achievements; returns unlocked achievement objects
|
|
||||||
function checkAchievements(cmdText, isRoot) {
|
|
||||||
const achieved = loadAchievements();
|
|
||||||
const newAchievements = [];
|
|
||||||
|
|
||||||
for (const [key, achievement] of Object.entries(ACHIEVEMENTS)) {
|
|
||||||
if (achieved.includes(key)) continue;
|
|
||||||
|
|
||||||
if (key === 'restore_backup' && cmdText === 'rm -rf /' && isRoot) {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'power_user' && (cmdText === 'sudo su -' || cmdText === 'sudo -i')) {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'password_reset' && cmdText === 'exit' && !isRoot) {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'nice_try' && cmdText === 'rm -rf /' && !isRoot) {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'system_explorer' && (cmdText === 'uname' || cmdText === 'uname -a')) {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'docker_confused' && cmdText === 'docker ls') {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (key === 'podman_confused' && cmdText === 'podman ls') {
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
} else if (achievement.prefix ? cmdText.startsWith(achievement.cmd) : achievement.cmd === cmdText) {
|
|
||||||
if ((key === 'nice_try' && isRoot) || (key === 'restore_backup' && !isRoot)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
achieved.push(key);
|
|
||||||
newAchievements.push(achievement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newAchievements.length > 0) {
|
|
||||||
saveAchievements(achieved);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newAchievements;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display a toast notification for a newly unlocked achievement
|
|
||||||
function showToast(achievement) {
|
|
||||||
const container = document.getElementById('toast-container') || createToastContainer();
|
|
||||||
const toast = document.createElement('div');
|
|
||||||
toast.className = 'toast';
|
|
||||||
toast.innerHTML = `
|
|
||||||
<div class="toast-icon">${achievement.icon}</div>
|
|
||||||
<div class="toast-content">
|
|
||||||
<div class="toast-label">Achievement Unlocked</div>
|
|
||||||
<div class="toast-title">${achievement.name}</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
container.appendChild(toast);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
toast.classList.add('removing');
|
|
||||||
setTimeout(() => toast.remove(), 300);
|
|
||||||
}, 4000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the toast notification container element if it doesn't exist
|
|
||||||
function createToastContainer() {
|
|
||||||
const container = document.createElement('div');
|
|
||||||
container.id = 'toast-container';
|
|
||||||
container.className = 'toast-container';
|
|
||||||
document.body.appendChild(container);
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reveal the hidden achievements section and add it to the nav if needed
|
|
||||||
function revealAchievements() {
|
|
||||||
const section = document.getElementById('achievements');
|
|
||||||
if (section.style.display === 'none' || !section.style.display) {
|
|
||||||
section.style.display = 'block';
|
|
||||||
section.classList.add('fade-in');
|
|
||||||
setTimeout(() => section.classList.add('visible'), 50);
|
|
||||||
addAchievementsNav();
|
|
||||||
}
|
|
||||||
renderAchievements();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render all achievement cards (unlocked and locked) into the achievements grid
|
|
||||||
function renderAchievements() {
|
|
||||||
const achieved = loadAchievements();
|
|
||||||
const total = Object.keys(ACHIEVEMENTS).length;
|
|
||||||
const count = achieved.length;
|
|
||||||
|
|
||||||
const countEl = document.getElementById('achievements-count');
|
|
||||||
countEl.textContent = `${count} / ${total} achievements unlocked`;
|
|
||||||
|
|
||||||
const grid = document.getElementById('achievements-grid');
|
|
||||||
grid.innerHTML = '';
|
|
||||||
|
|
||||||
for (const [key, achievement] of Object.entries(ACHIEVEMENTS)) {
|
|
||||||
const isUnlocked = achieved.includes(key);
|
|
||||||
const card = document.createElement('div');
|
|
||||||
card.className = `achievement-card ${isUnlocked ? 'unlocked' : 'locked'}`;
|
|
||||||
card.innerHTML = `
|
|
||||||
<div class="achievement-icon">${achievement.icon}</div>
|
|
||||||
<div class="achievement-info">
|
|
||||||
<h3>${isUnlocked ? achievement.name : '???'}</h3>
|
|
||||||
<p>${isUnlocked ? achievement.desc : 'Keep exploring the terminal...'}</p>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
grid.appendChild(card);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add an "Achievements" link to the main navigation if achievements have been unlocked
|
|
||||||
function addAchievementsNav() {
|
|
||||||
const navLinks = document.getElementById('navLinks');
|
|
||||||
const existing = document.getElementById('nav-achievements');
|
|
||||||
if (!existing && loadAchievements().length > 0) {
|
|
||||||
const li = document.createElement('li');
|
|
||||||
li.id = 'nav-achievements';
|
|
||||||
li.innerHTML = '<a href="#achievements">Achievements</a>';
|
|
||||||
navLinks.appendChild(li);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore previously unlocked achievements on page load
|
|
||||||
(function initAchievements() {
|
|
||||||
const achieved = loadAchievements();
|
|
||||||
if (achieved.length > 0) {
|
|
||||||
revealAchievements();
|
|
||||||
addAchievementsNav();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+139
-45
@@ -1,4 +1,6 @@
|
|||||||
*, *::before, *::after {
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -225,13 +227,11 @@ body {
|
|||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: repeating-linear-gradient(
|
background: repeating-linear-gradient(0deg,
|
||||||
0deg,
|
transparent,
|
||||||
transparent,
|
transparent 2px,
|
||||||
transparent 2px,
|
rgba(0, 0, 0, 0.15) 2px,
|
||||||
rgba(0, 0, 0, 0.15) 2px,
|
rgba(0, 0, 0, 0.15) 4px);
|
||||||
rgba(0, 0, 0, 0.15) 4px
|
|
||||||
);
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
@@ -270,8 +270,15 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes cursorBlink {
|
@keyframes cursorBlink {
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0; }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.eth-brand {
|
.eth-brand {
|
||||||
@@ -506,8 +513,13 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
from { transform: rotate(0deg); }
|
from {
|
||||||
to { transform: rotate(360deg); }
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fan-slow {
|
.fan-slow {
|
||||||
@@ -572,25 +584,59 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blink1 {
|
@keyframes blink1 {
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0.2; }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blink2 {
|
@keyframes blink2 {
|
||||||
0%, 100% { opacity: 0.3; }
|
|
||||||
50% { opacity: 1; }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blink3 {
|
@keyframes blink3 {
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
30% { opacity: 0.1; }
|
0%,
|
||||||
60% { opacity: 0.8; }
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
30% {
|
||||||
|
opacity: 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
60% {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blink4 {
|
@keyframes blink4 {
|
||||||
0%, 100% { opacity: 0.5; }
|
|
||||||
25% { opacity: 1; }
|
0%,
|
||||||
75% { opacity: 0.2; }
|
100% {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
25% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
75% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rack-mount {
|
.rack-mount {
|
||||||
@@ -649,13 +695,11 @@ body {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: repeating-linear-gradient(
|
background: repeating-linear-gradient(180deg,
|
||||||
180deg,
|
transparent,
|
||||||
transparent,
|
transparent 20px,
|
||||||
transparent 20px,
|
rgba(0, 0, 0, 0.3) 20px,
|
||||||
rgba(0, 0, 0, 0.3) 20px,
|
rgba(0, 0, 0, 0.3) 21px);
|
||||||
rgba(0, 0, 0, 0.3) 21px
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.rack-label {
|
.rack-label {
|
||||||
@@ -808,8 +852,15 @@ nav .nav-inner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0.4; }
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero h1 {
|
.hero h1 {
|
||||||
@@ -1234,12 +1285,30 @@ section {
|
|||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-keyword { color: #c084fc; }
|
.code-keyword {
|
||||||
.code-function { color: #60a5fa; }
|
color: #c084fc;
|
||||||
.code-string { color: #34d399; }
|
}
|
||||||
.code-comment { color: #52525b; font-style: italic; }
|
|
||||||
.code-variable { color: #f472b6; }
|
.code-function {
|
||||||
.code-operator { color: #fbbf24; }
|
color: #60a5fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-string {
|
||||||
|
color: #34d399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-comment {
|
||||||
|
color: #52525b;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-variable {
|
||||||
|
color: #f472b6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-operator {
|
||||||
|
color: #fbbf24;
|
||||||
|
}
|
||||||
|
|
||||||
.project-info {
|
.project-info {
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
@@ -1625,6 +1694,7 @@ footer p {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateX(100px) scale(0.9);
|
transform: translateX(100px) scale(0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateX(0) scale(1);
|
transform: translateX(0) scale(1);
|
||||||
@@ -1636,6 +1706,7 @@ footer p {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateX(0) scale(1);
|
transform: translateX(0) scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateX(100px) scale(0.9);
|
transform: translateX(100px) scale(0.9);
|
||||||
@@ -1679,14 +1750,37 @@ footer p {
|
|||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links.active li:nth-child(1) { transition-delay: 0.05s; }
|
.nav-links.active li:nth-child(1) {
|
||||||
.nav-links.active li:nth-child(2) { transition-delay: 0.1s; }
|
transition-delay: 0.05s;
|
||||||
.nav-links.active li:nth-child(3) { transition-delay: 0.15s; }
|
}
|
||||||
.nav-links.active li:nth-child(4) { transition-delay: 0.2s; }
|
|
||||||
.nav-links.active li:nth-child(5) { transition-delay: 0.25s; }
|
.nav-links.active li:nth-child(2) {
|
||||||
.nav-links.active li:nth-child(6) { transition-delay: 0.3s; }
|
transition-delay: 0.1s;
|
||||||
.nav-links.active li:nth-child(7) { transition-delay: 0.35s; }
|
}
|
||||||
.nav-links.active li:nth-child(8) { transition-delay: 0.4s; }
|
|
||||||
|
.nav-links.active li:nth-child(3) {
|
||||||
|
transition-delay: 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links.active li:nth-child(4) {
|
||||||
|
transition-delay: 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links.active li:nth-child(5) {
|
||||||
|
transition-delay: 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links.active li:nth-child(6) {
|
||||||
|
transition-delay: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links.active li:nth-child(7) {
|
||||||
|
transition-delay: 0.35s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links.active li:nth-child(8) {
|
||||||
|
transition-delay: 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
.hamburger {
|
.hamburger {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
+772
@@ -0,0 +1,772 @@
|
|||||||
|
// Terminal reference - set when terminal is created in the server rack
|
||||||
|
let activeTerminal = null;
|
||||||
|
|
||||||
|
// Create the interactive terminal in the first rack unit
|
||||||
|
function createTerminal(face) {
|
||||||
|
// Terminal display
|
||||||
|
const terminal = document.createElement('div');
|
||||||
|
terminal.className = 'terminal-display';
|
||||||
|
terminal.setAttribute('tabindex', '0');
|
||||||
|
|
||||||
|
const mobileInput = document.createElement('input');
|
||||||
|
mobileInput.type = 'text';
|
||||||
|
mobileInput.style.opacity = '0';
|
||||||
|
mobileInput.style.position = 'absolute';
|
||||||
|
mobileInput.style.width = '1px';
|
||||||
|
mobileInput.style.height = '1px';
|
||||||
|
mobileInput.style.padding = '0';
|
||||||
|
mobileInput.style.border = '0';
|
||||||
|
mobileInput.style.outline = 'none';
|
||||||
|
mobileInput.style.background = 'transparent';
|
||||||
|
mobileInput.setAttribute('autocorrect', 'off');
|
||||||
|
mobileInput.setAttribute('spellcheck', 'false');
|
||||||
|
mobileInput.setAttribute('autocomplete', 'off');
|
||||||
|
mobileInput.setAttribute('autocapitalize', 'off');
|
||||||
|
mobileInput.autocapitalize = 'off';
|
||||||
|
terminal.appendChild(mobileInput);
|
||||||
|
terminal._mobileInput = mobileInput;
|
||||||
|
|
||||||
|
const content = document.createElement('div');
|
||||||
|
content.className = 'terminal-content';
|
||||||
|
|
||||||
|
const line1 = document.createElement('div');
|
||||||
|
line1.innerHTML = '<span class="terminal-prompt">$</span> uptime';
|
||||||
|
content.appendChild(line1);
|
||||||
|
|
||||||
|
const line2 = document.createElement('div');
|
||||||
|
line2.textContent = 'optional';
|
||||||
|
content.appendChild(line2);
|
||||||
|
|
||||||
|
const line3 = document.createElement('div');
|
||||||
|
line3.innerHTML = '<span class="terminal-prompt">$</span> ';
|
||||||
|
content.appendChild(line3);
|
||||||
|
|
||||||
|
const cursor = document.createElement('span');
|
||||||
|
cursor.className = 'terminal-cursor';
|
||||||
|
line3.appendChild(cursor);
|
||||||
|
|
||||||
|
terminal.appendChild(content);
|
||||||
|
face.appendChild(terminal);
|
||||||
|
|
||||||
|
activeTerminal = terminal;
|
||||||
|
|
||||||
|
terminal.addEventListener('click', () => {
|
||||||
|
mobileInput.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
const commandHistory = [];
|
||||||
|
let historyIndex = -1;
|
||||||
|
let isRoot = false;
|
||||||
|
let isLoginScreen = false;
|
||||||
|
let tabCycleIndex = -1;
|
||||||
|
let tabMatches = [];
|
||||||
|
let tabBaseInput = '';
|
||||||
|
let isTabCompleting = false;
|
||||||
|
|
||||||
|
const allCommands = [
|
||||||
|
'ls', 'ss', 'clear', 'exit', 'rm -rf /', 'sudo su -', 'sudo -i',
|
||||||
|
'pwd', 'whoami', 'hostname', 'date', 'uname', 'uname -a', 'uptime',
|
||||||
|
'id', 'cat /etc/os-release', 'cat ~/.ssh/id_ed25519.pub',
|
||||||
|
'docker ps', 'docker ls', 'docker container ls',
|
||||||
|
'podman ps', 'podman ls', 'podman container ls',
|
||||||
|
'systemctl list-units', 'systemctl list-units --type=service --state=running --no-pager',
|
||||||
|
'ip addr show', 'df -h', 'free -h',
|
||||||
|
'ps aux', 'ps aux --sort=-%mem | head -10',
|
||||||
|
'neofetch', 'sl', 'help', 'echo'
|
||||||
|
];
|
||||||
|
|
||||||
|
function updateDisplay(text) {
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
if (!lastLine) return;
|
||||||
|
const cursorEl = lastLine.querySelector('.terminal-cursor');
|
||||||
|
if (cursorEl) cursorEl.remove();
|
||||||
|
lastLine.textContent = '';
|
||||||
|
const promptSpan = document.createElement('span');
|
||||||
|
promptSpan.className = 'terminal-prompt';
|
||||||
|
promptSpan.textContent = isRoot ? '#' : '$';
|
||||||
|
lastLine.appendChild(promptSpan);
|
||||||
|
lastLine.appendChild(document.createTextNode(' '));
|
||||||
|
lastLine.appendChild(document.createTextNode(text));
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
const commands = {
|
||||||
|
'pwd': '/home/reese/portfolio',
|
||||||
|
'whoami': 'reese',
|
||||||
|
'hostname': 'homelab',
|
||||||
|
'date': new Date().toString(),
|
||||||
|
'uname': 'Linux homelab 7.0.0 #1 SMP x86_64 GNU/Linux',
|
||||||
|
'uname -a': 'Linux homelab 6.8.0 #1 SMP x86_64 GNU/Linux',
|
||||||
|
'uptime': ' 14:30:00 up 42 days, 3:15, 1 user, load average: 0.42, 0.38, 0.35',
|
||||||
|
'id': 'uid=1000(reese) gid=1000(reese) groups=1000(reese),985(podman)',
|
||||||
|
'cat /etc/os-release': 'PRETTY_NAME="Fedora Linux 69 (Workstation Edition)"\nNAME="Fedora Linux"\nVERSION_ID="69"\nVERSION="69 (Workstation Edition)"\nID=fedora\nVARIANT=Workstation Edition\nVARIANT_ID=workstation\nLOGO=fedora-logo-icon\nCPE_NAME="cpe:/o:fedoralinux:fedora:69"\nDEFAULT_HOSTNAME="fedora"\nHOME_URL="https://fedoraproject.org/"\nDOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f69/system-administrators-guide/"\nSUPPORT_URL="https://ask.fedoraproject.org/"\nBUG_REPORT_URL="https://bugzilla.redhat.com/"\nREDHAT_BUGZILLA_PRODUCT="Fedora"\nREDHAT_BUGZILLA_PRODUCT_VERSION=69\nREDHAT_SUPPORT_PRODUCT="Fedora"\nREDHAT_SUPPORT_PRODUCT_VERSION=69',
|
||||||
|
'cat ~/.ssh/id_ed25519.pub': 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpFmKLqRKzMwRe3WkqJvQrN5mHjF2pRn8sT6yUvWxRe reese@homelab',
|
||||||
|
'docker ps': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'docker ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'docker container ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'podman ps': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'podman ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'podman container ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'systemctl list-units': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
||||||
|
'systemctl list-units --type=service --state=running --no-pager': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
||||||
|
'ss': 'Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port\ntcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:222 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3000 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3001 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3002 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8096 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:9090 0.0.0.0:*\ntcp LISTEN 0 128 [::]:22 [::]:*',
|
||||||
|
'ip addr show': '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN\n inet 127.0.0.1/8 scope host lo\n inet6 ::1/128 scope host\n2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP\n inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic eth0\n inet6 fe80::1/64 scope link',
|
||||||
|
'df -h': 'Filesystem Size Used Avail Use% Mounted on\n/dev/sda2 465G 182G 258G 42% /\nudev 16G 0 16G 0% /dev\ntmpfs 16G 2.1M 16G 1% /dev/shm\n/dev/sda1 511M 6.6M 505M 2% /boot/efi\n/dev/sdb1 1.8T 945G 793G 55% /mnt/data\noverlay 1.8T 945G 793G 55% /var/lib/docker/overlay2',
|
||||||
|
'free -h': ' total used free shared buff/cache available\nMem: 31Gi 8.2Gi 12Gi 512Mi 11Gi 22Gi\nSwap: 2.0Gi 0B 2.0Gi',
|
||||||
|
'ps aux': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
||||||
|
'ps aux --sort=-%mem | head -10': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
||||||
|
'neofetch': ` 'c. reese@homelab\n ,xNMM. ----------------------\n .OMMMMo OS: Fedora Linux 69 (Workstation Edition) x86_64\n OMMM0, Host: custom-build\n .;loddo:' loolloddol;. Kernel: 6.8.0\n cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 42 days, 3 hours\n .KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 2847 (dnf)\n XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: bash 5.2.26\n;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 2560x1440\n:MMMMMMMMMMMMMMMMMMMMMMMM: DE: GNOME 46.1\n.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Mutter\n kMMMMMMMMMMMMMMMMMMMMMMMMWd. Terminal: /dev/pts/0\n .XMMMMMMMMMMMMMMMMMMMMMMMMMMk CPU: AMD Ryzen 9 7900X (24) @ 5.6GHz\n .XMMMMMMMMMMMMMMMMMMMMMMK. GPU: NVIDIA GeForce RTX 4090\n kMMMMMMMMMMMMMMMMMMMMd GPU: AMD Ryzen Built-in\n ;KMMMMMMMWXXWMMMMMMMk. Memory: 8.2Gi / 31Gi\n .cooc,. .,coo:.\n\n<span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span>`,
|
||||||
|
'sl': '____\n|DD|____T_\n|_ |_____|<\n @-@-@-oo\\',
|
||||||
|
'help': 'Available commands:\n ls List directory contents\n pwd Print working directory\n whoami Print current user\n hostname Print hostname\n date Print current date/time\n uname Print system information\n uptime Print system uptime\n id Print user identity\n cat Print file contents (try: cat /etc/os-release)\n docker List running containers\n podman List running pods\n systemctl List running systemd services\n ss Show listening ports\n ip Show network interfaces\n df Show disk usage\n free Show memory usage\n ps Show running processes\n neofetch System info display\n sl Steam locomotive\n help Show this help message',
|
||||||
|
};
|
||||||
|
|
||||||
|
terminal.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'ArrowUp') {
|
||||||
|
e.preventDefault();
|
||||||
|
if (historyIndex < commandHistory.length - 1) {
|
||||||
|
historyIndex++;
|
||||||
|
const cmdLine = commandHistory[historyIndex];
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ' + cmdLine + ' ';
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor';
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key === 'ArrowDown') {
|
||||||
|
e.preventDefault();
|
||||||
|
if (historyIndex > 0) {
|
||||||
|
historyIndex--;
|
||||||
|
const cmdLine = commandHistory[historyIndex];
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ' + cmdLine + ' ';
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor';
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
} else {
|
||||||
|
historyIndex = -1;
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
lastLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor';
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
mobileInput.value = '';
|
||||||
|
lastInputValue = '';
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
const oldCursor = lastLine?.querySelector('.terminal-cursor');
|
||||||
|
if (oldCursor) oldCursor.remove();
|
||||||
|
|
||||||
|
const cmdText = lastLine.textContent.replace(/^[\$#]\s*/, '').trim();
|
||||||
|
|
||||||
|
if (cmdText) {
|
||||||
|
commandHistory.unshift(cmdText);
|
||||||
|
historyIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText.startsWith('ls')) {
|
||||||
|
const output = [
|
||||||
|
'total 20K',
|
||||||
|
'drwxr-xr-x 5 reese reese 4.0K May 28 14:30 .',
|
||||||
|
'drwx------ 42 reese reese 4.0K May 28 10:15 ..',
|
||||||
|
'-rw-r--r-- 1 reese reese 245 May 27 09:00 .gitignore',
|
||||||
|
'-rw-r--r-- 1 reese reese 1.2K May 27 11:45 Dockerfile',
|
||||||
|
'-rw-r--r-- 1 reese reese 4.8K May 28 13:50 index.html',
|
||||||
|
'-rw-r--r-- 1 reese reese 680 May 27 09:00 nginx.conf',
|
||||||
|
'-rw-r--r-- 1 reese reese 32K May 28 14:28 profile.jpeg',
|
||||||
|
'-rw-r--r-- 1 reese reese 14K May 28 12:00 script.js',
|
||||||
|
'-rw-r--r-- 1 reese reese 42K May 28 14:25 style.css',
|
||||||
|
'drwxr-xr-x 2 reese reese 4.0K May 27 09:00 src'
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.style.color = '#ccc';
|
||||||
|
outLine.textContent = output;
|
||||||
|
content.appendChild(outLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText.startsWith('ss')) {
|
||||||
|
const output = 'Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port\ntcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:222 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3000 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3001 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3002 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8096 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:9090 0.0.0.0:*\ntcp LISTEN 0 128 [::]:22 [::]:*';
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.style.color = '#ccc';
|
||||||
|
outLine.textContent = output;
|
||||||
|
content.appendChild(outLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText === 'clear') {
|
||||||
|
content.innerHTML = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText === 'exit') {
|
||||||
|
if (!isRoot) {
|
||||||
|
const newAchievements = checkAchievements(cmdText, false);
|
||||||
|
if (newAchievements.length > 0) {
|
||||||
|
revealAchievements();
|
||||||
|
newAchievements.forEach(a => showToast(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoginScreen = true;
|
||||||
|
document.body.innerHTML = '';
|
||||||
|
document.body.style.background = '#000';
|
||||||
|
document.body.style.color = '#fff';
|
||||||
|
document.body.style.fontFamily = 'monospace';
|
||||||
|
document.body.style.padding = '20px';
|
||||||
|
document.body.style.minHeight = '100vh';
|
||||||
|
document.body.style.margin = '0';
|
||||||
|
document.body.style.lineHeight = '1.6';
|
||||||
|
|
||||||
|
const loginContainer = document.createElement('div');
|
||||||
|
loginContainer.style.marginBottom = '10px';
|
||||||
|
loginContainer.textContent = 'homelab tty1';
|
||||||
|
document.body.appendChild(loginContainer);
|
||||||
|
|
||||||
|
const loginInput = document.createElement('input');
|
||||||
|
loginInput.type = 'text';
|
||||||
|
loginInput.style.background = 'transparent';
|
||||||
|
loginInput.style.border = 'none';
|
||||||
|
loginInput.style.outline = 'none';
|
||||||
|
loginInput.style.color = '#fff';
|
||||||
|
loginInput.style.fontFamily = 'monospace';
|
||||||
|
loginInput.style.fontSize = '14px';
|
||||||
|
loginInput.style.width = '300px';
|
||||||
|
loginInput.style.caretColor = '#fff';
|
||||||
|
loginInput.autofocus = true;
|
||||||
|
|
||||||
|
const loginLine = document.createElement('div');
|
||||||
|
loginLine.style.marginBottom = '20px';
|
||||||
|
loginLine.appendChild(document.createTextNode('homelab login: '));
|
||||||
|
loginLine.appendChild(loginInput);
|
||||||
|
|
||||||
|
document.body.appendChild(loginLine);
|
||||||
|
|
||||||
|
loginInput.focus();
|
||||||
|
|
||||||
|
const handleLogin = (e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
const deniedLine = document.createElement('div');
|
||||||
|
deniedLine.textContent = 'Access denied';
|
||||||
|
deniedLine.style.marginTop = '10px';
|
||||||
|
document.body.appendChild(deniedLine);
|
||||||
|
|
||||||
|
const newLoginLine = document.createElement('div');
|
||||||
|
newLoginLine.style.marginTop = '10px';
|
||||||
|
const newInput = document.createElement('input');
|
||||||
|
newInput.type = 'text';
|
||||||
|
newInput.style.background = 'transparent';
|
||||||
|
newInput.style.border = 'none';
|
||||||
|
newInput.style.outline = 'none';
|
||||||
|
newInput.style.color = '#fff';
|
||||||
|
newInput.style.fontFamily = 'monospace';
|
||||||
|
newInput.style.fontSize = '14px';
|
||||||
|
newInput.style.width = '300px';
|
||||||
|
newInput.style.caretColor = '#fff';
|
||||||
|
newInput.autofocus = true;
|
||||||
|
newLoginLine.appendChild(document.createTextNode('homelab login: '));
|
||||||
|
newLoginLine.appendChild(newInput);
|
||||||
|
|
||||||
|
document.body.appendChild(newLoginLine);
|
||||||
|
|
||||||
|
loginInput.remove();
|
||||||
|
newInput.focus();
|
||||||
|
|
||||||
|
newInput.addEventListener('keydown', handleLogin);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
loginInput.addEventListener('keydown', handleLogin);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
isRoot = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLine = document.createElement('div');
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
||||||
|
content.appendChild(newLine);
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor';
|
||||||
|
newLine.appendChild(newCursor);
|
||||||
|
content.scrollTop = content.scrollHeight;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText === 'rm -rf /') {
|
||||||
|
if (!isRoot) {
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.style.color = '#ef4444';
|
||||||
|
outLine.textContent = 'nice try';
|
||||||
|
content.appendChild(outLine);
|
||||||
|
} else {
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.style.color = '#ef4444';
|
||||||
|
outLine.textContent = 'System destruction initiated...';
|
||||||
|
content.appendChild(outLine);
|
||||||
|
setTimeout(() => {
|
||||||
|
document.body.innerHTML = '';
|
||||||
|
document.title = '';
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLine = document.createElement('div');
|
||||||
|
if (isRoot) {
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
||||||
|
newLine.style.color = '#ef4444';
|
||||||
|
} else {
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
||||||
|
}
|
||||||
|
content.appendChild(newLine);
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
||||||
|
newLine.appendChild(newCursor);
|
||||||
|
content.scrollTop = content.scrollHeight;
|
||||||
|
|
||||||
|
const newAchievements = checkAchievements(cmdText, isRoot);
|
||||||
|
if (newAchievements.length > 0) {
|
||||||
|
revealAchievements();
|
||||||
|
newAchievements.forEach(a => showToast(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdText === 'sudo su -' || cmdText === 'sudo -i') {
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.style.color = '#ef4444';
|
||||||
|
outLine.textContent = 'I hope you know what you\'re doing';
|
||||||
|
content.appendChild(outLine);
|
||||||
|
|
||||||
|
isRoot = true;
|
||||||
|
|
||||||
|
const newLine = document.createElement('div');
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
||||||
|
newLine.style.color = '#ef4444';
|
||||||
|
content.appendChild(newLine);
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor red';
|
||||||
|
newLine.appendChild(newCursor);
|
||||||
|
content.scrollTop = content.scrollHeight;
|
||||||
|
|
||||||
|
const newAchievements = checkAchievements(cmdText, isRoot);
|
||||||
|
if (newAchievements.length > 0) {
|
||||||
|
revealAchievements();
|
||||||
|
newAchievements.forEach(a => showToast(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const commands = {
|
||||||
|
'pwd': '/home/reese/portfolio',
|
||||||
|
'whoami': 'reese',
|
||||||
|
'hostname': 'homelab',
|
||||||
|
'date': new Date().toString(),
|
||||||
|
'uname': 'Linux homelab 7.0.0 #1 SMP x86_64 GNU/Linux',
|
||||||
|
'uname -a': 'Linux homelab 6.8.0 #1 SMP x86_64 GNU/Linux',
|
||||||
|
'uptime': ' 14:30:00 up 42 days, 3:15, 1 user, load average: 0.42, 0.38, 0.35',
|
||||||
|
'id': 'uid=1000(reese) gid=1000(reese) groups=1000(reese),985(podman)',
|
||||||
|
'cat /etc/os-release': 'PRETTY_NAME="Fedora Linux 69 (Workstation Edition)"\nNAME="Fedora Linux"\nVERSION_ID="69"\nVERSION="69 (Workstation Edition)"\nID=fedora\nVARIANT=Workstation Edition\nVARIANT_ID=workstation\nLOGO=fedora-logo-icon\nCPE_NAME="cpe:/o:fedoralinux:fedora:69"\nDEFAULT_HOSTNAME="fedora"\nHOME_URL="https://fedoraproject.org/"\nDOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f69/system-administrators-guide/"\nSUPPORT_URL="https://ask.fedoraproject.org/"\nBUG_REPORT_URL="https://bugzilla.redhat.com/"\nREDHAT_BUGZILLA_PRODUCT="Fedora"\nREDHAT_BUGZILLA_PRODUCT_VERSION=69\nREDHAT_SUPPORT_PRODUCT="Fedora"\nREDHAT_SUPPORT_PRODUCT_VERSION=69',
|
||||||
|
'cat ~/.ssh/id_ed25519.pub': 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpFmKLqRKzMwRe3WkqJvQrN5mHjF2pRn8sT6yUvWxRe reese@homelab',
|
||||||
|
'docker ps': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'docker ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'docker container ls': 'NAMES STATUS PORTS\nborg Up 42 days 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp\ngitea Up 42 days 0.0.0.0:222->22/tcp, 0.0.0.0:3000->3000/tcp\nnextcloud Up 42 days 0.0.0.0:8080->80/tcp\nimmich Up 42 days 0.0.0.0:3001->3000/tcp, 0.0.0.0:3002->3001/tcp\nopen-webui Up 42 days 0.0.0.0:8081->8080/tcp\njellyfin Up 42 days 0.0.0.0:8096->8096/tcp\nslopbox Up 42 days 0.0.0.0:9090->80/tcp',
|
||||||
|
'podman ps': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'podman ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'podman container ls': 'NAMES STATUS\nhomepage Up 5 hours\nllama Up 42 days',
|
||||||
|
'systemctl list-units': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
||||||
|
'systemctl list-units --type=service --state=running --no-pager': 'UNIT LOAD ACTIVE SUB DESCRIPTION\nborg.service loaded active running Borg Backup Service\ngitea.service loaded active running Gitea\ndocker.service loaded active running Docker Application Container Engine\nnextcloud.service loaded active running Nextcloud\nimmich.service loaded active running Immich\nopen-webui.service loaded active running Open WebUI\njellyfin.service loaded active running Jellyfin Media Server\nslopbox.service loaded active running Slopbox\nhomepage.service loaded active running Homepage Container',
|
||||||
|
'ss': 'Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port\ntcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:222 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3000 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3001 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:3002 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8080 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8081 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:8096 0.0.0.0:*\ntcp LISTEN 0 128 0.0.0.0:9090 0.0.0.0:*\ntcp LISTEN 0 128 [::]:22 [::]:*',
|
||||||
|
'ip addr show': '1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN\n inet 127.0.0.1/8 scope host lo\n inet6 ::1/128 scope host\n2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP\n inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic eth0\n inet6 fe80::1/64 scope link',
|
||||||
|
'df -h': 'Filesystem Size Used Avail Use% Mounted on\n/dev/sda2 465G 182G 258G 42% /\nudev 16G 0 16G 0% /dev\ntmpfs 16G 2.1M 16G 1% /dev/shm\n/dev/sda1 511M 6.6M 505M 2% /boot/efi\n/dev/sdb1 1.8T 945G 793G 55% /mnt/data\noverlay 1.8T 945G 793G 55% /var/lib/docker/overlay2',
|
||||||
|
'free -h': ' total used free shared buff/cache available\nMem: 31Gi 8.2Gi 12Gi 512Mi 11Gi 22Gi\nSwap: 2.0Gi 0B 2.0Gi',
|
||||||
|
'ps aux': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
||||||
|
'ps aux --sort=-%mem | head -10': 'USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nreese 1242 2.1 12.4 4285632 3932160 ? Sl May15 42:18 /opt/llama.cpp/build/bin/llama-server --model /models/Qwen3-30B-A3B.Q4_K_M.gguf --port 8082\ndocker 2341 1.2 6.8 8562348 2156032 ? Sl May15 28:45 /usr/bin/dockerd -H fd://\nreese 3456 0.8 3.2 2845632 1015808 ? Sl May15 18:22 /opt/open-webui/server\nreese 4567 0.5 2.1 1562348 665600 ? Sl May15 12:34 /usr/bin/python3 /opt/borg/borgmatic\nroot 5678 0.3 1.4 945632 448000 ? Ssl May15 8:12 /usr/bin/docker-proxy -p tcp:0.0.0.0:80:80\nreese 6789 0.2 1.1 745632 348000 ? Ssl May15 5:45 /usr/bin/podman run --name homepage\nroot 7890 0.1 0.8 545632 256000 ? Ssl May15 3:22 /usr/bin/docker-proxy -p tcp:0.0.0.0:443:443',
|
||||||
|
'neofetch': ` 'c. reese@homelab\n ,xNMM. ----------------------\n .OMMMMo OS: Fedora Linux 69 (Workstation Edition) x86_64\n OMMM0, Host: custom-build\n .;loddo:' loolloddol;. Kernel: 6.8.0\n cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 42 days, 3 hours\n .KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 2847 (dnf)\n XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: bash 5.2.26\n;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 2560x1440\n:MMMMMMMMMMMMMMMMMMMMMMMM: DE: GNOME 46.1\n.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Mutter\n kMMMMMMMMMMMMMMMMMMMMMMMMWd. Terminal: /dev/pts/0\n .XMMMMMMMMMMMMMMMMMMMMMMMMMMk CPU: AMD Ryzen 9 7900X (24) @ 5.6GHz\n .XMMMMMMMMMMMMMMMMMMMMMMK. GPU: NVIDIA GeForce RTX 4090\n kMMMMMMMMMMMMMMMMMMMMd GPU: AMD Ryzen Built-in\n ;KMMMMMMMWXXWMMMMMMMk. Memory: 8.2Gi / 31Gi\n .cooc,. .,coo:.\n\n<span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #22c55e">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #eab308">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #3b82f6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #8b5cf6">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span><span style="color: #ec4899">███</span>`,
|
||||||
|
'sl': '____\n|DD|____T_\n|_ |_____|<\n @-@-@-oo\\',
|
||||||
|
'help': 'Available commands:\n ls List directory contents\n pwd Print working directory\n whoami Print current user\n hostname Print hostname\n date Print current date/time\n uname Print system information\n uptime Print system uptime\n id Print user identity\n cat Print file contents (try: cat /etc/os-release)\n docker List running containers\n podman List running pods\n systemctl List running systemd services\n ss Show listening ports\n ip Show network interfaces\n df Show disk usage\n free Show memory usage\n ps Show running processes\n neofetch System info display\n sl Steam locomotive\n help Show this help message',
|
||||||
|
};
|
||||||
|
|
||||||
|
if (cmdText.startsWith('echo ')) {
|
||||||
|
const output = cmdText.replace(/^echo\s+/, '');
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
outLine.textContent = output;
|
||||||
|
outLine.style.color = '#ccc';
|
||||||
|
content.appendChild(outLine);
|
||||||
|
} else if (commands[cmdText] !== undefined) {
|
||||||
|
const output = commands[cmdText];
|
||||||
|
const outLine = document.createElement('div');
|
||||||
|
outLine.style.whiteSpace = 'pre-wrap';
|
||||||
|
if (cmdText === 'neofetch') {
|
||||||
|
outLine.innerHTML = output;
|
||||||
|
} else {
|
||||||
|
outLine.textContent = output;
|
||||||
|
outLine.style.color = '#ccc';
|
||||||
|
}
|
||||||
|
content.appendChild(outLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newAchievements = checkAchievements(cmdText, isRoot);
|
||||||
|
if (newAchievements.length > 0) {
|
||||||
|
revealAchievements();
|
||||||
|
newAchievements.forEach(a => showToast(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLine = document.createElement('div');
|
||||||
|
if (isRoot) {
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">#</span> ';
|
||||||
|
newLine.style.color = '#ef4444';
|
||||||
|
} else {
|
||||||
|
newLine.innerHTML = '<span class="terminal-prompt">$</span> ';
|
||||||
|
}
|
||||||
|
content.appendChild(newLine);
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
||||||
|
newLine.appendChild(newCursor);
|
||||||
|
content.scrollTop = content.scrollHeight;
|
||||||
|
} else if (e.key === 'Backspace') {
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
if (lastLine) {
|
||||||
|
e.preventDefault();
|
||||||
|
mobileInput.value = mobileInput.value.slice(0, -1);
|
||||||
|
lastInputValue = mobileInput.value;
|
||||||
|
const cursorEl = lastLine.querySelector('.terminal-cursor');
|
||||||
|
if (cursorEl) cursorEl.remove();
|
||||||
|
lastLine.textContent = '';
|
||||||
|
const promptSpan = document.createElement('span');
|
||||||
|
promptSpan.className = 'terminal-prompt';
|
||||||
|
promptSpan.textContent = isRoot ? '#' : '$';
|
||||||
|
lastLine.appendChild(promptSpan);
|
||||||
|
lastLine.appendChild(document.createTextNode(' '));
|
||||||
|
lastLine.appendChild(document.createTextNode(mobileInput.value));
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key === 'Tab') {
|
||||||
|
e.preventDefault();
|
||||||
|
const inputVal = mobileInput.value;
|
||||||
|
if (!inputVal) return;
|
||||||
|
|
||||||
|
function arraysEqual(a, b) {
|
||||||
|
if (a.length !== b.length) return false;
|
||||||
|
for (let i = 0; i < a.length; i++) {
|
||||||
|
if (a[i] !== b[i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTabCompleting = true;
|
||||||
|
|
||||||
|
const matchSource = tabBaseInput || inputVal;
|
||||||
|
const matches = allCommands.filter(cmd => cmd.startsWith(matchSource));
|
||||||
|
|
||||||
|
if (matches.length === 0) {
|
||||||
|
isTabCompleting = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matches.length === 1) {
|
||||||
|
tabCycleIndex = -1;
|
||||||
|
tabMatches = [];
|
||||||
|
tabBaseInput = '';
|
||||||
|
mobileInput.value = matches[0];
|
||||||
|
lastInputValue = matches[0];
|
||||||
|
updateDisplay(mobileInput.value);
|
||||||
|
} else if (!arraysEqual(tabMatches, matches) || tabBaseInput !== matchSource) {
|
||||||
|
tabMatches = matches;
|
||||||
|
tabBaseInput = matchSource;
|
||||||
|
tabCycleIndex = 0;
|
||||||
|
mobileInput.value = matches[0];
|
||||||
|
lastInputValue = matches[0];
|
||||||
|
updateDisplay(matches[0]);
|
||||||
|
} else {
|
||||||
|
tabCycleIndex = (tabCycleIndex + 1) % matches.length;
|
||||||
|
mobileInput.value = matches[tabCycleIndex];
|
||||||
|
lastInputValue = matches[tabCycleIndex];
|
||||||
|
updateDisplay(matches[tabCycleIndex]);
|
||||||
|
}
|
||||||
|
isTabCompleting = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
terminal.addEventListener('focus', () => {
|
||||||
|
mobileInput.focus();
|
||||||
|
terminal.style.boxShadow = '0 0 8px rgba(234, 179, 8, 0.3), inset 0 0 20px rgba(34, 197, 94, 0.1)';
|
||||||
|
terminal.style.borderColor = '#eab308';
|
||||||
|
terminal.classList.add('grown');
|
||||||
|
terminal.classList.add('opaque');
|
||||||
|
const face = terminal.closest('.server-face');
|
||||||
|
const unit = face?.closest('.rack-unit');
|
||||||
|
face?.classList.add('grown');
|
||||||
|
unit?.classList.add('grown');
|
||||||
|
document.getElementById('hero').classList.add('shifted');
|
||||||
|
document.querySelector('.rack-container')?.classList.add('opaque');
|
||||||
|
});
|
||||||
|
|
||||||
|
terminal.addEventListener('blur', () => {
|
||||||
|
if (heroMouseDown) return;
|
||||||
|
terminal.style.boxShadow = '';
|
||||||
|
terminal.style.borderColor = '#2a2a2e';
|
||||||
|
terminal.classList.remove('grown');
|
||||||
|
terminal.classList.remove('opaque');
|
||||||
|
const face = terminal.closest('.server-face');
|
||||||
|
const unit = face?.closest('.rack-unit');
|
||||||
|
face?.classList.remove('grown');
|
||||||
|
unit?.classList.remove('grown');
|
||||||
|
document.getElementById('hero').classList.remove('shifted');
|
||||||
|
document.querySelector('.rack-container')?.classList.remove('opaque');
|
||||||
|
});
|
||||||
|
|
||||||
|
mobileInput.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
mobileInput.blur();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mobileInput.addEventListener('blur', () => {
|
||||||
|
if (heroMouseDown) return;
|
||||||
|
terminal.style.boxShadow = '';
|
||||||
|
terminal.style.borderColor = '#2a2a2e';
|
||||||
|
terminal.classList.remove('grown');
|
||||||
|
terminal.classList.remove('opaque');
|
||||||
|
const face = terminal.closest('.server-face');
|
||||||
|
const unit = face?.closest('.rack-unit');
|
||||||
|
face?.classList.remove('grown');
|
||||||
|
unit?.classList.remove('grown');
|
||||||
|
document.getElementById('hero').classList.remove('shifted');
|
||||||
|
document.querySelector('.rack-container')?.classList.remove('opaque');
|
||||||
|
});
|
||||||
|
|
||||||
|
let lastInputValue = '';
|
||||||
|
|
||||||
|
mobileInput.addEventListener('input', () => {
|
||||||
|
if (isTabCompleting) return;
|
||||||
|
tabCycleIndex = -1;
|
||||||
|
tabMatches = [];
|
||||||
|
tabBaseInput = '';
|
||||||
|
const lastLine = content.lastElementChild;
|
||||||
|
if (!lastLine) return;
|
||||||
|
|
||||||
|
const inputText = mobileInput.value;
|
||||||
|
const addedText = inputText.slice(lastInputValue.length);
|
||||||
|
|
||||||
|
if (addedText) {
|
||||||
|
const cursorEl = lastLine.querySelector('.terminal-cursor');
|
||||||
|
if (cursorEl) cursorEl.remove();
|
||||||
|
lastLine.insertAdjacentText('beforeend', addedText);
|
||||||
|
const newCursor = document.createElement('span');
|
||||||
|
newCursor.className = 'terminal-cursor' + (isRoot ? ' red' : '');
|
||||||
|
lastLine.appendChild(newCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastInputValue = inputText;
|
||||||
|
});
|
||||||
|
|
||||||
|
return terminal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Achievement System
|
||||||
|
const ACHIEVEMENTS_STORAGE_KEY = 'reese-terminal-achievements';
|
||||||
|
|
||||||
|
const ACHIEVEMENTS = {
|
||||||
|
time_flies: { name: 'Time Flies', desc: 'Check the system uptime', icon: '⏱️', cmd: 'uptime' },
|
||||||
|
curious: { name: 'Curious', desc: 'List directory contents', icon: '📁', cmd: 'ls', prefix: true },
|
||||||
|
port_scanner: { name: 'Port Scanner', desc: 'Check listening ports', icon: '🔍', cmd: 'ss', prefix: true },
|
||||||
|
password_reset: { name: 'Password Reset Request', desc: 'Submit a SNOW request', icon: '🚪', cmd: 'exit' },
|
||||||
|
power_user: { name: 'Power User', desc: 'Gain root access', icon: '👑', cmd: 'sudo su -' },
|
||||||
|
nice_try: { name: 'Nice Try', desc: 'Attempt rm -rf / as a normal user', icon: '😏', cmd: 'rm -rf /' },
|
||||||
|
restore_backup: { name: 'Restore from Backup', desc: 'Actually destroy the system as root', icon: '💥', cmd: 'rm -rf / root' },
|
||||||
|
where_am_i: { name: 'Where Am I?', desc: 'Print working directory', icon: '📍', cmd: 'pwd' },
|
||||||
|
self_aware: { name: 'Self-Aware', desc: 'Print current user', icon: '🪞', cmd: 'whoami' },
|
||||||
|
identity: { name: 'Identity Crisis', desc: 'Print hostname', icon: '🖥️', cmd: 'hostname' },
|
||||||
|
time_keeper: { name: 'Time Keeper', desc: 'Print current date', icon: '📅', cmd: 'date' },
|
||||||
|
system_explorer: { name: 'System Explorer', desc: 'Print system information', icon: '🔧', cmd: 'uname' },
|
||||||
|
access_granted: { name: 'Access Granted', desc: 'Check user identity', icon: '🆔', cmd: 'id' },
|
||||||
|
os_detective: { name: 'OS Detective', desc: 'Read the OS release file', icon: '🐧', cmd: 'cat /etc/os-release' },
|
||||||
|
ssh_explorer: { name: 'SSH Explorer', desc: 'View SSH public key', icon: '🔑', cmd: 'cat ~/.ssh/id_ed25519.pub' },
|
||||||
|
container_watcher: { name: 'Container Watcher', desc: 'List Docker containers', icon: '🐳', cmd: 'docker ps', prefix: true },
|
||||||
|
docker_confused: { name: 'Docker Confused', desc: 'Use wrong Docker command', icon: '🤔', cmd: 'docker ls', prefix: true },
|
||||||
|
container_pro: { name: 'Container Pro', desc: 'Use correct container command', icon: '✅', cmd: 'docker container ls', prefix: true },
|
||||||
|
podman_fan: { name: 'Podman Fan', desc: 'List Podman containers', icon: '📦', cmd: 'podman ps', prefix: true },
|
||||||
|
podman_confused: { name: 'Podman Confused', desc: 'Use wrong Podman command', icon: '🤔', cmd: 'podman ls', prefix: true },
|
||||||
|
podman_pro: { name: 'Podman Pro', desc: 'Use correct Podman command', icon: '✅', cmd: 'podman container ls', prefix: true },
|
||||||
|
service_hunter: { name: 'Service Hunter', desc: 'List systemd units', icon: '🔎', cmd: 'systemctl list-units', prefix: true },
|
||||||
|
service_filter: { name: 'Service Filter', desc: 'Filter running services', icon: '🎯', cmd: 'systemctl list-units --type=service --state=running --no-pager' },
|
||||||
|
network_ninja: { name: 'Network Ninja', desc: 'Show network interfaces', icon: '🌐', cmd: 'ip addr show', prefix: true },
|
||||||
|
disk_detective: { name: 'Disk Detective', desc: 'Check disk usage', icon: '💾', cmd: 'df -h' },
|
||||||
|
memory_minded: { name: 'Memory Minded', desc: 'Check memory usage', icon: '🧠', cmd: 'free -h' },
|
||||||
|
process_watcher: { name: 'Process Watcher', desc: 'List running processes', icon: '👁️', cmd: 'ps aux', prefix: true },
|
||||||
|
memory_hog: { name: 'Memory Hog', desc: 'Find top memory consumers', icon: '🐗', cmd: 'ps aux --sort=-%mem | head -10' },
|
||||||
|
aesthetic_mode: { name: 'Aesthetic Mode', desc: 'Display system info with style', icon: '✨', cmd: 'neofetch' },
|
||||||
|
help_seeker: { name: 'Help Seeker', desc: 'Look up available commands', icon: '📖', cmd: 'help' },
|
||||||
|
clean_slate: { name: 'Clean Slate', desc: 'Clear the terminal', icon: '🧹', cmd: 'clear' },
|
||||||
|
train_spotter: { name: 'Train Spotter', desc: 'Run the steam locomotive', icon: '🚂', cmd: 'sl' },
|
||||||
|
tain: { name: 'I like trains', desc: 'Choo chooooooo', icon: '🧹', cmd: 'sl' },
|
||||||
|
};
|
||||||
|
|
||||||
|
// Load unlocked achievement keys from localStorage
|
||||||
|
function loadAchievements() {
|
||||||
|
try {
|
||||||
|
const saved = localStorage.getItem(ACHIEVEMENTS_STORAGE_KEY);
|
||||||
|
return saved ? JSON.parse(saved) : [];
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist unlocked achievement keys to localStorage
|
||||||
|
function saveAchievements(achieved) {
|
||||||
|
localStorage.setItem(ACHIEVEMENTS_STORAGE_KEY, JSON.stringify(achieved));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the given command triggers any new achievements; returns unlocked achievement objects
|
||||||
|
function checkAchievements(cmdText, isRoot) {
|
||||||
|
const achieved = loadAchievements();
|
||||||
|
const newAchievements = [];
|
||||||
|
|
||||||
|
for (const [key, achievement] of Object.entries(ACHIEVEMENTS)) {
|
||||||
|
if (achieved.includes(key)) continue;
|
||||||
|
|
||||||
|
if (key === 'restore_backup' && cmdText === 'rm -rf /' && isRoot) {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'power_user' && (cmdText === 'sudo su -' || cmdText === 'sudo -i')) {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'password_reset' && cmdText === 'exit' && !isRoot) {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'nice_try' && cmdText === 'rm -rf /' && !isRoot) {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'system_explorer' && (cmdText === 'uname' || cmdText === 'uname -a')) {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'docker_confused' && cmdText === 'docker ls') {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (key === 'podman_confused' && cmdText === 'podman ls') {
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
} else if (achievement.prefix ? cmdText.startsWith(achievement.cmd) : achievement.cmd === cmdText) {
|
||||||
|
if ((key === 'nice_try' && isRoot) || (key === 'restore_backup' && !isRoot)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
achieved.push(key);
|
||||||
|
newAchievements.push(achievement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newAchievements.length > 0) {
|
||||||
|
saveAchievements(achieved);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newAchievements;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display a toast notification for a newly unlocked achievement
|
||||||
|
function showToast(achievement) {
|
||||||
|
const container = document.getElementById('toast-container') || createToastContainer();
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.className = 'toast';
|
||||||
|
toast.innerHTML = `
|
||||||
|
<div class="toast-icon">${achievement.icon}</div>
|
||||||
|
<div class="toast-content">
|
||||||
|
<div class="toast-label">Achievement Unlocked</div>
|
||||||
|
<div class="toast-title">${achievement.name}</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
container.appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.classList.add('removing');
|
||||||
|
setTimeout(() => toast.remove(), 300);
|
||||||
|
}, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the toast notification container element if it doesn't exist
|
||||||
|
function createToastContainer() {
|
||||||
|
const container = document.createElement('div');
|
||||||
|
container.id = 'toast-container';
|
||||||
|
container.className = 'toast-container';
|
||||||
|
document.body.appendChild(container);
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reveal the hidden achievements section and add it to the nav if needed
|
||||||
|
function revealAchievements() {
|
||||||
|
const section = document.getElementById('achievements');
|
||||||
|
if (section.style.display === 'none' || !section.style.display) {
|
||||||
|
section.style.display = 'block';
|
||||||
|
section.classList.add('fade-in');
|
||||||
|
setTimeout(() => section.classList.add('visible'), 50);
|
||||||
|
addAchievementsNav();
|
||||||
|
}
|
||||||
|
renderAchievements();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all achievement cards (unlocked and locked) into the achievements grid
|
||||||
|
function renderAchievements() {
|
||||||
|
const achieved = loadAchievements();
|
||||||
|
const total = Object.keys(ACHIEVEMENTS).length;
|
||||||
|
const count = achieved.length;
|
||||||
|
|
||||||
|
const countEl = document.getElementById('achievements-count');
|
||||||
|
countEl.textContent = `${count} / ${total} achievements unlocked`;
|
||||||
|
|
||||||
|
const grid = document.getElementById('achievements-grid');
|
||||||
|
grid.innerHTML = '';
|
||||||
|
|
||||||
|
for (const [key, achievement] of Object.entries(ACHIEVEMENTS)) {
|
||||||
|
const isUnlocked = achieved.includes(key);
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = `achievement-card ${isUnlocked ? 'unlocked' : 'locked'}`;
|
||||||
|
card.innerHTML = `
|
||||||
|
<div class="achievement-icon">${achievement.icon}</div>
|
||||||
|
<div class="achievement-info">
|
||||||
|
<h3>${isUnlocked ? achievement.name : '???'}</h3>
|
||||||
|
<p>${isUnlocked ? achievement.desc : 'Keep exploring the terminal...'}</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
grid.appendChild(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add an "Achievements" link to the main navigation if achievements have been unlocked
|
||||||
|
function addAchievementsNav() {
|
||||||
|
const navLinks = document.getElementById('navLinks');
|
||||||
|
const existing = document.getElementById('nav-achievements');
|
||||||
|
if (!existing && loadAchievements().length > 0) {
|
||||||
|
const li = document.createElement('li');
|
||||||
|
li.id = 'nav-achievements';
|
||||||
|
li.innerHTML = '<a href="#achievements">Achievements</a>';
|
||||||
|
navLinks.appendChild(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore previously unlocked achievements on page load
|
||||||
|
(function initAchievements() {
|
||||||
|
const achieved = loadAchievements();
|
||||||
|
if (achieved.length > 0) {
|
||||||
|
revealAchievements();
|
||||||
|
addAchievementsNav();
|
||||||
|
}
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user