Built-in File Manager (#458)

This commit is contained in:
Saeed Vaziry
2025-02-16 19:56:21 +01:00
committed by GitHub
parent 75e554ad74
commit e2b9d18a71
17 changed files with 907 additions and 29 deletions

View File

@ -5,6 +5,7 @@
use App\Actions\Server\CheckConnection;
use App\Enums\ServerStatus;
use App\Enums\ServiceStatus;
use App\Exceptions\SSHError;
use App\Facades\SSH;
use App\ServerTypes\ServerType;
use App\SSH\Cron\Cron;
@ -22,6 +23,7 @@
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Throwable;
/**
* @property int $project_id
@ -146,7 +148,7 @@ public static function boot(): void
}
$server->provider()->delete();
DB::commit();
} catch (\Throwable $e) {
} catch (Throwable $e) {
DB::rollBack();
throw $e;
}
@ -465,6 +467,9 @@ public function cron(): Cron
return new Cron($this);
}
/**
* @throws SSHError
*/
public function checkForUpdates(): void
{
$this->updates = $this->os()->availableUpdates();
@ -480,4 +485,15 @@ public function getAvailableUpdatesAttribute(?int $value): int
return $value;
}
/**
* @throws Throwable
*/
public function download(string $path, string $disk = 'tmp'): void
{
$this->ssh()->download(
Storage::disk($disk)->path(basename($path)),
$path
);
}
}