mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
init gemini authorization codes 60-62 support
This commit is contained in:
parent
3949c9ee27
commit
49b21b38d0
3 changed files with 146 additions and 0 deletions
|
|
@ -63,6 +63,11 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
|
||||||
'request',
|
'request',
|
||||||
// 1 Mb default
|
// 1 Mb default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->_pool->init(
|
||||||
|
'auth',
|
||||||
|
1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCompleted(): bool
|
public function isCompleted(): bool
|
||||||
|
|
@ -223,6 +228,27 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAuth(): bool
|
||||||
|
{
|
||||||
|
return boolval(
|
||||||
|
$this->_pool->get(
|
||||||
|
'auth'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAuth(
|
||||||
|
bool $auth
|
||||||
|
): void
|
||||||
|
{
|
||||||
|
$this->_pool->set(
|
||||||
|
'auth',
|
||||||
|
strval(
|
||||||
|
$auth
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function getLength(): ?int
|
public function getLength(): ?int
|
||||||
{
|
{
|
||||||
if ($data = $this->_pool->get('data'))
|
if ($data = $this->_pool->get('data'))
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ interface Connection
|
||||||
|
|
||||||
public function unsetRequest(): void;
|
public function unsetRequest(): void;
|
||||||
|
|
||||||
|
public function getAuth(): bool;
|
||||||
|
|
||||||
|
public function setAuth(
|
||||||
|
bool $auth
|
||||||
|
): void;
|
||||||
|
|
||||||
public function getLength(): ?int;
|
public function getLength(): ?int;
|
||||||
|
|
||||||
public function getCache(
|
public function getCache(
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,120 @@ class Gemini
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 60: // authorization certificate required
|
||||||
|
|
||||||
|
$this->_connection->setAuth(
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTitle(
|
||||||
|
_('Authorization')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setSubtitle(
|
||||||
|
$address->getHost()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTooltip(
|
||||||
|
sprintf(
|
||||||
|
'Authorization required (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setData(
|
||||||
|
sprintf(
|
||||||
|
'Authorization required (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setMime(
|
||||||
|
Filesystem::MIME_TEXT_GEMINI
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 61: // certificate not authorized
|
||||||
|
|
||||||
|
$this->_connection->setAuth(
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTitle(
|
||||||
|
_('Oops!')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setSubtitle(
|
||||||
|
$address->getHost()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTooltip(
|
||||||
|
sprintf(
|
||||||
|
'Authorization certificate not authorized (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setData(
|
||||||
|
sprintf(
|
||||||
|
'Authorization certificate not authorized (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setMime(
|
||||||
|
Filesystem::MIME_TEXT_GEMINI
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 62: // certificate not valid
|
||||||
|
|
||||||
|
$this->_connection->setAuth(
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTitle(
|
||||||
|
_('Oops!')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setSubtitle(
|
||||||
|
$address->getHost()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setTooltip(
|
||||||
|
sprintf(
|
||||||
|
'Authorization certificate not valid (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setData(
|
||||||
|
sprintf(
|
||||||
|
'Authorization certificate not valid (code: %d)',
|
||||||
|
intval(
|
||||||
|
$response->getCode()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->_connection->setMime(
|
||||||
|
Filesystem::MIME_TEXT_GEMINI
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// Try cache
|
// Try cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue