mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
update API for status code 10
This commit is contained in:
parent
d4bfcaef08
commit
48621156bf
2 changed files with 20 additions and 4 deletions
|
|
@ -185,14 +185,15 @@ class Content
|
||||||
$request->getResponse()
|
$request->getResponse()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Process codes
|
// Route status codes
|
||||||
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-codes
|
||||||
switch ($response->getCode())
|
switch ($response->getCode())
|
||||||
{
|
{
|
||||||
case 10: // response expected
|
case 10: // response expected
|
||||||
|
|
||||||
$this->page->title->setValue(
|
$this->page->title->setValue(
|
||||||
$address->getHost(),
|
$address->getHost(),
|
||||||
sprintf(
|
$response->getMeta() ? $response->getMeta() : sprintf(
|
||||||
'response expected (code %d)',
|
'response expected (code %d)',
|
||||||
intval(
|
intval(
|
||||||
$response->getCode()
|
$response->getCode()
|
||||||
|
|
@ -200,7 +201,9 @@ class Content
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->page->response->show();
|
$this->page->response->show(
|
||||||
|
$response->getMeta() // pass to placeholder
|
||||||
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,26 @@ class Response
|
||||||
$this->hide();
|
$this->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(): void
|
public function show(
|
||||||
|
?string $placeholder = null
|
||||||
|
): void
|
||||||
{
|
{
|
||||||
|
if ($placeholder)
|
||||||
|
{
|
||||||
|
$this->query->setPlaceholder(
|
||||||
|
$placeholder
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->gtk->show();
|
$this->gtk->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hide(): void
|
public function hide(): void
|
||||||
{
|
{
|
||||||
|
$this->query->setPlaceholder(
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
$this->gtk->hide();
|
$this->gtk->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue