mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
redirect to gemini:// on scheme not provided
This commit is contained in:
parent
09542c5134
commit
a064778d68
@ -54,7 +54,6 @@ Page::~Page()
|
||||
|
||||
void Page::update()
|
||||
{
|
||||
// Route by request scheme
|
||||
if ("file" == navbar->get_request_scheme())
|
||||
{
|
||||
// @TODO
|
||||
@ -115,8 +114,36 @@ void Page::update()
|
||||
);
|
||||
}
|
||||
|
||||
// Scheme not found but host provided, redirect to gemini://
|
||||
else if (!navbar->get_request_host().empty())
|
||||
{
|
||||
std::string request = "gemini://";
|
||||
|
||||
request += navbar->get_request_host(); // @TODO validate
|
||||
|
||||
if (!navbar->get_request_port().empty())
|
||||
{
|
||||
request += std::stoi(
|
||||
navbar->get_request_port()
|
||||
);
|
||||
}
|
||||
|
||||
request += navbar->get_request_path();
|
||||
|
||||
if (!navbar->get_request_query().empty())
|
||||
{
|
||||
request += "?" + navbar->get_request_query();
|
||||
}
|
||||
|
||||
navbar->set_request(
|
||||
request
|
||||
);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// @TODO
|
||||
// @TODO search request
|
||||
}
|
||||
}
|
@ -99,7 +99,18 @@ void Navbar::refresh()
|
||||
);
|
||||
}
|
||||
|
||||
// Public getters
|
||||
// Setters
|
||||
void Navbar::set_request(
|
||||
const std::string value
|
||||
) {
|
||||
request->set_text(
|
||||
value
|
||||
);
|
||||
|
||||
// refresh(); not wanted as on change listener do same @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
Glib::ustring Navbar::get_request()
|
||||
{
|
||||
return request->get_text();
|
||||
|
@ -42,6 +42,11 @@ namespace app::browser::main::tab::page
|
||||
// Actions
|
||||
void refresh();
|
||||
|
||||
// Setters
|
||||
void set_request(
|
||||
const std::string value
|
||||
);
|
||||
|
||||
// Getters
|
||||
Glib::ustring get_request();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user