mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
render page on connection completed only
This commit is contained in:
parent
d843f97355
commit
f05db4b291
1 changed files with 43 additions and 43 deletions
|
|
@ -181,52 +181,52 @@ class Page
|
||||||
return false; // stop
|
return false; // stop
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update title
|
|
||||||
$this->title->set(
|
|
||||||
$connection->getTitle(),
|
|
||||||
$connection->getSubtitle(),
|
|
||||||
$connection->getTooltip()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Update content
|
|
||||||
switch ($connection->getMime())
|
|
||||||
{
|
|
||||||
case 'text/gemini':
|
|
||||||
|
|
||||||
$title = null;
|
|
||||||
|
|
||||||
$this->content->setGemtext(
|
|
||||||
(string) $connection->getData(),
|
|
||||||
$title
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($title)
|
|
||||||
{
|
|
||||||
$this->title->setValue(
|
|
||||||
$title
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'text/plain':
|
|
||||||
|
|
||||||
$this->content->setPlain(
|
|
||||||
(string) $connection->getData()
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
throw new \Exception(
|
|
||||||
_('MIME type not supported')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop event loop on request completed
|
// Stop event loop on request completed
|
||||||
if ($connection->isCompleted())
|
if ($connection->isCompleted())
|
||||||
{
|
{
|
||||||
|
// Update title
|
||||||
|
$this->title->set(
|
||||||
|
$connection->getTitle(),
|
||||||
|
$connection->getSubtitle(),
|
||||||
|
$connection->getTooltip()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update content
|
||||||
|
switch ($connection->getMime())
|
||||||
|
{
|
||||||
|
case 'text/gemini':
|
||||||
|
|
||||||
|
$title = null;
|
||||||
|
|
||||||
|
$this->content->setGemtext(
|
||||||
|
(string) $connection->getData(),
|
||||||
|
$title
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($title)
|
||||||
|
{
|
||||||
|
$this->title->setValue(
|
||||||
|
$title
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'text/plain':
|
||||||
|
|
||||||
|
$this->content->setPlain(
|
||||||
|
(string) $connection->getData()
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
throw new \Exception(
|
||||||
|
_('MIME type not supported')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Hide progressbar
|
// Hide progressbar
|
||||||
$this->progressbar->hide();
|
$this->progressbar->hide();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue