convert wetty from submodule to normal directory

This commit is contained in:
douboer@gmail.com
2026-03-03 16:07:18 +08:00
parent 1db76701a6
commit 0d185d2b3c
131 changed files with 15543 additions and 1 deletions

28
wetty/conf/config.json5 Normal file
View File

@@ -0,0 +1,28 @@
{
ssh: {
// user: 'username', // default user to use when ssh-ing
host: 'localhost', // Server to ssh to
auth: 'password', // shh authentication, method. Defaults to "password", you can use "publickey,password" instead'
// pass: "password", // Password to use when sshing
// key: "", // path to an optional client private key, connection will be password-less and insecure!
port: 22, // Port to ssh to
knownHosts: '/dev/null', // ssh knownHosts file to use
// config: '/home/user/.wetty_ssh_config', // alternative ssh configuration file, see "-F" option in ssh(1)
},
server: {
base: '/wetty/', // URL base to serve resources from
port: 3000, // Port to listen on
host: '0.0.0.0', // address to listen on
title: 'WeTTY - The Web Terminal Emulator', // Page title
bypassHelmet: false, // Disable Helmet security checks
},
forceSSH: false, // Force sshing to local machine over login if running as root
command: 'login', // Command to run on server. Login will use ssh if connecting to different server
/*
ssl:{
key: 'ssl.key',
cert: 'ssl.cert',
}
*/
}

88
wetty/conf/nginx.template Normal file
View File

@@ -0,0 +1,88 @@
server {
listen ${NGINX_PORT};
listen [::]:${NGINX_PORT};
server_name ${NGINX_DOMAIN};
root /var/www/${NGINX_DOMAIN}/public;
# $uri, index.html
location / {
try_files $uri $uri/ /index.html;
}
# headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-UA-Compatible "IE=Edge" always;
add_header Cache-Control "no-transform" always;
# . files
location ~ /\. {
deny all;
}
# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
expires 7d;
access_log off;
}
# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff|woff2)$ {
add_header Access-Control-Allow-Origin "*";
expires 7d;
access_log off;
}
location ^~ /wetty {
proxy_pass http://${WETTY_HOST}:${WETTY_PORT};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 43200000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# Authenticate user via other services (e.g., oauth2 end-points)
#
# Configuration :
# - Configure a 'auth_request' directive for this server block
# - Capture the authenticated username using 'auth_request_set'
# - Set the 'remote-user' request header accordingly
#
# Example (using lasso as authentication middleware):
#
# Add to server block:
# auth_request /lasso-validate
# auth_request_set $auth_user $upstream_http_x_lasso_user;
#
# Add to /wetty location block
# proxy_set_header remote-user $auth_user;
#
# And configure a '/lasso-validate' location. See this blog for further
# guidance: https://developer.okta.com/blog/2018/08/28/nginx-auth-request
}
# gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
}
# subdomains redirect
server {
listen ${NGINX_PORT};
listen [::]:${NGINX_PORT};
server_name *.${NGINX_DOMAIN};
return 301 https://${NGINX_DOMAIN}$request_uri;
}
# set ft=conf

13
wetty/conf/wetty.conf Normal file
View File

@@ -0,0 +1,13 @@
# Upstart script
# /etc/init/wetty.conf
description "Web TTY"
author "Wetty"
start on started mountall
stop on shutdown
respawn
respawn limit 20 5
exec sudo -u root wetty -p 3000

21
wetty/conf/wetty.service Normal file
View File

@@ -0,0 +1,21 @@
# systemd unit file
#
# place in /etc/systemd/system
# systemctl enable wetty.service
# systemctl start wetty.service
[Unit]
Description=Wetty Web Terminal
After=network.target
[Service]
Type=simple
WorkingDirectory=$HOME/.config/yarn/global/node_modules/wetty/
ExecStart=/usr/bin/node . -p 3000 --host 127.0.0.1
TimeoutStopSec=20
KillMode=mixed
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target