mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 18:31:36 +00:00
* Allow editing of backups * pint updates * setup of backup download * allow download for local backup files * delete uploaded files on delete of BackupFile * pint updates * S3 upload & download fixes * Deletion of backup files * support $ARCH selector for s3 installation * delete files when deleting backup * fixed ui issue * adjustment * Use system temp path for downloads --------- Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
42 lines
900 B
PHP
42 lines
900 B
PHP
<?php
|
|
|
|
namespace App\StorageProviders;
|
|
|
|
use App\Models\Server;
|
|
use App\SSH\Storage\Storage;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class Dropbox extends AbstractStorageProvider
|
|
{
|
|
protected string $apiUrl = 'https://api.dropboxapi.com/2';
|
|
|
|
public function validationRules(): array
|
|
{
|
|
return [
|
|
'token' => 'required',
|
|
];
|
|
}
|
|
|
|
public function credentialData(array $input): array
|
|
{
|
|
return [
|
|
'token' => $input['token'],
|
|
];
|
|
}
|
|
|
|
public function connect(): bool
|
|
{
|
|
$res = Http::withToken($this->storageProvider->credentials['token'])
|
|
->post($this->apiUrl.'/check/user', [
|
|
'query' => '',
|
|
]);
|
|
|
|
return $res->successful();
|
|
}
|
|
|
|
public function ssh(Server $server): Storage
|
|
{
|
|
return new \App\SSH\Storage\Dropbox($server, $this->storageProvider);
|
|
}
|
|
}
|