@@ -15,4 +15,10 @@ final class WebDavOption
|
|||||||
|
|
||||||
/** @var string 密码 */
|
/** @var string 密码 */
|
||||||
const Password = 'password';
|
const Password = 'password';
|
||||||
|
|
||||||
|
/** @var string 认证方式 */
|
||||||
|
const AuthType = 'auth_type';
|
||||||
|
|
||||||
|
/** @var string 地址前缀 */
|
||||||
|
const Prefix = 'prefix';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ class StrategyRequest extends FormRequest
|
|||||||
'configs.base_uri' => 'required',
|
'configs.base_uri' => 'required',
|
||||||
'configs.username' => '',
|
'configs.username' => '',
|
||||||
'configs.password' => '',
|
'configs.password' => '',
|
||||||
|
'configs.auth_type' => '',
|
||||||
|
'configs.prefix' => '',
|
||||||
],
|
],
|
||||||
StrategyKey::Minio => [
|
StrategyKey::Minio => [
|
||||||
'configs.access_key' => 'required',
|
'configs.access_key' => 'required',
|
||||||
@@ -200,9 +202,11 @@ class StrategyRequest extends FormRequest
|
|||||||
'configs.passive' => '被动模式',
|
'configs.passive' => '被动模式',
|
||||||
],
|
],
|
||||||
StrategyKey::Webdav => [
|
StrategyKey::Webdav => [
|
||||||
'configs.base_uri' => 'required',
|
'configs.base_uri' => '连接地址',
|
||||||
'configs.username' => 'required',
|
'configs.username' => '用户名',
|
||||||
'configs.password' => 'required',
|
'configs.password' => '密码',
|
||||||
|
'configs.auth_type' => '认证方式',
|
||||||
|
'configs.prefix' => '前缀',
|
||||||
],
|
],
|
||||||
StrategyKey::Minio => [
|
StrategyKey::Minio => [
|
||||||
'configs.access_key' => 'AccessKey',
|
'configs.access_key' => 'AccessKey',
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Sabre\DAV\Client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
@@ -56,6 +57,13 @@ class Strategy extends Model
|
|||||||
StrategyKey::Minio => 'Minio',
|
StrategyKey::Minio => 'Minio',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const WEBDAV_AUTH_TYPES = [
|
||||||
|
'' => 'Auto',
|
||||||
|
Client::AUTH_BASIC => 'Basic',
|
||||||
|
Client::AUTH_DIGEST => 'Digest',
|
||||||
|
Client::AUTH_NTLM => 'Ntlm',
|
||||||
|
];
|
||||||
|
|
||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::saving(function (self $strategy) {
|
static::saving(function (self $strategy) {
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ use League\Flysystem\FilesystemException;
|
|||||||
use League\Flysystem\Ftp\FtpAdapter;
|
use League\Flysystem\Ftp\FtpAdapter;
|
||||||
use League\Flysystem\Ftp\FtpConnectionOptions;
|
use League\Flysystem\Ftp\FtpConnectionOptions;
|
||||||
use League\Flysystem\Local\LocalFilesystemAdapter;
|
use League\Flysystem\Local\LocalFilesystemAdapter;
|
||||||
use League\Flysystem\PhpseclibV2\SftpAdapter;
|
use League\Flysystem\PhpseclibV3\SftpAdapter;
|
||||||
use League\Flysystem\PhpseclibV2\SftpConnectionProvider;
|
use League\Flysystem\PhpseclibV3\SftpConnectionProvider;
|
||||||
use League\Flysystem\WebDAV\WebDAVAdapter;
|
use League\Flysystem\WebDAV\WebDAVAdapter;
|
||||||
use Overtrue\Flysystem\Cos\CosAdapter;
|
use Overtrue\Flysystem\Cos\CosAdapter;
|
||||||
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
|
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
|
||||||
@@ -338,11 +338,12 @@ class ImageService
|
|||||||
'timeout' => 30,
|
'timeout' => 30,
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
StrategyKey::Webdav => new WebDAVAdapter(new Client([
|
StrategyKey::Webdav => new WebDAVAdapter(new Client(([
|
||||||
'baseUri' => $configs->get(WebDavOption::BaseUri),
|
'baseUri' => $configs->get(WebDavOption::BaseUri),
|
||||||
'userName' => $configs->get(WebDavOption::Username),
|
'userName' => $configs->get(WebDavOption::Username),
|
||||||
'password' => $configs->get(WebDavOption::Password)
|
'password' => $configs->get(WebDavOption::Password),
|
||||||
])),
|
'authType' => (int)$configs->get(WebDavOption::AuthType),
|
||||||
|
])), $configs->get(WebDavOption::Prefix) ?: ''),
|
||||||
StrategyKey::Minio => new AwsS3V3Adapter(
|
StrategyKey::Minio => new AwsS3V3Adapter(
|
||||||
client: new S3Client([
|
client: new S3Client([
|
||||||
'credentials' => [
|
'credentials' => [
|
||||||
|
|||||||
2054
composer.lock
generated
2054
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Enums\ConfigKey;
|
|
||||||
use App\Enums\StrategyKey;
|
use App\Enums\StrategyKey;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|||||||
@@ -296,6 +296,18 @@
|
|||||||
<label for="configs[base_uri]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接地址</label>
|
<label for="configs[base_uri]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接地址</label>
|
||||||
<x-input type="url" name="configs[base_uri]" id="configs[base_uri]" placeholder="请输入连接地址" />
|
<x-input type="url" name="configs[base_uri]" id="configs[base_uri]" placeholder="请输入连接地址" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
|
<label for="webdav-configs[auth_type]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>认证方式</label>
|
||||||
|
<x-select id="webdav-auth-type" name="configs[auth_type]" select2>
|
||||||
|
@foreach(\App\Models\Strategy::WEBDAV_AUTH_TYPES as $key => $type)
|
||||||
|
<option value="{{ $key }}" {{ $loop->first ? 'selected' : '' }}>{{ $type }}</option>
|
||||||
|
@endforeach
|
||||||
|
</x-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
|
<label for="webdav-configs[prefix]" class="block text-sm font-medium text-gray-700">路径前缀</label>
|
||||||
|
<x-input type="text" name="configs[prefix]" id="webdav-configs[prefix]" placeholder="请输入路径前缀"></x-input>
|
||||||
|
</div>
|
||||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
<label for="configs[username]" class="block text-sm font-medium text-gray-700">用户名</label>
|
<label for="configs[username]" class="block text-sm font-medium text-gray-700">用户名</label>
|
||||||
<x-input type="text" name="configs[username]" id="configs[username]" placeholder="请输入用户名" />
|
<x-input type="text" name="configs[username]" id="configs[username]" placeholder="请输入用户名" />
|
||||||
|
|||||||
@@ -316,6 +316,18 @@
|
|||||||
<label for="configs[base_uri]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接地址</label>
|
<label for="configs[base_uri]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接地址</label>
|
||||||
<x-input type="url" name="configs[base_uri]" id="configs[base_uri]" placeholder="请输入连接地址" value="{{ $strategy->configs->get('base_uri') }}" />
|
<x-input type="url" name="configs[base_uri]" id="configs[base_uri]" placeholder="请输入连接地址" value="{{ $strategy->configs->get('base_uri') }}" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
|
<label for="webdav-configs[auth_type]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>认证方式</label>
|
||||||
|
<x-select id="webdav-auth-type" name="configs[auth_type]" select2>
|
||||||
|
@foreach(\App\Models\Strategy::WEBDAV_AUTH_TYPES as $key => $type)
|
||||||
|
<option value="{{ $key }}" {{ $key == $strategy->configs->get('auth_type') ? 'selected' : '' }}>{{ $type }}</option>
|
||||||
|
@endforeach
|
||||||
|
</x-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
|
<label for="webdav-configs[prefix]" class="block text-sm font-medium text-gray-700">路径前缀</label>
|
||||||
|
<x-input type="text" name="configs[prefix]" id="webdav-configs[prefix]" placeholder="请输入路径前缀" value="{{ $strategy->configs->get('prefix') }}"></x-input>
|
||||||
|
</div>
|
||||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||||
<label for="configs[username]" class="block text-sm font-medium text-gray-700">用户名</label>
|
<label for="configs[username]" class="block text-sm font-medium text-gray-700">用户名</label>
|
||||||
<x-input type="text" name="configs[username]" id="configs[username]" placeholder="请输入用户名" value="{{ $strategy->configs->get('username') }}" />
|
<x-input type="text" name="configs[username]" id="configs[username]" placeholder="请输入用户名" value="{{ $strategy->configs->get('username') }}" />
|
||||||
|
|||||||
Reference in New Issue
Block a user