aboutsummaryrefslogtreecommitdiff
path: root/ricochet/src/core/browser.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-13 04:34:50 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-13 04:34:50 +0800
commit2141017d7c688a0f6659c3ffe5730f281f7551ae (patch)
treef8a586c0dae38f3291a9580e9b24d73204b4f109 /ricochet/src/core/browser.cc
parentc495d71d413da0db8be510e290787fd576835842 (diff)
downloadrcc-project-2141017d7c688a0f6659c3ffe5730f281f7551ae.tar.gz
rcc-project-2141017d7c688a0f6659c3ffe5730f281f7551ae.tar.xz
feat: implement configurable homepage and user-agent via config.txt
Diffstat (limited to 'ricochet/src/core/browser.cc')
-rw-r--r--ricochet/src/core/browser.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/ricochet/src/core/browser.cc b/ricochet/src/core/browser.cc
index dd96c7c..571783a 100644
--- a/ricochet/src/core/browser.cc
+++ b/ricochet/src/core/browser.cc
@@ -1003,6 +1003,21 @@ std::vector<std::string> wrap_lines( const std::vector<std::string>& 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<HttpRequest> history;