mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update response route by mime type
This commit is contained in:
parent
a478e31bd5
commit
ebadc548c0
1 changed files with 39 additions and 32 deletions
|
|
@ -370,33 +370,21 @@ void Page::navigation_reload(
|
|||
action__update->activate();
|
||||
|
||||
// Parse meta
|
||||
Socket::Client::Gemini::Response::Status status;
|
||||
|
||||
Socket::Client::Gemini::Response::Status status; // @TODO make page global?
|
||||
Socket::Client::Gemini::Response::Match::meta(
|
||||
buffer,
|
||||
status,
|
||||
mime
|
||||
);
|
||||
|
||||
// Try detect mime by file extension on still undefined @TODO
|
||||
// MIME type not detected
|
||||
if (mime == MIME::UNDEFINED)
|
||||
{
|
||||
// Try detect by file extension
|
||||
if (Glib::str_has_suffix(g_uri_get_path(uri), ".gmi"))
|
||||
{
|
||||
mime = MIME::TEXT_GEMINI;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Update
|
||||
title = _("Oops");
|
||||
|
||||
description = _("MIME type not supported");
|
||||
|
||||
progress_fraction = 1;
|
||||
|
||||
action__update->activate();
|
||||
}
|
||||
}
|
||||
|
||||
// Route by status code
|
||||
|
|
@ -404,12 +392,10 @@ void Page::navigation_reload(
|
|||
{
|
||||
case Socket::Client::Gemini::Response::Status::SUCCESS:
|
||||
|
||||
// Update
|
||||
title = _("Done"); // @TODO page title
|
||||
|
||||
description = g_uri_get_host(
|
||||
uri
|
||||
);
|
||||
// Route by MIME
|
||||
switch (mime)
|
||||
{
|
||||
case MIME::TEXT_GEMINI:
|
||||
|
||||
progress_fraction = 1;
|
||||
|
||||
|
|
@ -430,6 +416,27 @@ void Page::navigation_reload(
|
|||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// Update
|
||||
title = _("Oops");
|
||||
|
||||
description = _("MIME type not supported");
|
||||
|
||||
progress_fraction = 1;
|
||||
|
||||
action__update->activate();
|
||||
}
|
||||
|
||||
// Update
|
||||
title = _("Done"); // @TODO page title
|
||||
|
||||
description = g_uri_get_host(
|
||||
uri
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
// @TODO other statuses..
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue