Add S3 and Wasabi as storage providers (#281)

This commit is contained in:
Taki Elias
2024-09-07 03:29:43 +06:00
committed by GitHub
parent 1391eb32d8
commit e39e8c17a2
24 changed files with 1055 additions and 130 deletions

View File

@ -1,3 +1,14 @@
@use(App\Enums\StorageProvider)
@php
$storageProviders = [
StorageProvider::DROPBOX,
StorageProvider::FTP,
StorageProvider::LOCAL,
StorageProvider::S3,
StorageProvider::WASABI,
];
@endphp
<div>
<x-primary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'connect-provider')">
{{ __("Connect") }}
@ -69,136 +80,8 @@ class="p-6"
@enderror
</div>
@if ($provider == \App\Enums\StorageProvider::DROPBOX)
<div class="mt-6">
<x-input-label for="token" value="API Key" />
<x-text-input value="{{ old('token') }}" id="token" name="token" type="text" class="mt-1 w-full" />
@error("token")
<x-input-error class="mt-2" :messages="$message" />
@enderror
<a
class="mt-1 text-primary-500"
href="https://dropbox.tech/developers/generate-an-access-token-for-your-own-account"
target="_blank"
>
How to generate?
</a>
</div>
@endif
@if ($provider == \App\Enums\StorageProvider::FTP)
<div class="mt-6">
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="host" value="Host" />
<x-text-input
value="{{ old('host') }}"
id="host"
name="host"
type="text"
class="mt-1 w-full"
/>
@error("host")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="port" value="Port" />
<x-text-input
value="{{ old('port') }}"
id="port"
name="port"
type="text"
class="mt-1 w-full"
/>
@error("port")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="mt-6">
<x-input-label for="path" value="Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="username" value="Username" />
<x-text-input
value="{{ old('username') }}"
id="username"
name="username"
type="text"
class="mt-1 w-full"
/>
@error("username")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="password" value="Password" />
<x-text-input
value="{{ old('password') }}"
id="password"
name="password"
type="text"
class="mt-1 w-full"
/>
@error("password")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="ssl" :value="__('SSL')" />
<x-select-input id="ssl" name="ssl" class="mt-1 w-full">
<option value="1" @if(old('ssl')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('ssl')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("ssl")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="passive" :value="__('Passive')" />
<x-select-input id="passive" name="passive" class="mt-1 w-full">
<option value="1" @if(old('passive')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('passive')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("passive")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
</div>
@endif
@if ($provider == \App\Enums\StorageProvider::LOCAL)
<div class="mt-6">
<x-input-label for="path" value="Absolute Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
<x-input-help>
The absolute path on your server that the database exists. like `/home/vito/db-backups`
</x-input-help>
<x-input-help>
Make sure that the path exists and the `vito` user has permission to write to it.
</x-input-help>
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
@if (in_array($provider, $storageProviders))
@include("settings.storage-providers.providers.{$provider}")
@endif
<div class="mt-6">

View File

@ -0,0 +1,15 @@
<div class="mt-6">
<x-input-label for="token" value="API Key" />
<x-text-input value="{{ old('token') }}" id="token" name="token" type="text" class="mt-1 w-full" />
@error("token")
<x-input-error class="mt-2" :messages="$message" />
@enderror
<a
class="mt-1 text-primary-500"
href="https://dropbox.tech/developers/generate-an-access-token-for-your-own-account"
target="_blank"
>
How to generate?
</a>
</div>

View File

@ -0,0 +1,71 @@
<div class="mt-6">
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="host" value="Host" />
<x-text-input value="{{ old('host') }}" id="host" name="host" type="text" class="mt-1 w-full" />
@error("host")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="port" value="Port" />
<x-text-input value="{{ old('port') }}" id="port" name="port" type="text" class="mt-1 w-full" />
@error("port")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="mt-6">
<x-input-label for="path" value="Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="username" value="Username" />
<x-text-input value="{{ old('username') }}" id="username" name="username" type="text" class="mt-1 w-full" />
@error("username")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="password" value="Password" />
<x-text-input value="{{ old('password') }}" id="password" name="password" type="text" class="mt-1 w-full" />
@error("password")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="ssl" :value="__('SSL')" />
<x-select-input id="ssl" name="ssl" class="mt-1 w-full">
<option value="1" @if(old('ssl')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('ssl')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("ssl")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="passive" :value="__('Passive')" />
<x-select-input id="passive" name="passive" class="mt-1 w-full">
<option value="1" @if(old('passive')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('passive')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("passive")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
<div class="mt-6">
<x-input-label for="path" value="Absolute Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
<x-input-help>The absolute path on your server that the database exists. like `/home/vito/db-backups`</x-input-help>
<x-input-help>Make sure that the path exists and the `vito` user has permission to write to it.</x-input-help>
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>

View File

@ -0,0 +1,49 @@
<div class="mt-6">
<div class="mt-6">
<x-input-label for="path" value="Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="key" value="Key" />
<x-text-input value="{{ old('key') }}" id="key" name="key" type="text" class="mt-1 w-full" />
@error("key")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="secret" value="Secret" />
<x-text-input value="{{ old('secret') }}" id="secret" name="secret" type="text" class="mt-1 w-full" />
@error("secret")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<a
class="mt-1 text-primary-500"
href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/configuring-bucket-key.html"
target="_blank"
>
How to generate?
</a>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="region" value="Region" />
<x-text-input value="{{ old('region') }}" id="region" name="region" type="text" class="mt-1 w-full" />
@error("region")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="bucket" value="Bucket" />
<x-text-input value="{{ old('bucket') }}" id="bucket" name="bucket" type="text" class="mt-1 w-full" />
@error("bucket")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
</div>

View File

@ -0,0 +1,49 @@
<div class="mt-6">
<div class="mt-6">
<x-input-label for="path" value="Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="key" value="Key" />
<x-text-input value="{{ old('key') }}" id="key" name="key" type="text" class="mt-1 w-full" />
@error("key")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="secret" value="Secret" />
<x-text-input value="{{ old('secret') }}" id="secret" name="secret" type="text" class="mt-1 w-full" />
@error("secret")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<a
class="mt-1 text-primary-500"
href="https://docs.wasabi.com/docs/creating-a-user-account-and-access-key"
target="_blank"
>
How to generate?
</a>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="region" value="Region" />
<x-text-input value="{{ old('region') }}" id="region" name="region" type="text" class="mt-1 w-full" />
@error("region")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="bucket" value="Bucket" />
<x-text-input value="{{ old('bucket') }}" id="bucket" name="bucket" type="text" class="mt-1 w-full" />
@error("bucket")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
</div>