### Set Up DumbTerm for Local Development Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md This guide provides the necessary commands to run DumbTerm locally for development. It covers installing dependencies with npm, creating and populating a local .env file from the example, and starting the server. This method utilizes your local machine's terminal environment. ```bash # 1. Install dependencies: npm install # 2. Create the environment file: cp .env.example .env # 3. Start the server: npm start ``` ```bash # .env file content PORT=3000 # Port to run the server on DUMBTERM_PIN=1234 # Optional PIN protection SITE_TITLE=DumbTerm # Custom site title BASE_URL=http://localhost:3000 # Base URL for the application ``` -------------------------------- ### Configure and Run DumbTerm with Docker Compose Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md This snippet provides a Docker Compose configuration for running DumbTerm. It defines the service, maps ports and volumes, and sets various environment variables for customization. The accompanying command starts the container in detached mode. ```yaml services: dumbterm: image: dumbwareio/dumbterm:latest container_name: dumbterm restart: unless-stopped ports: - ${DUMBTERM_PORT:-3000}:3000 volumes: - ${DUMBTERM_CONFIG:-./config}:/root/.config - ${DUMBTERM_DATA_DIR:-./data}:/root/data environment: # Container timezone TZ: ${DUMBTERM_TZ:-America/Los_Angeles} # The title shown in the web interface SITE_TITLE: ${DUMBTERM_SITE_TITLE:-DumbTerm} # Recommended PIN protection (leave empty to disable) DUMBTERM_PIN: ${DUMBTERM_PIN:-1234} # The base URL for the application BASE_URL: ${DUMBTERM_BASE_URL:-http://localhost:3000} ENABLE_STARSHIP: ${ENABLE_STARSHIP:-true} LOCKOUT_TIME: ${DUMBTERM_LOCKOUT_TIME:-15} # Minutes # Session duration in hours before requiring re-authentication MAX_SESSION_AGE: ${DUMBTERM_MAX_SESSION_AGE:-24} # Hours # (OPTIONAL) - List of allowed origins for CORS # ALLOWED_ORIGINS: ${DUMBTERM_ALLOWED_ORIGINS:-http://localhost:3000} ``` ```bash docker compose up -d ``` -------------------------------- ### Run DumbTerm with Docker Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md This command pulls the latest DumbTerm Docker image and runs it in a container. It maps port 3000, mounts local `./data` and `./config` directories for persistence, and sets various environment variables for configuration such as PIN protection, site title, and timezone. ```bash # Pull and run with one command docker run -p 3000:3000 \ -v ./data:/root/data \ -v ./config:/root/.config \ -e DUMBTERM_PIN=1234 \ -e SITE_TITLE=DumbTerm \ -e BASE_URL=http://localhost:3000 \ -e ALLOWED_ORIGINS=http://localhost:3000 \ -e ENABLE_STARSHIP=true \ -e TZ=America/Los_Angeles \ -e LOCKOUT_TIME=15 \ -e MAX_SESSION_AGE=24 \ dumbwareio/dumbterm:latest ``` -------------------------------- ### DumbTerm Environment Variables Reference Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md A comprehensive reference table of all environment variables available for configuring the DumbTerm application. This includes settings for the server, security, appearance, and behavior, along with their default values and whether they are required. ```APIDOC | Variable | Description | Default | Required | |---------------------|-------------------------------------------------------------|------------------------|----------| | PORT | Server port | 3000 | No | | BASE_URL | Base URL for the application | http://localhost:PORT | No | | DUMBTERM_PIN | PIN protection (numeric) | None | No | | SITE_TITLE | Site title displayed in header | DumbTerm | No | | TZ | Container timezone | America/Los_Angeles | No | | ENABLE_STARSHIP | Enable Starship prompt (docker only) | true | No | | NODE_ENV | Node environment mode (development or production) | production | No | | ALLOWED_ORIGINS | Allowed CORS origins (comma-separated list) | * (all origins) | No | | DEBUG | Enable debug logging | FALSE | No | | LOCKOUT_TIME | Custom Pin Lockout Time (in minutes) | 15 | No | | MAX_SESSION_AGE | Duration of authenticated session (in hours) | 24 | No | | DEMO_MODE | Enable demo mode with simulated terminal | false | No | ``` -------------------------------- ### DumbTerm Technical Stack Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md This document outlines the core technologies used in the DumbTerm project. The backend is built with Node.js and Express, the frontend utilizes XTerm.js for terminal emulation, and Docker is used for containerization. ```APIDOC * Backend: Node.js (>=20.0.0) with Express * Frontend: XTerm.js for terminal emulation * Container: Docker with Debian Bullseye base * Terminal: node-pty for process spawning * Communication: WebSockets for real-time terminal I/O * Security: cors for cross-origin requests ``` -------------------------------- ### Initialize Web Theme in JavaScript to Prevent Flicker Source: https://github.com/dumbwareio/dumbterm/blob/main/public/login.html This JavaScript IIFE (Immediately Invoked Function Expression) sets the application's theme upon page load. It first checks `localStorage` for a saved theme; if none is found, it defaults to the user's system preference via `prefers-color-scheme`. This immediate execution helps prevent the common 'theme flicker' issue where a default theme is shown briefly before the correct one is applied. ```javascript (function() { // Initialize theme immediately - Prevents theme flicker let theme = localStorage.getItem('theme'); if (!theme) { theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; localStorage.setItem('theme', theme); } document.documentElement.setAttribute('data-theme', theme); })(); ``` -------------------------------- ### DumbTerm Project Dependencies Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md A list of the primary Node.js package dependencies for the DumbTerm project. These packages provide the core functionality for the web framework, terminal process management, session handling, and security. ```APIDOC * express: Web framework * node-pty: Terminal process spawning * xterm: Terminal frontend * ws: WebSocket server * cookie-parser: Cookie handling * express-session: Session management * cors: security for cross-origin requests ``` -------------------------------- ### Initialize Web Theme in JavaScript to Prevent Flicker Source: https://github.com/dumbwareio/dumbterm/blob/main/public/index.html This JavaScript Immediately Invoked Function Expression (IIFE) runs on page load to set the visual theme. It checks localStorage for a saved theme and falls back to the user's system preference if none is found, preventing a flash of the default theme before the correct one is applied. ```javascript (function() { // Initialize theme immediately - Prevents theme flicker let theme = localStorage.getItem('theme'); if (!theme) { theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; localStorage.setItem('theme', theme); } document.documentElement.setAttribute('data-theme', theme); })(); ``` -------------------------------- ### Supported XTerm.js Addons in DumbTerm Source: https://github.com/dumbwareio/dumbterm/blob/main/README.md DumbTerm integrates several XTerm.js addons to enhance terminal functionality. This list details the included addons for features like clipboard support, image display, search, and rendering performance improvements. ```APIDOC @xterm/addon-attach: Attaches a terminal session to a websocket @xterm/addon-canvas: Renderer that uses canvas to draw terminal content (used as fallback after webgl) @xterm/addon-clipboard: Clipboard integration for copy/paste support @xterm/addon-fit: Automatically resize terminal to fit its container @xterm/addon-image: Display images inline in the terminal @xterm/addon-ligatures: Font ligatures support @xterm/addon-search: Search text in the terminal buffer @xterm/addon-serialize: Serialize terminal output to string or HTML @xterm/addon-unicode11: Additional Unicode 11 character width support @xterm/addon-web-links: Automatically hyperlink URLs in terminal @xterm/addon-webgl: Renderer that uses WebGL for better performance (default render method) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.