diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
index 18132c670..b1df8679e 100644
--- a/app/Livewire/Settings/Index.php
+++ b/app/Livewire/Settings/Index.php
@@ -2,6 +2,7 @@
namespace App\Livewire\Settings;
+use App\Jobs\CheckForUpdatesJob;
use App\Models\InstanceSettings;
use App\Models\Server;
use Cron\CronExpression;
@@ -182,6 +183,18 @@ public function updatedUpdateCheckFrequency()
}
}
+ public function checkManually()
+ {
+ CheckForUpdatesJob::dispatchSync();
+ $this->dispatch('updateAvailable');
+ $settings = InstanceSettings::get();
+ if ($settings->new_version_available) {
+ $this->dispatch('success', 'New version available!');
+ } else {
+ $this->dispatch('success', 'No new version available.');
+ }
+ }
+
public function render()
{
return view('livewire.settings.index');
diff --git a/app/Livewire/Upgrade.php b/app/Livewire/Upgrade.php
index 7ad7e9523..f001cd5bf 100644
--- a/app/Livewire/Upgrade.php
+++ b/app/Livewire/Upgrade.php
@@ -3,6 +3,7 @@
namespace App\Livewire;
use App\Actions\Server\UpdateCoolify;
+use App\Models\InstanceSettings;
use Livewire\Component;
class Upgrade extends Component
@@ -15,14 +16,17 @@ class Upgrade extends Component
public string $latestVersion = '';
+ protected $listeners = ['updateAvailable' => 'checkUpdate'];
+
public function checkUpdate()
{
- $this->latestVersion = get_latest_version_of_coolify();
- $currentVersion = config('version');
- version_compare($currentVersion, $this->latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
- if (isDev()) {
- $this->isUpgradeAvailable = true;
+ try {
+ $settings = InstanceSettings::get();
+ $this->isUpgradeAvailable = $settings->new_version_available;
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
}
+
}
public function upgrade()
diff --git a/database/migrations/2024_08_05_142659_add_update_frequency_settings.php b/database/migrations/2024_08_05_142659_add_update_frequency_settings.php
index b24842dcd..ad680fc03 100644
--- a/database/migrations/2024_08_05_142659_add_update_frequency_settings.php
+++ b/database/migrations/2024_08_05_142659_add_update_frequency_settings.php
@@ -13,7 +13,7 @@ public function up(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->string('auto_update_frequency')->default('0 0 * * *')->nullable();
- $table->string('update_check_frequency')->default('0 */11 * * *')->nullable();
+ $table->string('update_check_frequency')->default('0 * * * *')->nullable();
$table->boolean('new_version_available')->default(false);
});
}
diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php
index df0d09963..212e055c5 100644
--- a/resources/views/livewire/settings/index.blade.php
+++ b/resources/views/livewire/settings/index.blade.php
@@ -18,8 +18,8 @@