2023-04-14 08:00:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
|
|
|
|
use App\Models\Server;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class CheckUpdate extends Component
|
|
|
|
{
|
|
|
|
public $updateAvailable = false;
|
2023-04-27 11:02:24 +00:00
|
|
|
public $latestVersion = 'latest';
|
2023-04-14 08:00:42 +00:00
|
|
|
protected $currentVersion;
|
|
|
|
protected $image = 'ghcr.io/coollabsio/coolify';
|
|
|
|
|
|
|
|
public function checkUpdate()
|
|
|
|
{
|
2023-04-28 13:22:36 +00:00
|
|
|
$this->latestVersion = getLatestVersionOfCoolify();
|
2023-05-09 12:46:22 +00:00
|
|
|
$this->currentVersion = config('version');
|
2023-04-27 11:02:24 +00:00
|
|
|
if ($this->latestVersion === 'latest') {
|
|
|
|
$this->updateAvailable = true;
|
|
|
|
return;
|
|
|
|
}
|
2023-04-14 08:00:42 +00:00
|
|
|
version_compare($this->currentVersion, $this->latestVersion, '<') ? $this->updateAvailable = true : $this->updateAvailable = false;
|
|
|
|
}
|
|
|
|
}
|