From 8449f5fcefc5406f1666257bacb3bb1afda978e1 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Mon, 13 Apr 2026 04:34:50 +0800 Subject: feat: implement configurable homepage and user-agent via config.txt --- src/core/browser.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/browser.cc') diff --git a/src/core/browser.cc b/src/core/browser.cc index dd96c7c..571783a 100644 --- a/src/core/browser.cc +++ b/src/core/browser.cc @@ -1003,6 +1003,21 @@ std::vector wrap_lines( const std::vector& original_li } // namespace +std::string Browser::get_configured_homepage() +{ + std::ifstream file( get_config_path( "config.txt" ) ); + if ( file.is_open() ) { + std::string line; + while ( std::getline( file, line ) ) { + const std::size_t eq = line.find( '=' ); + if ( eq != std::string::npos && line.substr( 0, eq ) == "homepage" ) { + return line.substr( eq + 1 ); + } + } + } + return "https://wikipedia.org"; +} + int Browser::run( std::string_view initial_url ) { std::vector history; -- cgit v1.2.3