No description
Find a file
m1ngsama 6baa6517ca feat: Implement functional web browsing with HTTP + HTML rendering
Implemented the missing browser engine functionality to make TUT actually
browse the web.

Browser Engine Changes:
- Integrate HttpClient to fetch URLs via GET requests
- Integrate HtmlRenderer to parse and render HTML content
- Implement proper error handling for failed HTTP requests
- Add relative URL resolution for links (absolute and relative paths)
- Store title, content, and links from rendered pages

Tested with https://tldp.org/HOWTO/HOWTO-INDEX/howtos.html:
 Successfully fetches and displays web pages
 Renders HTML with proper formatting (headings, lists, links)
 Extracts and numbers clickable links
 Displays page titles

The browser is now fully functional for basic text-based web browsing!
2025-12-31 17:19:01 +08:00
.github/workflows ci: Update CI/CD for FTXUI architecture 2025-12-29 22:17:37 +08:00
assets feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
cmake feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
src feat: Implement functional web browsing with HTTP + HTML rendering 2025-12-31 17:19:01 +08:00
tests refactor: Clean up old v1 files and fix LinkInfo type issues 2025-12-31 17:04:10 +08:00
.gitignore feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
CMakeLists.txt feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
LICENSE feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
README.md refactor: Clean up old v1 files and fix LinkInfo type issues 2025-12-31 17:04:10 +08:00

TUT - Terminal UI Textual Browser

A lightweight, high-performance terminal browser with a btop-style interface.

Version License C++

Features

  • btop-style UI - Modern four-panel layout with rounded borders
  • Lightweight - Binary size < 1MB, memory usage < 50MB
  • Fast startup - Launch in < 500ms
  • Vim-style navigation - j/k scrolling, / search, g/G jump
  • Keyboard-driven - Full keyboard navigation with function key shortcuts
  • Themeable - Multiple color themes (default, nord, gruvbox, solarized)
  • Configurable - TOML-based configuration

Screenshot

╭──────────────────────────────────────────────────────────────────────────────╮
│[◀] [▶] [⟳] ╭────────────────────────────────────────────────────────╮ [⚙] [?]│
│           │https://example.com                                      │        │
│           ╰────────────────────────────────────────────────────────╯        │
├──────────────────────────────────────────────────────────────────────────────┤
│                          Example Domain                                      │
├──────────────────────────────────────────────────────────────────────────────┤
│This domain is for use in illustrative examples in documents.                 │
│                                                                              │
│[1] More information...                                                       │
│                                                                              │
├────────────────────────────────────────┬─────────────────────────────────────┤
│📑 Bookmarks                            │📊 Status                            │
│  example.com                           │  ⬇ 1.2 KB  🕐 0.3s                  │
├────────────────────────────────────────┴─────────────────────────────────────┤
│[F1]Help [F2]Bookmarks [F3]History [F10]Quit                                  │
╰──────────────────────────────────────────────────────────────────────────────╯

Installation

Prerequisites

macOS (Homebrew):

brew install cmake gumbo-parser openssl ftxui cpp-httplib toml11

Linux (Debian/Ubuntu):

sudo apt install cmake libgumbo-dev libssl-dev

Building from Source

git clone https://github.com/m1ngsama/TUT.git
cd TUT
cmake -B build -DCMAKE_PREFIX_PATH=/opt/homebrew  # macOS
cmake -B build                                      # Linux
cmake --build build -j$(nproc)

Running

./build/tut                      # Start with blank page
./build/tut https://example.com  # Open URL directly
./build/tut --help               # Show help

Keyboard Shortcuts

Navigation

Key Action
j / Scroll down
k / Scroll up
Space Page down
b Page up
g Go to top
G Go to bottom
Backspace Go back
Key Action
Tab Next link
Shift+Tab Previous link
Enter Follow link
1-9 Jump to link by number
Key Action
/ Start search
n Next result
N Previous result

UI

Key Action
Ctrl+L Focus address bar
F1 / ? Help
F2 Bookmarks
F3 History
Ctrl+D Add bookmark
Ctrl+Q / F10 / q Quit

Configuration

Configuration files are stored in ~/.config/tut/:

~/.config/tut/
├── config.toml      # Main configuration
└── themes/          # Custom themes
    └── mytheme.toml

Example config.toml

[general]
theme = "default"
homepage = "https://example.com"
debug = false

[browser]
timeout = 30
user_agent = "TUT/0.1.0"

[ui]
word_wrap = true
show_images = true

Project Structure

TUT/
├── CMakeLists.txt          # Build configuration
├── README.md               # This file
├── LICENSE                 # MIT License
├── cmake/                  # CMake modules
│   └── version.hpp.in
├── src/                    # Source code
│   ├── main.cpp           # Entry point
│   ├── core/              # Browser engine, HTTP, URL parsing
│   ├── ui/                # FTXUI components
│   ├── renderer/          # HTML rendering
│   └── utils/             # Logger, config, themes
├── tests/                  # Unit and integration tests
│   ├── unit/
│   └── integration/
└── assets/                 # Default configurations
    ├── config.toml
    ├── themes/
    └── keybindings/

Dependencies

Library Purpose Version
FTXUI Terminal UI framework 5.0+
cpp-httplib HTTP client 0.14+
gumbo-parser HTML parsing 0.10+
toml11 TOML configuration 3.8+
OpenSSL HTTPS support 1.1+

Limitations

  • No JavaScript - SPAs and dynamic content won't work
  • No CSS layout - Only basic text formatting
  • No images - ASCII art rendering planned for future
  • Text-only - Focused on readable content

Contributing

Contributions are welcome! Please read the coding style guidelines:

  • C++17 standard
  • Google C++ Style Guide
  • Use .hpp for headers, .cpp for implementation
  • All public APIs must have documentation comments

License

MIT License - see LICENSE file for details.

Authors

Acknowledgments

  • Inspired by btop for UI design
  • FTXUI for the amazing TUI framework
  • lynx and w3m for inspiration