diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-13 04:50:49 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-13 04:50:49 +0800 |
| commit | e84e117735f7d922f84cd13f56f6eea93b204e5c (patch) | |
| tree | cb0b48b068f2933325b5b2964cba20daee5eec7d /ricochet/src/main.cc | |
| parent | 2141017d7c688a0f6659c3ffe5730f281f7551ae (diff) | |
| download | rcc-project-e84e117735f7d922f84cd13f56f6eea93b204e5c.tar.gz rcc-project-e84e117735f7d922f84cd13f56f6eea93b204e5c.tar.xz | |
feat: move URL formatting to Browser class and update documentation
Diffstat (limited to 'ricochet/src/main.cc')
| -rw-r--r-- | ricochet/src/main.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/ricochet/src/main.cc b/ricochet/src/main.cc index 562861a..d27ab55 100644 --- a/ricochet/src/main.cc +++ b/ricochet/src/main.cc @@ -16,7 +16,6 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <fstream> #include <iostream> #include <span> #include <string_view> @@ -42,13 +41,6 @@ int main( int argc, char* argv[] ) ricochet::core::print_license_notice(); - std::string start_url; - if ( args.size() < 2 ) { - start_url = ricochet::core::Browser::get_configured_homepage(); - } else { - start_url = std::string( args[1] ); - } - if ( args.size() >= 2 && args[1] == "show" ) { if ( args.size() >= 3 && args[2] == "w" ) { ricochet::core::show_warranty(); @@ -63,10 +55,15 @@ int main( int argc, char* argv[] ) return 1; } - if ( !start_url.starts_with( "http://" ) && !start_url.starts_with( "https://" ) ) { - start_url.insert( 0, "https://" ); + std::string start_url; + if ( args.size() < 2 ) { + start_url = ricochet::core::Browser::get_configured_homepage(); + } else { + start_url = std::string( args[1] ); } + start_url = ricochet::core::Browser::format_url( std::move( start_url ) ); + try { return ricochet::core::Browser::run( start_url ); } catch ( const std::exception& e ) { |
