✨ Introducing new features.
This commit is contained in:
@@ -21,8 +21,6 @@ class StrategyRequest extends FormRequest
|
||||
'key' => 'required|integer',
|
||||
'configs.root' => 'max:1000',
|
||||
'configs.domain' => 'required|url',
|
||||
|
||||
'configs.symlink' => 'required_if:key,1',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,15 +32,6 @@ class StrategyRequest extends FormRequest
|
||||
'key' => '策略',
|
||||
'configs.root' => '储存路径',
|
||||
'configs.domain' => '访问域名',
|
||||
|
||||
'configs.symlink' => '符号链接'
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'configs.symlink.required_if' => '请输入符号链接',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -59,19 +58,7 @@ class Strategy extends Model
|
||||
static::saving(function (self $strategy) {
|
||||
$strategy->configs['root'] = $strategy->configs->get('root', '');
|
||||
$strategy->configs['domain'] = rtrim($strategy->configs->get('domain', env('APP_URL')), '/');
|
||||
|
||||
// TODO 本地储存,创建/修改符号链接
|
||||
/*if ($strategy->key == StrategyKey::Local && $strategy->configs['root']) {
|
||||
$link = ($strategy->getOriginal('configs')['symlink'] ?? '');
|
||||
if ($link && $link !== $strategy->configs['symlink']) {
|
||||
// 删除已存在的符号链接
|
||||
@unlink($link);
|
||||
}
|
||||
$link = public_path($strategy->configs['symlink']);
|
||||
if (! realpath($link)) {
|
||||
(new Filesystem())->link($strategy->configs['root'], $link);
|
||||
}
|
||||
}*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[domain]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="text" name="configs[domain]" id="configs[domain]" class="mt-1 block w-full rounded-l-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50" placeholder="请输入图片访问域名,需要加 http(s)://" />
|
||||
<small class="text-orange-500"><i class="fas fa-exclamation"></i>
|
||||
注意:本地储存访问域名必须有一个后缀,例如 https://www.lsky.pro/<span class="text-red-600">uploads</span>/20220104/1.jpg 中的 uploads 就是后缀,系统会根据这个后缀生成符号链接。 符号链接相对 public 目录,不能与其他策略重复。
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,9 +49,6 @@
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[domain]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="text" name="configs[domain]" id="configs[domain]" class="mt-1 block w-full rounded-l-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50" placeholder="请输入图片访问域名,需要加 http(s)://" value="{{ $strategy->configs['domain'] }}" />
|
||||
<small class="text-orange-500"><i class="fas fa-exclamation"></i>
|
||||
注意:本地储存访问域名必须有一个后缀,例如 https://www.lsky.pro/<span class="text-red-600">uploads</span>/20220104/1.jpg 中的 uploads 就是后缀,系统会根据这个后缀生成符号链接。 符号链接相对 public 目录,不能与其他策略重复。
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user