mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-06 16:34:13 +00:00
update response route by mime type
This commit is contained in:
parent
a478e31bd5
commit
ebadc548c0
@ -370,33 +370,21 @@ void Page::navigation_reload(
|
|||||||
action__update->activate();
|
action__update->activate();
|
||||||
|
|
||||||
// Parse meta
|
// Parse meta
|
||||||
Socket::Client::Gemini::Response::Status status;
|
Socket::Client::Gemini::Response::Status status; // @TODO make page global?
|
||||||
|
|
||||||
Socket::Client::Gemini::Response::Match::meta(
|
Socket::Client::Gemini::Response::Match::meta(
|
||||||
buffer,
|
buffer,
|
||||||
status,
|
status,
|
||||||
mime
|
mime
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try detect mime by file extension on still undefined @TODO
|
// MIME type not detected
|
||||||
if (mime == MIME::UNDEFINED)
|
if (mime == MIME::UNDEFINED)
|
||||||
{
|
{
|
||||||
|
// Try detect by file extension
|
||||||
if (Glib::str_has_suffix(g_uri_get_path(uri), ".gmi"))
|
if (Glib::str_has_suffix(g_uri_get_path(uri), ".gmi"))
|
||||||
{
|
{
|
||||||
mime = MIME::TEXT_GEMINI;
|
mime = MIME::TEXT_GEMINI;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Update
|
|
||||||
title = _("Oops");
|
|
||||||
|
|
||||||
description = _("MIME type not supported");
|
|
||||||
|
|
||||||
progress_fraction = 1;
|
|
||||||
|
|
||||||
action__update->activate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Route by status code
|
// Route by status code
|
||||||
@ -404,12 +392,10 @@ void Page::navigation_reload(
|
|||||||
{
|
{
|
||||||
case Socket::Client::Gemini::Response::Status::SUCCESS:
|
case Socket::Client::Gemini::Response::Status::SUCCESS:
|
||||||
|
|
||||||
// Update
|
// Route by MIME
|
||||||
title = _("Done"); // @TODO page title
|
switch (mime)
|
||||||
|
{
|
||||||
description = g_uri_get_host(
|
case MIME::TEXT_GEMINI:
|
||||||
uri
|
|
||||||
);
|
|
||||||
|
|
||||||
progress_fraction = 1;
|
progress_fraction = 1;
|
||||||
|
|
||||||
@ -430,6 +416,27 @@ void Page::navigation_reload(
|
|||||||
|
|
||||||
break;
|
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..
|
// @TODO other statuses..
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user