feat: add webshell

This commit is contained in:
2025-03-18 21:38:06 +08:00
parent aa1cee7c9f
commit 9970efccfd
19 changed files with 2976 additions and 39 deletions

View File

@@ -0,0 +1,22 @@
import * as pty from 'node-pty';
export function createPty(cmd: string) {
const ptyProcess = pty.spawn(cmd, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env,
});
ptyProcess.onData((data) => {
process.stdout.write(data);
});
ptyProcess.write('ls\r');
ptyProcess.resize(100, 40);
ptyProcess.write('ls\r');
}
// createPty('ls');
createPty('zsh');