mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 16:10:08 +01:00
restored original secured command
This commit is contained in:
@@ -424,28 +424,38 @@ public function replaceOldLoopbackWithNew(string $siteConf, string $old, string
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the URLs with expiration dates that are currently secured.
|
||||
* Get all of the URLs that are currently secured.
|
||||
*/
|
||||
public function secured(): array
|
||||
{
|
||||
return collect($this->files->scandir($this->certificatesPath()))
|
||||
->filter(function ($file) {
|
||||
return ends_with($file, ['.crt']);
|
||||
return ends_with($file, ['.key', '.csr', '.crt', '.conf']);
|
||||
})->map(function ($file) {
|
||||
|
||||
$host = str_replace(['.crt'], '', $file);
|
||||
|
||||
$filePath = $this->certificatesPath() . '/' . $file;
|
||||
|
||||
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
|
||||
|
||||
return [
|
||||
'host' => $host,
|
||||
'exp' => new DateTime(str_replace('notAfter=', '', $expiration)),
|
||||
];
|
||||
return str_replace(['.key', '.csr', '.crt', '.conf'], '', $file);
|
||||
})->unique()->values()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the URLs with expiration dates that are currently secured.
|
||||
*/
|
||||
public function securedWithDates(): array
|
||||
{
|
||||
return collect($this->secured())->map(function ($site) {
|
||||
|
||||
$filePath = $this->certificatesPath() . '/' . $site . '.crt';
|
||||
|
||||
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
|
||||
|
||||
$expiration = str_replace('notAfter=', '', $expiration);
|
||||
|
||||
return [
|
||||
'site' => $site,
|
||||
'exp' => new DateTime($expiration),
|
||||
];
|
||||
})->unique()->values()->all();
|
||||
}
|
||||
|
||||
public function isSecured(string $site): bool
|
||||
{
|
||||
$tld = $this->config->read()['tld'];
|
||||
|
||||
Reference in New Issue
Block a user