This commit is contained in:
Waylon Walker 2025-11-22 19:58:34 -06:00
parent 93a4b412b4
commit 7b6e0bfbfa
9 changed files with 398 additions and 0 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM archlinux:base
RUN pacman -Sy --noconfirm zsh ttyd
EXPOSE 7681
ENTRYPOINT [ "ttyd", "zsh", "-i" ]

0
create-schema.sh Executable file → Normal file
View file

6
custom.css Normal file
View file

@ -0,0 +1,6 @@
:root {
--background-color: rgba(40, 42, 54, 0.8); /* Dracula dark */
--foreground-color: #f8f8f2;
--cursor-color: #f8f8f2;
--font-family: "Fira Code", monospace;
}

114
index.html Normal file
View file

@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ttyd - Dracula Themed Terminal</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm/css/xterm.css" />
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
background: url('https://wallpapercave.com/wp/wp2566511.jpg') no-repeat center center fixed;
background-size: cover;
font-family: monospace;
}
#terminal-container {
height: 100%;
width: 100%;
background-color: rgba(40, 42, 54, 0.6); /* Dracula theme w/ transparency */
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
box-sizing: border-box;
}
.xterm {
font-family: "Fira Code", monospace;
font-size: 14px;
}
</style>
</head>
<body>
<div id="terminal-container">
<div id="terminal"></div>
</div>
<!-- Load xterm.js and addons -->
<script src="https://cdn.jsdelivr.net/npm/xterm/lib/xterm.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit/lib/xterm-addon-fit.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-web-links/lib/xterm-addon-web-links.min.js"></script>
<script>
function ttyd_attach(term, socket) {
socket.onopen = () => {
term.focus();
term.write('\x1b[?25h'); // show cursor
};
socket.onerror = () => {
term.write('\r\n\x1b[31mConnection error.\x1b[m\r\n');
};
socket.onclose = () => {
term.write('\r\n\x1b[31mConnection closed.\x1b[m\r\n');
};
term.onData(data => {
socket.send(data);
});
socket.onmessage = event => {
term.write(event.data);
};
}
const term = new Terminal({
theme: {
background: '#282a36',
foreground: '#f8f8f2',
cursor: '#f8f8f2',
black: '#21222c',
red: '#ff5555',
green: '#50fa7b',
yellow: '#f1fa8c',
blue: '#bd93f9',
magenta: '#ff79c6',
cyan: '#8be9fd',
white: '#f8f8f2',
brightBlack: '#6272a4',
brightRed: '#ff6e6e',
brightGreen: '#69ff94',
brightYellow: '#ffffa5',
brightBlue: '#d6acff',
brightMagenta: '#ff92df',
brightCyan: '#a4ffff',
brightWhite: '#ffffff'
},
fontFamily: 'Fira Code, monospace',
fontSize: 14,
cursorBlink: true,
});
const fitAddon = new FitAddon.FitAddon();
const webLinksAddon = new WebLinksAddon.WebLinksAddon();
term.loadAddon(fitAddon);
term.loadAddon(webLinksAddon);
term.open(document.getElementById("terminal"));
fitAddon.fit();
const wsProto = location.protocol === "https:" ? "wss://" : "ws://";
const socket = new WebSocket(wsProto + location.host + "/ws");
ttyd_attach(term, socket);
window.addEventListener("resize", () => fitAddon.fit());
</script>
</body>
</html>

0
ingest_thoughts.py Executable file → Normal file
View file

22
pretty.html Normal file

File diff suppressed because one or more lines are too long

32
pretty.py Normal file
View file

@ -0,0 +1,32 @@
from bs4 import BeautifulSoup
# Read the original HTML
with open("index.html", "r", encoding="utf-8") as f:
html = f.read()
# Parse HTML
soup = BeautifulSoup(html, "html.parser")
# Find all inline scripts (no src attribute)
inline_scripts = soup.find_all("script", src=False)
# Extract JS code
all_js = "\n\n".join(script.string or "" for script in inline_scripts)
# Remove inline script tags from HTML
for script in inline_scripts:
script.decompose()
# Insert new external script reference
new_script_tag = soup.new_tag("script", src="script.js")
soup.body.append(new_script_tag)
# Write updated HTML back
with open("index.html", "w", encoding="utf-8") as f:
f.write(str(soup))
# Write JS to external file
with open("script.js", "w", encoding="utf-8") as f:
f.write(all_js)
print("✅ Inline JavaScript extracted to script.js and index.html updated.")

2
script.js Normal file

File diff suppressed because one or more lines are too long

215
ttyd.yaml Normal file
View file

@ -0,0 +1,215 @@
apiVersion: v1
kind: Namespace
metadata:
name: tty
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ttyd
namespace: tty
spec:
replicas: 1
selector:
matchLabels:
app: ttyd
template:
metadata:
labels:
app: ttyd
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nextcloud-storage
operator: In
values:
- "true"
containers:
- name: ttyd
# image: archlinux:latest
# image: docker.io/waylonwalker/devtainer-arch:0.1.4
image: docker.io/waylonwalker/devtainer-arch:20250726160955
ports:
- containerPort: 7681
command: ["ttyd"]
args: ["-W", "su", "-", "waylon"]
args: ["-W", "zsh"]
# command: ["/bin/sh"]
# args:
# - -c
# - |
# # pacman -Sy --noconfirm base-devel ttyd zsh uv stow sudo git &&
# # useradd -m waylon -s /bin/zsh &&
# # usermod -aG wheel waylon &&
# # echo "waylon:waylon" | chpasswd &&
# # echo "waylon ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-waylon
# # chmod 0440 /etc/sudoers.d/99-waylon
# # # git clone https://aur.archlinux.org/paru
# # ttyd -W login
# # useradd -m -s /usr/bin/zsh waylon &&
# # echo "waylon ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99-waylon &&
# # chmod 0440 /etc/sudoers.d/99-waylon &&
# # su - waylon -c "git clone https://github.com/waylonwalker/devtainer" &&
# # apt-get purge -y 'nvidia*' 'libnvidia*'
# # sudo apt-get autoremove -y
# # sudo apt-get autoclean
# # sudo apt-get update
# # sudo apt-get upgrade
# # su - waylon -c "cd devtainer && stow zsh tmux bin git nvim"
# su - waylon -c "ttyd -W zsh"
securityContext:
# runAsUser: 0 # run as root to install packages
runAsUser: 1000
runAsGroup: 1000
readinessProbe:
httpGet:
path: /
port: 7681
initialDelaySeconds: 1
periodSeconds: 10
volumeMounts:
- name: ttyd-waylon-home
mountPath: /home/waylon
- name: tty-git-data
mountPath: /git
volumes:
- name: ttyd-waylon-home
persistentVolumeClaim:
claimName: ttyd-waylon-home
- name: tty-git-data
persistentVolumeClaim:
claimName: tty-git-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ttyd-waylon-home
namespace: tty
spec:
storageClassName: longhorn-backup
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: Service
metadata:
name: ttyd
namespace: tty
spec:
selector:
app: ttyd
ports:
- name: ttyd
port: 80
targetPort: 7681
protocol: TCP
- name: ttyd1
port: 8000
targetPort: 8000
protocol: TCP
- name: ttyd2
port: 8001
targetPort: 8001
protocol: TCP
- name: ttyd3
port: 8002
targetPort: 8002
protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ttyd
namespace: tty
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/enable-websockets: "true"
spec:
rules:
- host: tty.wayl.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ttyd
port:
number: 80
- host: tty1.wayl.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ttyd
port:
number: 8000
- host: tty2.wayl.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ttyd
port:
number: 8001
- host: tty3.wayl.one
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ttyd
port:
number: 8002
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-tty-git-data
namespace: tty
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: hostpath
hostPath:
path: /mnt/main/nextcloud/data/data/waylon/files/git
type: DirectoryOrCreate
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: nextcloud-storage
operator: In
values:
- "true"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tty-git-data
namespace: tty
spec:
accessModes:
- ReadWriteOnce
storageClassName: hostpath
volumeName: pv-tty-git-data
resources:
requests:
storage: 10Gi