Compare commits
146 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38d52c4609 | ||
|
|
2b3f31a204 | ||
|
|
94332ee597 | ||
|
|
aa6dd044ba | ||
|
|
aa9aa31c42 | ||
|
|
bbdb1fb39d | ||
|
|
b3f3594cd5 | ||
|
|
c0504fe62f | ||
|
|
0bc23c796d | ||
|
|
011b291e05 | ||
|
|
effe173d9c | ||
|
|
bdd440d38f | ||
|
|
fe5e4d9a67 | ||
|
|
66d7a0dce1 | ||
|
|
4f13d7d5a1 | ||
|
|
093ef71c2c | ||
|
|
4a87a90d5b | ||
|
|
17cb901046 | ||
|
|
c0ba47d47d | ||
|
|
1d0cb15854 | ||
|
|
465ff63230 | ||
|
|
04a421d3eb | ||
|
|
2642719769 | ||
|
|
4de97fd91e | ||
|
|
ee93913aac | ||
|
|
e54c4e551c | ||
|
|
743409726f | ||
|
|
2fa82cc231 | ||
|
|
dd4c40d846 | ||
|
|
8acf78dac4 | ||
|
|
eb7c051512 | ||
|
|
5ec90a08a1 | ||
|
|
911275c13b | ||
|
|
704a15896d | ||
|
|
c80b92b346 | ||
|
|
67fc980968 | ||
|
|
05af7dffb8 | ||
|
|
ee068513c6 | ||
|
|
fbb022c877 | ||
|
|
2b90d5eb75 | ||
|
|
edb36f8a92 | ||
|
|
a5bbb26ec8 | ||
|
|
9394e590a8 | ||
|
|
0cb84a9662 | ||
|
|
bb37a11bfb | ||
|
|
d5230acdb3 | ||
|
|
c66e58353a | ||
|
|
6661f35a15 | ||
|
|
5a8eb833be | ||
|
|
1925a1ae7a | ||
|
|
bb9ef6e267 | ||
|
|
923f567e0a | ||
|
|
62809f5300 | ||
|
|
c46207c278 | ||
|
|
289ecffbb1 | ||
|
|
2fdb10a60f | ||
|
|
b2b1693a2f | ||
|
|
b6f5f2405b | ||
|
|
f49f52dc34 | ||
|
|
cd1436add2 | ||
|
|
aefbbda2bf | ||
|
|
768ca9f24a | ||
|
|
fb9c390bc7 | ||
|
|
a4a60f13a0 | ||
|
|
5071c3a904 | ||
|
|
2c52c87c95 | ||
|
|
3161394a83 | ||
|
|
8f6da67f4f | ||
|
|
4d3bfed846 | ||
|
|
2086daf1ae | ||
|
|
a8ab0c6680 | ||
|
|
8b5bf74aa2 | ||
|
|
c0513f85a1 | ||
|
|
8f0db089af | ||
|
|
d705542f44 | ||
|
|
4266fd60b7 | ||
|
|
315b5b8296 | ||
|
|
10699d69f6 | ||
|
|
58da33d3c9 | ||
|
|
20871efb5c | ||
|
|
912e3747ee | ||
|
|
fba0d77e7b | ||
|
|
10dea5cffd | ||
|
|
f7983a2f21 | ||
|
|
8ab428c593 | ||
|
|
fb5f83f43c | ||
|
|
73750890d2 | ||
|
|
3ad7e711be | ||
|
|
b6fd41841b | ||
|
|
b61db2b31a | ||
|
|
cff42566c8 | ||
|
|
e44fabbd31 | ||
|
|
3cdf495bef | ||
|
|
6291acbcee | ||
|
|
1434d6fa1c | ||
|
|
73c55b1a77 | ||
|
|
8780a21fe7 | ||
|
|
3acabd7b38 | ||
|
|
1f826fd652 | ||
|
|
8d266b3d5a | ||
|
|
02b9695882 | ||
|
|
5bba6d0d52 | ||
|
|
52f9c0cbe8 | ||
|
|
d2b4910196 | ||
|
|
9a5cbb2ea7 | ||
|
|
b9a3ea2c44 | ||
|
|
0d826042ad | ||
|
|
f9a84c149c | ||
|
|
798e72f634 | ||
|
|
dec4e6fdb7 | ||
|
|
3cecc20f44 | ||
|
|
86d67450ea | ||
|
|
aa9887715a | ||
|
|
fc1c2095a6 | ||
|
|
a0d216fb2d | ||
|
|
b8471f2ca2 | ||
|
|
b7601272dd | ||
|
|
184dd51122 | ||
|
|
3df02550c4 | ||
|
|
f9b046a32f | ||
|
|
01c850739a | ||
|
|
43bb7792ac | ||
|
|
6c31ace31a | ||
|
|
e9050f4b9b | ||
|
|
a2a45e72ba | ||
|
|
317c2ea369 | ||
|
|
df2ed46ab2 | ||
|
|
979b628f59 | ||
|
|
71924b0397 | ||
|
|
b33c309a56 | ||
|
|
ae785cc56f | ||
|
|
66423b1d18 | ||
|
|
ab21fb203f | ||
|
|
31503d340a | ||
|
|
165635bce9 | ||
|
|
45a639fe3e | ||
|
|
b22a334b86 | ||
|
|
4be12d828d | ||
|
|
683a0a4888 | ||
|
|
769eb4bbd5 | ||
|
|
10921b34fc | ||
|
|
ede1ec5344 | ||
|
|
6f6403165c | ||
|
|
43b54a05ca | ||
|
|
b1b5bd0782 | ||
|
|
b2a4c5b971 |
15
README.md
15
README.md
@@ -12,12 +12,18 @@
|
||||
[](https://github.com/lsky-org/lsky-pro/commits/dev)
|
||||
[](https://github.com/lsky-org/lsky-pro/blob/master/LICENSE)
|
||||
|
||||
[官网](https://www.lsky.pro)
|
||||
[文档](https://docs.lsky.pro)
|
||||
[演示](https://pic.iqy.ink)
|
||||
[官网](https://www.lsky.pro) ·
|
||||
[文档](https://docs.lsky.pro) ·
|
||||
[社区](https://github.com/lsky-org/lsky-pro/discussions) ·
|
||||
[演示](https://pic.vv1234.cn) ·
|
||||
[Telegram 群组](https://t.me/lsky_pro)
|
||||
|
||||
> 正式版本请点击 [这里](https://github.com/lsky-org/lsky-pro/releases) 下载,发现 bug 请提交 [issues](https://github.com/lsky-org/lsky-pro/issues) (提问前建议阅读[提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md))
|
||||
> [!WARNING]
|
||||
> 开源版本已停止维护,不再进行新特性更新和 bug 修复。
|
||||
|
||||
> master 分支为未安装三方拓展的版本,通常包含了最新未发布版本的一些实验性新特性和修复补丁,正式版本请点击 [这里](https://github.com/lsky-org/lsky-pro/releases) 下载。
|
||||
> 发现 bug 请提交 [issues](https://github.com/lsky-org/lsky-pro/issues) (提问前建议阅读[提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md))
|
||||
> 有任何想法、建议、或分享,请移步 [社区](https://github.com/lsky-org/lsky-pro/discussions)
|
||||
|
||||

|
||||

|
||||
@@ -51,6 +57,7 @@
|
||||
- exec、shell_exec 函数
|
||||
- readlink、symlink 函数
|
||||
- putenv、getenv 函数
|
||||
- chmod、chown、fileperms 函数
|
||||
|
||||
### 😋 鸣谢
|
||||
- [Laravel](https://laravel.com)
|
||||
|
||||
@@ -54,4 +54,10 @@ final class GroupConfigKey
|
||||
|
||||
/** @var string 图片缓存时间 */
|
||||
const ImageCacheTtl = 'image_cache_ttl';
|
||||
|
||||
/** @var string 图片保存格式 */
|
||||
const ImageSaveFormat = 'image_save_format';
|
||||
|
||||
/** @var string 图片保存质量 */
|
||||
const ImageSaveQuality = 'image_save_quality';
|
||||
}
|
||||
|
||||
9
app/Enums/PastedAction.php
Normal file
9
app/Enums/PastedAction.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
final class PastedAction
|
||||
{
|
||||
const Upload = 2; // 直接上传
|
||||
const Waiting = 1; // 等待上传
|
||||
}
|
||||
15
app/Enums/Scan/NsfwJsOption.php
Normal file
15
app/Enums/Scan/NsfwJsOption.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums\Scan;
|
||||
|
||||
final class NsfwJsOption
|
||||
{
|
||||
/** @var string 接口地址 */
|
||||
const ApiUrl = 'api_url';
|
||||
|
||||
/** @var string 表单属性名称 */
|
||||
const AttrName = 'attr_name';
|
||||
|
||||
/** @var string 阈值 */
|
||||
const Threshold = 'threshold';
|
||||
}
|
||||
21
app/Enums/Scan/TencentOption.php
Normal file
21
app/Enums/Scan/TencentOption.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums\Scan;
|
||||
|
||||
final class TencentOption
|
||||
{
|
||||
/** @var string SecretId */
|
||||
const SecretId = 'secret_id';
|
||||
|
||||
/** @var string SecretKey */
|
||||
const SecretKey = 'secret_key';
|
||||
|
||||
/** @var string Region */
|
||||
const Region = 'region';
|
||||
|
||||
/** @var string Endpoint */
|
||||
const Endpoint = 'endpoint';
|
||||
|
||||
/** @var string 业务场景 */
|
||||
const BizType = 'biz_type';
|
||||
}
|
||||
@@ -21,4 +21,7 @@ final class MinioOption
|
||||
|
||||
/** @var string Bucket */
|
||||
const Bucket = 'bucket';
|
||||
|
||||
/** @var string BucketEndpoint */
|
||||
const BucketEndpoint = 'bucket_endpoint';
|
||||
}
|
||||
|
||||
@@ -15,4 +15,10 @@ final class WebDavOption
|
||||
|
||||
/** @var string 密码 */
|
||||
const Password = 'password';
|
||||
|
||||
/** @var string 认证方式 */
|
||||
const AuthType = 'auth_type';
|
||||
|
||||
/** @var string 地址前缀 */
|
||||
const Prefix = 'prefix';
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ final class UserConfigKey
|
||||
/** @var string 默认权限 */
|
||||
const DefaultPermission = 'default_permission';
|
||||
|
||||
/** @var string 图片粘贴后动作 */
|
||||
const PastedAction = 'pasted_action';
|
||||
|
||||
/** @var string 上传是否自动清除预览 */
|
||||
const IsAutoClearPreview = 'is_auto_clear_preview';
|
||||
}
|
||||
|
||||
9
app/Enums/Watermark/Mode.php
Normal file
9
app/Enums/Watermark/Mode.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums\Watermark;
|
||||
|
||||
final class Mode
|
||||
{
|
||||
const Overlay = 1; // 覆盖原图
|
||||
const Dynamic = 2; // 动态生成
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class ConsoleController extends Controller
|
||||
|
||||
$images = Image::query()
|
||||
->whereBetween('created_at', [$start->format($format), $end->format($format)])
|
||||
->get()
|
||||
->get(['user_id', 'created_at'])
|
||||
->transform(function (Image $image) {
|
||||
$image['date'] = $image->created_at->format('Y-m-d');
|
||||
return $image;
|
||||
|
||||
@@ -28,10 +28,13 @@ class GroupController extends Controller
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$groups = Group::query()->when($request->query('keywords'), function (Builder $builder, $keywords) {
|
||||
$keywords = $request->query('keywords');
|
||||
$groups = Group::query()->when($keywords, function (Builder $builder, $keywords) {
|
||||
$builder->where('name', 'like', "%{$keywords}%");
|
||||
})->withCount('users')->withCount('strategies')->latest()->paginate();
|
||||
|
||||
$groups->appends(compact('keywords'));
|
||||
|
||||
$this->share();
|
||||
|
||||
return view('admin.group.index', compact('groups'));
|
||||
|
||||
@@ -17,9 +17,10 @@ class ImageController extends Controller
|
||||
{
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$keywords = $request->query('keywords');
|
||||
$images = Image::query()->with(['user' => function (BelongsTo $belongsTo) {
|
||||
$belongsTo->withSum('images', 'size');
|
||||
}, 'album', 'group', 'strategy'])->when($request->input('keywords'), function (Builder $builder, $keywords) {
|
||||
}, 'album', 'group', 'strategy'])->when($keywords, function (Builder $builder, $keywords) {
|
||||
$words = [];
|
||||
$qualifiers = [
|
||||
'name:', 'album:', 'group:', 'strategy:', 'email:', 'extension:', 'md5:', 'sha1:', 'ip:', 'is:', 'order:',
|
||||
@@ -38,8 +39,8 @@ class ImageController extends Controller
|
||||
'is:guest' => $builder->whereNull('user_id'),
|
||||
'is:adminer' => $builder->whereHas('user', fn (Builder $builder) => $builder->where('is_adminer', 1)),
|
||||
'order:earliest' => $builder->orderBy('created_at'),
|
||||
'order:utmost' => $builder->orderBy('size'),
|
||||
'order:least' => $builder->orderByDesc('size'),
|
||||
'order:utmost' => $builder->orderByDesc('size'),
|
||||
'order:least' => $builder->orderBy('size'),
|
||||
default => 0,
|
||||
};
|
||||
|
||||
@@ -63,16 +64,20 @@ class ImageController extends Controller
|
||||
});
|
||||
|
||||
foreach ($words as $word) {
|
||||
$builder->where('origin_name', 'like', "%{$word}%")->orWhere('alias_name', 'like', "%{$word}%");
|
||||
$builder->where('name', 'like', "%{$word}%")
|
||||
->orWhere('origin_name', 'like', "%{$word}%")
|
||||
->orWhere('alias_name', 'like', "%{$word}%");
|
||||
}
|
||||
})->latest()->paginate(40);
|
||||
$images->getCollection()->each(function (Image $image) {
|
||||
$image->append('url', 'pathname');
|
||||
$image->append('url', 'pathname', 'thumb_url');
|
||||
$image->album?->setVisible(['name']);
|
||||
$image->group?->setVisible(['name']);
|
||||
$image->strategy?->setVisible(['name']);
|
||||
});
|
||||
|
||||
$images->appends(compact('keywords'));
|
||||
|
||||
return view('admin.image.index', compact('images'));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@ class StrategyController extends Controller
|
||||
{
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$strategies = Strategy::query()->when($request->query('keywords'), function (Builder $builder, $keywords) {
|
||||
$keywords = $request->query('keywords');
|
||||
$strategies = Strategy::query()->when($keywords, function (Builder $builder, $keywords) {
|
||||
$builder->where('name', 'like', "%{$keywords}%")->orWhere('intro', 'like', "%{$keywords}%");
|
||||
})->withCount('images')->withSum('images', 'size')->latest()->paginate();
|
||||
|
||||
$strategies->appends(compact('keywords'));
|
||||
|
||||
return view('admin.strategy.index', compact('strategies'));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,15 +19,19 @@ class UserController extends Controller
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$status = $request->query('status');
|
||||
$keywords = $request->query('keywords');
|
||||
$users = User::query()->when($status > -1, function (Builder $builder) use ($status) {
|
||||
$builder->where('status', $status);
|
||||
})->when($request->query('keywords'), function (Builder $builder, $keywords) {
|
||||
})->when($keywords, function (Builder $builder, $keywords) {
|
||||
$builder->where('name', 'like', "%{$keywords}%")->orWhere('email', 'like', "%{$keywords}%");
|
||||
})->with('group')->withSum('images', 'size')->latest()->paginate();
|
||||
$users->getCollection()->each(function (User $user) {
|
||||
$user->group->setVisible(['name']);
|
||||
});
|
||||
$statuses = [-1 => '全部', 1 => '正常', 0 => '冻结'];
|
||||
|
||||
$users->appends(compact('status', 'keywords'));
|
||||
|
||||
return view('admin.user.index', compact('users', 'statuses'));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use App\Services\ImageService;
|
||||
use App\Services\UserService;
|
||||
use App\Utils;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -76,7 +77,7 @@ class ImageController extends Controller
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$user->images()->where('key', $request->route('key'))->delete();
|
||||
(new UserService())->deleteImages([$request->route('key')], $user, 'key');
|
||||
return $this->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ class RegisteredUserController extends Controller
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
'registered_ip' => $request->ip(),
|
||||
]);
|
||||
|
||||
if (Utils::config(ConfigKey::IsUserNeedVerify)) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\GroupConfigKey;
|
||||
use App\Enums\UserStatus;
|
||||
use App\Enums\Watermark\Mode;
|
||||
use App\Exceptions\UploadException;
|
||||
use App\Http\Result;
|
||||
use App\Models\Group;
|
||||
@@ -158,10 +159,16 @@ class Controller extends BaseController
|
||||
$contents = Cache::get($cacheKey);
|
||||
} else {
|
||||
$contents = $image->filesystem()->read($image->pathname);
|
||||
$configs = collect($image->group?->configs->get(GroupConfigKey::WatermarkConfigs));
|
||||
|
||||
// 是否启用了水印功能,跳过gif和ico图片
|
||||
if ($image->group?->configs->get(GroupConfigKey::IsEnableWatermark) && ! in_array($image->extension, ['ico', 'gif'])) {
|
||||
$configs = $image->group?->configs->get(GroupConfigKey::WatermarkConfigs);
|
||||
$contents = $service->stickWatermark($contents, collect($configs))->encode()->getEncoded();
|
||||
if (
|
||||
$image->group?->configs->get(GroupConfigKey::IsEnableWatermark) &&
|
||||
$configs->get('mode', Mode::Overlay) == Mode::Dynamic &&
|
||||
! in_array($image->extension, ['ico', 'gif', 'svg'])
|
||||
) {
|
||||
$quality = $image->group?->configs->get(GroupConfigKey::ImageSaveQuality, 75);
|
||||
$contents = $service->stickWatermark($contents, $configs)->encode($image->extension, $quality)->getEncoded();
|
||||
}
|
||||
$cacheTtl = (int)$image->group?->configs->get(GroupConfigKey::ImageCacheTtl, 0);
|
||||
// 是否启用了缓存
|
||||
@@ -178,8 +185,8 @@ class Controller extends BaseController
|
||||
|
||||
$mimetype = $image->mimetype;
|
||||
|
||||
// ico 图片直接输出,不经过 InterventionImage 处理
|
||||
if ($image->extension === 'ico') {
|
||||
// ico svg 图片直接输出,不经过 InterventionImage 处理
|
||||
if (in_array($image->extension, ['ico', 'svg'])) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TrustProxies extends Middleware
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
protected $proxies = '*';
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
|
||||
@@ -34,26 +34,39 @@ class GroupRequest extends FormRequest
|
||||
'configs.limit_per_day' => 'required|integer',
|
||||
'configs.limit_per_week' => 'required|integer',
|
||||
'configs.limit_per_month' => 'required|integer',
|
||||
'configs.image_save_quality' => 'required|min:1|max:100',
|
||||
'configs.image_save_format' => '',
|
||||
'configs.path_naming_rule' => 'max:400',
|
||||
'configs.file_naming_rule' => 'max:400',
|
||||
'configs.accepted_file_suffixes' => 'required|array|in:jpeg,jpg,png,gif,tif,bmp,ico,psd,webp',
|
||||
'configs.accepted_file_suffixes' => 'required|array|in:jpeg,jpg,png,gif,tif,bmp,ico,psd,webp,svg',
|
||||
|
||||
'configs.is_enable_scan' => 'boolean',
|
||||
'configs.scanned_action' => [
|
||||
'exclude_if:configs.is_enable_scan,false',
|
||||
'in:mark,delete',
|
||||
],
|
||||
'configs.scan_configs.driver' => ['exclude_if:configs.is_enable_scan,false', 'in:aliyun'],
|
||||
'configs.scan_configs.driver' => ['exclude_if:configs.is_enable_scan,false', 'in:tencent,aliyun,nsfwjs'],
|
||||
'configs.scan_configs.drivers.tencent.endpoint' => [$requiredIfReview('tencent')],
|
||||
'configs.scan_configs.drivers.tencent.secret_id' => [$requiredIfReview('tencent')],
|
||||
'configs.scan_configs.drivers.tencent.secret_key' => [$requiredIfReview('tencent')],
|
||||
'configs.scan_configs.drivers.tencent.region' => [$requiredIfReview('tencent')],
|
||||
'configs.scan_configs.drivers.tencent.biz_type' => '',
|
||||
|
||||
'configs.scan_configs.drivers.aliyun.access_key_id' => [$requiredIfReview('aliyun')],
|
||||
'configs.scan_configs.drivers.aliyun.access_key_secret' => [$requiredIfReview('aliyun')],
|
||||
'configs.scan_configs.drivers.aliyun.biz_type' => [$requiredIfReview('aliyun')],
|
||||
'configs.scan_configs.drivers.aliyun.region_id' => [$requiredIfReview('aliyun')],
|
||||
'configs.scan_configs.drivers.aliyun.biz_type' => '',
|
||||
'configs.scan_configs.drivers.aliyun.scenes' => [$requiredIfReview('aliyun'), 'array'],
|
||||
|
||||
'configs.scan_configs.drivers.nsfwjs.api_url' => [$requiredIfReview('nsfwjs')],
|
||||
'configs.scan_configs.drivers.nsfwjs.attr_name' => [$requiredIfReview('nsfwjs'), 'nullable'],
|
||||
'configs.scan_configs.drivers.nsfwjs.threshold' => [$requiredIfReview('nsfwjs'), 'nullable', 'integer', 'between:1,100'],
|
||||
|
||||
'configs.is_enable_original_protection' => 'boolean',
|
||||
'configs.image_cache_ttl' => 'nullable|numeric',
|
||||
|
||||
'configs.is_enable_watermark' => 'boolean',
|
||||
'configs.watermark_configs.mode' => ['in:1,2'],
|
||||
'configs.watermark_configs.driver' => ['exclude_if:configs.is_enable_watermark,false', 'in:font,image'],
|
||||
'configs.watermark_configs.drivers.font.font' => [
|
||||
$requiredIfWatermark('font'),
|
||||
@@ -105,16 +118,26 @@ class GroupRequest extends FormRequest
|
||||
'configs.limit_per_month' => '每月上传限制',
|
||||
'configs.path_naming_rule' => '路径命名规则',
|
||||
'configs.file_naming_rule' => '文件命名规则',
|
||||
'configs.image_save_quality' => '图片保存质量',
|
||||
'configs.image_save_format' => '图片保存格式',
|
||||
'configs.accepted_file_suffixes' => '允许上传的文件后缀',
|
||||
|
||||
'configs.is_enable_scan' => '是否启用图片审核',
|
||||
'configs.scanned_action' => '图片审核动作',
|
||||
'configs.scan_configs.driver' => '图片审核驱动',
|
||||
'configs.scan_configs.drivers.tencent.endpoint' => 'Endpoint',
|
||||
'configs.scan_configs.drivers.tencent.secret_id' => 'SecretId',
|
||||
'configs.scan_configs.drivers.tencent.secret_key' => 'SecretKey',
|
||||
'configs.scan_configs.drivers.tencent.region' => '地域节点',
|
||||
'configs.scan_configs.drivers.tencent.biz_type' => '业务场景',
|
||||
'configs.scan_configs.drivers.aliyun.access_key_id' => 'AccessKeyId',
|
||||
'configs.scan_configs.drivers.aliyun.access_key_secret' => 'AccessKeySecret',
|
||||
'configs.scan_configs.drivers.aliyun.biz_type' => '场景名称',
|
||||
'configs.scan_configs.drivers.aliyun.region_id' => '地域节点',
|
||||
'configs.scan_configs.drivers.aliyun.biz_type' => '场景名称',
|
||||
'configs.scan_configs.drivers.aliyun.scenes' => '审核场景',
|
||||
'configs.scan_configs.drivers.nsfwjs.api_url' => '接口地址',
|
||||
'configs.scan_configs.drivers.nsfwjs.attr_name' => '表单名称',
|
||||
'configs.scan_configs.drivers.nsfwjs.threshold' => '阈值',
|
||||
|
||||
'configs.is_enable_original_protection' => '是否启用原图保护功能',
|
||||
'configs.image_cache_ttl' => '图片缓存时间',
|
||||
|
||||
@@ -18,7 +18,7 @@ class StrategyRequest extends FormRequest
|
||||
{
|
||||
$checkUrl = function ($attribute, $value, $fail) {
|
||||
if ($this->input('key') == StrategyKey::Local) {
|
||||
$folders = [env('THUMBNAIL_PATH', 'thumbnails'), 'fonts', 'css', 'js'];
|
||||
$folders = [config('app.thumbnail_path'), 'fonts', 'css', 'js'];
|
||||
$symlink = Strategy::getRootPath($value);
|
||||
if (! $symlink) {
|
||||
return $fail('访问域名缺少根路径');
|
||||
@@ -54,6 +54,7 @@ class StrategyRequest extends FormRequest
|
||||
'intro' => 'max:2000',
|
||||
'key' => 'required|integer',
|
||||
'configs.url' => ['required', 'url'],
|
||||
'configs.queries' => '',
|
||||
];
|
||||
|
||||
return array_merge($array, match((int)$this->input('key')) {
|
||||
@@ -123,6 +124,8 @@ class StrategyRequest extends FormRequest
|
||||
'configs.base_uri' => 'required',
|
||||
'configs.username' => '',
|
||||
'configs.password' => '',
|
||||
'configs.auth_type' => '',
|
||||
'configs.prefix' => '',
|
||||
],
|
||||
StrategyKey::Minio => [
|
||||
'configs.access_key' => 'required',
|
||||
@@ -130,6 +133,7 @@ class StrategyRequest extends FormRequest
|
||||
'configs.endpoint' => '',
|
||||
'configs.region' => '',
|
||||
'configs.bucket' => 'required',
|
||||
'configs.bucket_endpoint' => '',
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -141,6 +145,7 @@ class StrategyRequest extends FormRequest
|
||||
'intro' => '简介',
|
||||
'key' => '策略',
|
||||
'configs.url' => '访问网址',
|
||||
'configs.queries' => 'Url 额外参数',
|
||||
];
|
||||
|
||||
return array_merge($array, match((int)$this->input('key')) {
|
||||
@@ -197,9 +202,11 @@ class StrategyRequest extends FormRequest
|
||||
'configs.passive' => '被动模式',
|
||||
],
|
||||
StrategyKey::Webdav => [
|
||||
'configs.base_uri' => 'required',
|
||||
'configs.username' => 'required',
|
||||
'configs.password' => 'required',
|
||||
'configs.base_uri' => '连接地址',
|
||||
'configs.username' => '用户名',
|
||||
'configs.password' => '密码',
|
||||
'configs.auth_type' => '认证方式',
|
||||
'configs.prefix' => '前缀',
|
||||
],
|
||||
StrategyKey::Minio => [
|
||||
'configs.access_key' => 'AccessKey',
|
||||
@@ -207,6 +214,7 @@ class StrategyRequest extends FormRequest
|
||||
'configs.endpoint' => '连接地址',
|
||||
'configs.region' => '区域',
|
||||
'configs.bucket' => 'Bucket 名称',
|
||||
'configs.bucket_endpoint' => 'BucketEndpoint',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class AlbumRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:60',
|
||||
'name' => 'required|max:60|alpha_dash',
|
||||
'intro' => 'max:600'
|
||||
];
|
||||
}
|
||||
@@ -22,6 +22,7 @@ class AlbumRequest extends FormRequest
|
||||
return [
|
||||
'name.required' => '名称不能为空',
|
||||
'name.max' => '名称字符过长,最大不能超过 60',
|
||||
'name.alpha_dash' => '名称只能是字母、数字,短破折号(-)和下划线(_)',
|
||||
'intro.max' => '简介字符过长,最大不能超过 600'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ImageRenameRequest extends FormRequest
|
||||
'id.numeric' => '图片选择异常',
|
||||
'name.required' => '请输入名称',
|
||||
'name.max' => '名称长度不能超过 50 个字符',
|
||||
'name.string' => '名称格式不正确'
|
||||
'name.string' => '名称格式不正确',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class UserSettingRequest extends FormRequest
|
||||
'configs.default_album' => 'required|numeric',
|
||||
'configs.default_strategy' => 'required|numeric',
|
||||
'configs.default_permission' => 'required|in:1,0',
|
||||
'configs.pasted_action' => 'required|in:1,2',
|
||||
'configs.is_auto_clear_preview' => 'nullable|boolean'
|
||||
];
|
||||
}
|
||||
@@ -29,7 +30,7 @@ class UserSettingRequest extends FormRequest
|
||||
'name.required' => '昵称不能为空',
|
||||
'name.between' => '昵称必须在 2-20 个字符之间',
|
||||
'url.url' => '个人主页地址格式不正确',
|
||||
'password.between' => '昵称必须在 6-32 个字符之间',
|
||||
'password.between' => '密码必须在 6-32 个字符之间',
|
||||
'configs.array' => '配置值不正确',
|
||||
'configs.default_album.required' => '默认相册选择错误',
|
||||
'configs.default_album.numeric' => '默认相册选择错误',
|
||||
@@ -37,6 +38,8 @@ class UserSettingRequest extends FormRequest
|
||||
'configs.default_strategy.numeric' => '默认策略选择错误',
|
||||
'configs.default_permission.required' => '权限值选择错误',
|
||||
'configs.default_permission.in' => '权限值不正确',
|
||||
'configs.pasted_action.required' => '粘贴动作值选择错误',
|
||||
'configs.pasted_action.in' => '粘贴动作值不正确',
|
||||
'configs.is_auto_clear_preview.boolean' => '是否自动清除预览选择错误'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property string $name
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -83,7 +81,7 @@ class Group extends Model
|
||||
*/
|
||||
public static function getDefaultConfigs(): Collection
|
||||
{
|
||||
return collect(config('convention.app.group'));
|
||||
return collect(config('convention.group'));
|
||||
}
|
||||
|
||||
public function users(): HasMany
|
||||
|
||||
@@ -6,11 +6,10 @@ use App\Enums\GroupConfigKey;
|
||||
use App\Enums\ImagePermission;
|
||||
use App\Services\ImageService;
|
||||
use App\Utils;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -116,6 +115,8 @@ class Image extends Model
|
||||
// 删除物理文件
|
||||
$image->filesystem()->delete($image->pathname);
|
||||
@unlink(public_path($image->getThumbnailPathname()));
|
||||
// 删除缓存
|
||||
Cache::forget("image_{$image->key}");
|
||||
} catch (\Throwable $e) {
|
||||
Utils::e($e, '删除物理文件时发生异常');
|
||||
}
|
||||
@@ -164,7 +165,8 @@ class Image extends Model
|
||||
|
||||
public function pathname(): Attribute
|
||||
{
|
||||
return new Attribute(fn() => "{$this->path}/{$this->name}");
|
||||
$path = $this->path ? "{$this->path}/" : '';
|
||||
return new Attribute(fn() => "{$path}{$this->name}");
|
||||
}
|
||||
|
||||
public function url(): Attribute
|
||||
@@ -172,10 +174,13 @@ class Image extends Model
|
||||
return new Attribute(function () {
|
||||
// 是否启用原图保护功能
|
||||
if ($this->group?->configs->get(GroupConfigKey::IsEnableOriginalProtection)) {
|
||||
return asset("{$this->key}.{$this->extension}");
|
||||
$url = asset("{$this->key}.{$this->extension}");
|
||||
} else {
|
||||
return rtrim($this->strategy?->configs->get('url'), '/').'/'.$this->pathname;
|
||||
$url = rtrim($this->strategy?->configs->get('url'), '/').'/'.ltrim($this->pathname, '/');
|
||||
}
|
||||
|
||||
// 拼接图片 url
|
||||
return $url.($this->strategy?->configs->get('queries') ?: '');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -235,7 +240,7 @@ class Image extends Model
|
||||
|
||||
public function getThumbnailPathname(): string
|
||||
{
|
||||
return trim(env('THUMBNAIL_PATH', 'thumbnails'), '/')."/{$this->md5}.png";
|
||||
return trim(config('app.thumbnail_path'), '/')."/{$this->md5}.". ($this->extension === 'svg' ? 'svg' : "png");
|
||||
}
|
||||
|
||||
private function generateKey($length = 6): string
|
||||
|
||||
13
app/Models/Model.php
Normal file
13
app/Models/Model.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\CarbonInterface;
|
||||
|
||||
abstract class Model extends \Illuminate\Database\Eloquent\Model
|
||||
{
|
||||
protected function serializeDate(\DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format(CarbonInterface::DEFAULT_TO_STRING_FORMAT);
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,14 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\StrategyKey;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
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;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Sabre\DAV\Client;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -57,6 +57,13 @@ class Strategy extends Model
|
||||
StrategyKey::Minio => 'Minio',
|
||||
];
|
||||
|
||||
const WEBDAV_AUTH_TYPES = [
|
||||
'' => 'Auto',
|
||||
Client::AUTH_BASIC => 'Basic',
|
||||
Client::AUTH_DIGEST => 'Digest',
|
||||
Client::AUTH_NTLM => 'Ntlm',
|
||||
];
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::saving(function (self $strategy) {
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\ConfigKey;
|
||||
use App\Enums\ImagePermission;
|
||||
use App\Enums\UserConfigKey;
|
||||
use App\Utils;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -26,6 +24,7 @@ use Laravel\Sanctum\HasApiTokens;
|
||||
* @property string $remember_token
|
||||
* @property boolean $is_adminer
|
||||
* @property float $capacity
|
||||
* @property float $use_capacity
|
||||
* @property string $url
|
||||
* @property Collection $configs
|
||||
* @property int $image_num
|
||||
@@ -100,13 +99,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
$user->group_id = Group::query()->where('is_default', true)->value('id');
|
||||
// 初始容量
|
||||
$user->capacity = Utils::config(ConfigKey::UserInitialCapacity);
|
||||
|
||||
$user->configs = collect([
|
||||
UserConfigKey::DefaultAlbum => 0,
|
||||
UserConfigKey::DefaultStrategy => 0,
|
||||
UserConfigKey::DefaultPermission => ImagePermission::Private,
|
||||
UserConfigKey::IsAutoClearPreview => false,
|
||||
])->merge($user->configs ?: []);
|
||||
$user->configs = collect(config('convention.user'))->merge($user->configs ?: []);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,6 +108,11 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return new Attribute(fn () => Utils::getAvatar($this->email));
|
||||
}
|
||||
|
||||
public function useCapacity(): Attribute
|
||||
{
|
||||
return new Attribute(fn () => $this->images()->sum('size'));
|
||||
}
|
||||
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Group::class, 'group_id', 'id');
|
||||
|
||||
@@ -46,7 +46,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
View::composer('*', function (\Illuminate\View\View $view) {
|
||||
/** @var Group $group */
|
||||
$group = Auth::check() ? Auth::user()->group : Group::query()->where('is_guest', true)->first();
|
||||
$view->with('_group', $group);
|
||||
$view->with([
|
||||
'_group' => $group,
|
||||
'_is_notice' => strip_tags(Utils::config(ConfigKey::SiteNotice)),
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ use App\Enums\ConfigKey;
|
||||
use App\Enums\GroupConfigKey;
|
||||
use App\Enums\ImagePermission;
|
||||
use App\Enums\Scan\AliyunOption;
|
||||
use App\Enums\Scan\NsfwJsOption;
|
||||
use App\Enums\Scan\TencentOption;
|
||||
use App\Enums\Strategy\CosOption;
|
||||
use App\Enums\Strategy\FtpOption;
|
||||
use App\Enums\Strategy\KodoOption;
|
||||
@@ -23,6 +25,7 @@ use App\Enums\UserConfigKey;
|
||||
use App\Enums\UserStatus;
|
||||
use App\Enums\Watermark\FontOption;
|
||||
use App\Enums\Watermark\ImageOption;
|
||||
use App\Enums\Watermark\Mode;
|
||||
use App\Exceptions\UploadException;
|
||||
use App\Models\Group;
|
||||
use App\Models\Image;
|
||||
@@ -30,13 +33,14 @@ use App\Models\Strategy;
|
||||
use App\Models\User;
|
||||
use App\Utils;
|
||||
use Aws\S3\S3Client;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Str;
|
||||
use Intervention\Image\Facades\Image as InterventionImage;
|
||||
use Intervention\Image\Imagick\Font;
|
||||
@@ -48,12 +52,17 @@ use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\Ftp\FtpAdapter;
|
||||
use League\Flysystem\Ftp\FtpConnectionOptions;
|
||||
use League\Flysystem\Local\LocalFilesystemAdapter;
|
||||
use League\Flysystem\PhpseclibV2\SftpAdapter;
|
||||
use League\Flysystem\PhpseclibV2\SftpConnectionProvider;
|
||||
use League\Flysystem\PhpseclibV3\SftpAdapter;
|
||||
use League\Flysystem\PhpseclibV3\SftpConnectionProvider;
|
||||
use League\Flysystem\WebDAV\WebDAVAdapter;
|
||||
use Overtrue\Flysystem\Cos\CosAdapter;
|
||||
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
|
||||
use Sabre\DAV\Client;
|
||||
use TencentCloud\Common\Credential;
|
||||
use TencentCloud\Common\Profile\ClientProfile;
|
||||
use TencentCloud\Common\Profile\HttpProfile;
|
||||
use TencentCloud\Ims\V20201229\ImsClient;
|
||||
use TencentCloud\Ims\V20201229\Models\ImageModerationRequest;
|
||||
use WispX\Flysystem\Upyun\UpyunAdapter;
|
||||
use Zing\Flysystem\Oss\OssAdapter;
|
||||
use OSS\OssClient;
|
||||
@@ -142,6 +151,34 @@ class ImageService
|
||||
// 上传频率限制
|
||||
$this->rateLimiter($configs, $request);
|
||||
|
||||
// 图片处理,跳过 ico gif svg
|
||||
if (! in_array($extension, ['ico', 'gif', 'svg'])) {
|
||||
// 图片保存质量与格式
|
||||
$quality = $configs->get(GroupConfigKey::ImageSaveQuality, 75);
|
||||
$format = $configs->get(GroupConfigKey::ImageSaveFormat);
|
||||
if ($quality < 100 || $format) {
|
||||
// 获取拓展名,判断是否需要转换
|
||||
$format = $format ?: $extension;
|
||||
$filename = Str::replaceLast($extension, $format, $file->getClientOriginalName());
|
||||
$handleImage = InterventionImage::make($file)->save('tmp_' . md5_file($file->getRealPath()), $quality);
|
||||
$file = new UploadedFile($handleImage->basePath(), $filename, $handleImage->mime());
|
||||
// 重新设置拓展名
|
||||
$extension = $format;
|
||||
$handleImage->destroy();
|
||||
}
|
||||
|
||||
// 是否启用水印,覆盖原图片
|
||||
if (
|
||||
$configs->get(GroupConfigKey::IsEnableWatermark) &&
|
||||
collect($configs->get(GroupConfigKey::WatermarkConfigs))->get('mode', Mode::Overlay) == Mode::Overlay
|
||||
) {
|
||||
$watermarkImage = $this->stickWatermark($file, collect($configs->get(GroupConfigKey::WatermarkConfigs)));
|
||||
$watermarkImage->save();
|
||||
$file = new UploadedFile($watermarkImage->basePath(), $file->getClientOriginalName(), $file->getMimeType());
|
||||
$watermarkImage->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
$filename = $this->replacePathname(
|
||||
$configs->get(GroupConfigKey::PathNamingRule).'/'.$configs->get(GroupConfigKey::FileNamingRule), $file,
|
||||
);
|
||||
@@ -152,7 +189,7 @@ class ImageService
|
||||
$image->fill([
|
||||
'md5' => md5_file($file->getRealPath()),
|
||||
'sha1' => sha1_file($file->getRealPath()),
|
||||
'path' => dirname($pathname),
|
||||
'path' => $configs->get(GroupConfigKey::PathNamingRule) ? dirname($pathname) : '',
|
||||
'name' => basename($pathname),
|
||||
'origin_name' => $file->getClientOriginalName(),
|
||||
'size' => $file->getSize() / 1024,
|
||||
@@ -179,7 +216,7 @@ class ImageService
|
||||
Utils::e($e, '保存图片时出现异常');
|
||||
throw new UploadException(config('app.debug', false) ? $e->getMessage() : '图片上传失败');
|
||||
}
|
||||
@fclose($handle);
|
||||
if (is_resource($handle)) @fclose($handle);
|
||||
} else {
|
||||
$image->fill($existing->only('path', 'name'));
|
||||
}
|
||||
@@ -208,10 +245,15 @@ class ImageService
|
||||
throw new UploadException('图片记录保存失败');
|
||||
}
|
||||
|
||||
// 图片检测
|
||||
if ($configs->get(GroupConfigKey::IsEnableScan)) {
|
||||
// 图片检测,跳过 tif、ico、psd、svg 格式
|
||||
if ($configs->get(GroupConfigKey::IsEnableScan) && ! in_array($extension, ['psd', 'ico', 'tif', 'svg'])) {
|
||||
$scanConfigs = $configs->get(GroupConfigKey::ScanConfigs);
|
||||
if ($this->scan($scanConfigs['driver'], collect($scanConfigs['drivers'][$scanConfigs['driver']]), $image)) {
|
||||
if ($this->scan(
|
||||
driver: $scanConfigs['driver'],
|
||||
configs: collect($scanConfigs['drivers'][$scanConfigs['driver']]),
|
||||
image: $image,
|
||||
file: $file,
|
||||
)) {
|
||||
// 标记 or 删除
|
||||
if ($configs->get(GroupConfigKey::ScannedAction) === 'delete') {
|
||||
$image->delete();
|
||||
@@ -224,9 +266,11 @@ class ImageService
|
||||
}
|
||||
}
|
||||
|
||||
// 生成缩略图
|
||||
$this->makeThumbnail($image, $file);
|
||||
|
||||
// 上传完成后删除临时文件
|
||||
unlink($file->getPathname());
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
@@ -250,10 +294,10 @@ class ImageService
|
||||
bucket: $configs->get(S3Option::Bucket),
|
||||
),
|
||||
StrategyKey::Oss => new OssAdapter(
|
||||
client: new OssClient(
|
||||
accessKeyId: $configs->get(OssOption::AccessKeyId),
|
||||
accessKeySecret: $configs->get(OssOption::AccessKeySecret),
|
||||
endpoint: $configs->get(OssOption::Endpoint),
|
||||
client: new OssClient($configs->get(
|
||||
OssOption::AccessKeyId),
|
||||
$configs->get(OssOption::AccessKeySecret),
|
||||
$configs->get(OssOption::Endpoint),
|
||||
),
|
||||
bucket: $configs->get(OssOption::Bucket),
|
||||
),
|
||||
@@ -296,11 +340,12 @@ class ImageService
|
||||
'timeout' => 30,
|
||||
]),
|
||||
),
|
||||
StrategyKey::Webdav => new WebDAVAdapter(new Client([
|
||||
StrategyKey::Webdav => new WebDAVAdapter(new Client(([
|
||||
'baseUri' => $configs->get(WebDavOption::BaseUri),
|
||||
'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(
|
||||
client: new S3Client([
|
||||
'credentials' => [
|
||||
@@ -310,6 +355,7 @@ class ImageService
|
||||
'endpoint' => $configs->get(MinioOption::Endpoint),
|
||||
'region' => $configs->get(MinioOption::Region),
|
||||
'version' => '2006-03-01',
|
||||
'bucket_endpoint' => (bool)$configs->get(MinioOption::BucketEndpoint),
|
||||
]),
|
||||
bucket: $configs->get(MinioOption::Bucket),
|
||||
),
|
||||
@@ -329,7 +375,7 @@ class ImageService
|
||||
'hours' => ['key' => GroupConfigKey::LimitPerHour, 'str' => '小时'],
|
||||
'days' => ['key' => GroupConfigKey::LimitPerDay, 'str' => '天'],
|
||||
'weeks' => ['key' => GroupConfigKey::LimitPerWeek, 'str' => '周'],
|
||||
'months' => ['key' => GroupConfigKey::LimitPerWeek, 'str' => '月'],
|
||||
'months' => ['key' => GroupConfigKey::LimitPerMonth, 'str' => '月'],
|
||||
];
|
||||
|
||||
foreach ($array as $key => $item) {
|
||||
@@ -354,14 +400,47 @@ class ImageService
|
||||
* @param $driver
|
||||
* @param Collection $configs
|
||||
* @param Image $image
|
||||
* @param UploadedFile $file
|
||||
* @return bool true=违规
|
||||
* @throws UploadException
|
||||
*/
|
||||
public function scan($driver, Collection $configs, Image $image): bool
|
||||
public function scan($driver, Collection $configs, Image $image, UploadedFile $file): bool
|
||||
{
|
||||
$flag = false;
|
||||
try {
|
||||
if ($driver === 'tencent') {
|
||||
// 图片大小不得超过 5mb
|
||||
if ($file->getSize() >= 5242880) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cred = new Credential($configs->get(TencentOption::SecretId), $configs->get(TencentOption::SecretKey));
|
||||
$httpProfile = new HttpProfile();
|
||||
$httpProfile->setEndpoint($configs->get(TencentOption::Endpoint));
|
||||
$clientProfile = new ClientProfile();
|
||||
$clientProfile->setHttpProfile($httpProfile);
|
||||
$client = new ImsClient($cred, $configs->get(TencentOption::Region), $clientProfile);
|
||||
$req = new ImageModerationRequest();
|
||||
$params = [
|
||||
"FileContent" => base64_encode($file->getContent()),
|
||||
];
|
||||
if ($configs->get(TencentOption::BizType)) {
|
||||
$params['BizType'] = $configs->get(TencentOption::BizType);
|
||||
}
|
||||
$req->fromJsonString(json_encode($params));
|
||||
$resp = $client->ImageModeration($req);
|
||||
|
||||
if ($resp->getSuggestion() === 'Block') {
|
||||
$flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($driver === 'aliyun') {
|
||||
// 20 mb以内、宽高不超过 30000px
|
||||
if ($file->getSize() >= 20971520 || $image->width >= 30000 || $image->height >= 30000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AlibabaCloud::accessKeyClient(
|
||||
$configs->get(AliyunOption::AccessKeyId),
|
||||
$configs->get(AliyunOption::AccessKeySecret),
|
||||
@@ -385,6 +464,29 @@ class ImageService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($driver === 'nsfwjs') {
|
||||
// 不支持 bmp 格式
|
||||
if ($image->extension === 'bmp') {
|
||||
return false;
|
||||
}
|
||||
$response = Http::timeout(180)->withOptions(['timeout' => 180])->attach(
|
||||
$configs->get(NsfwJsOption::AttrName, 'image'), $file->getContent(), $file->getClientOriginalName(),
|
||||
)->post($configs->get(NsfwJsOption::ApiUrl));
|
||||
$ratio = $configs->get(NsfwJsOption::Threshold, 60) / 100;
|
||||
|
||||
if ($response->json('hentai', 0.00) >= $ratio) {
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if ($response->json('porn', 0.00) >= $ratio) {
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if ($response->json('sexy', 0.00) >= $ratio) {
|
||||
$flag = true;
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
throw new UploadException('Scan: '.$e->getMessage());
|
||||
}
|
||||
@@ -455,24 +557,28 @@ class ImageService
|
||||
@mkdir(dirname($pathname));
|
||||
}
|
||||
|
||||
@ini_set('memory_limit', '512M');
|
||||
// 生成缩略图,svg等格式本身体积足够小且网页原生支持(比生成的png缩略图还小),不用生成缩略图,直接复制文件
|
||||
if($image->extension ==='svg') {
|
||||
copy($data->getPathname(), $pathname);
|
||||
}else{
|
||||
@ini_set('memory_limit', '512M');
|
||||
|
||||
$img = InterventionImage::make($data);
|
||||
$img = InterventionImage::make($data);
|
||||
|
||||
$width = $w = $image->width;
|
||||
$height = $h = $image->height;
|
||||
$width = $w = $image->width;
|
||||
$height = $h = $image->height;
|
||||
|
||||
if ($w > $max && $h > $max) {
|
||||
$scale = min($max / $w, $max / $h);
|
||||
$width = (int)($w * $scale);
|
||||
$height = (int)($h * $scale);
|
||||
if ($w > $max && $h > $max) {
|
||||
$scale = min($max / $w, $max / $h);
|
||||
$width = (int)($w * $scale);
|
||||
$height = (int)($h * $scale);
|
||||
}
|
||||
|
||||
$img->fit($width, $height, fn($constraint) => $constraint->upsize())->encode('png', 60)->save($pathname);
|
||||
$img->destroy();
|
||||
}
|
||||
|
||||
$img->fit($width, $height, fn($constraint) => $constraint->upsize())->encode('png')->save($pathname);
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
Utils::e($e, '生成缩略图时出现异常');
|
||||
// TODO 直接将原图存下来?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,7 +644,7 @@ class ImageService
|
||||
'{md5-16}' => substr(md5(microtime().Str::random()), 0, 16),
|
||||
'{str-random-16}' => Str::random(),
|
||||
'{str-random-10}' => Str::random(10),
|
||||
'{filename}' => rtrim($file->getClientOriginalName(), '.'.$file->getClientOriginalExtension()),
|
||||
'{filename}' => Str::replaceLast('.'.$file->getClientOriginalExtension(), '', $file->getClientOriginalName()),
|
||||
'{uid}' => Auth::check() ? Auth::id() : 0,
|
||||
];
|
||||
return str_replace(array_keys($array), array_values($array), $pathname);
|
||||
|
||||
@@ -10,14 +10,13 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Flysystem\Filesystem;
|
||||
use League\Flysystem\FilesystemException;
|
||||
use League\Flysystem\Local\LocalFilesystemAdapter;
|
||||
|
||||
class UpgradeService
|
||||
{
|
||||
const ApiUrl = 'https://api.lsky.pro/v1';
|
||||
const ApiUrl = 'https://api.lsky.pro/v2';
|
||||
|
||||
/** @var array|array[] 所有版本 */
|
||||
protected array $versions = [];
|
||||
@@ -34,7 +33,7 @@ class UpgradeService
|
||||
|
||||
public function __construct(protected string $version)
|
||||
{
|
||||
$this->http = Http::baseUrl(self::ApiUrl)->withOptions(['timeout' => 30])->timeout(30);
|
||||
$this->http = Http::baseUrl(self::ApiUrl)->withOptions(['timeout' => 1800])->timeout(1800);
|
||||
$this->filesystem = new Filesystem(new LocalFilesystemAdapter(base_path()));
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ class UpgradeService
|
||||
public function getVersions(): Collection
|
||||
{
|
||||
if (! $this->versions) {
|
||||
$response = $this->http->timeout(30)->get('/versions');
|
||||
$response = $this->http->get('/versions');
|
||||
if (! $response->successful()) {
|
||||
throw new \Exception('无法请求升级服务器');
|
||||
}
|
||||
@@ -82,17 +81,23 @@ class UpgradeService
|
||||
$this->setProgress('准备升级...');
|
||||
|
||||
@ini_set('memory_limit', '1G');
|
||||
@ini_set('max_execution_time', '86400');
|
||||
// 获取差异信息
|
||||
$response = $this->http->timeout(30)->get('/diff/'.urlencode(Utils::config(ConfigKey::AppVersion)));
|
||||
if (! $response->successful()) {
|
||||
$response = $this->http->get('/diff/'.urlencode(Utils::config(ConfigKey::AppVersion)));
|
||||
if ($response->failed()) {
|
||||
throw new \Exception('无法请求升级服务器');
|
||||
}
|
||||
$files = $response->json();
|
||||
$result = $response->json();
|
||||
$files = $result['files'];
|
||||
|
||||
$this->setProgress('下载补丁包...');
|
||||
foreach ($files as $file) {
|
||||
if ($file['action'] === 'deleted') continue;
|
||||
$this->filesystem->write($this->temp.'/'.$file['pathname'], base64_decode($file['content']));
|
||||
$res = $this->http->baseUrl($result['download_url'])->get($file['pathname']);
|
||||
if ($res->failed()) {
|
||||
throw new \Exception("补丁文件 {$file['pathname']} 下载失败。");
|
||||
}
|
||||
$this->filesystem->write($this->temp.'/'.$file['pathname'], $res->body());
|
||||
// 校验文件
|
||||
if ($file['md5'] !== md5_file(base_path($this->temp).'/'.$file['pathname'])) {
|
||||
throw new \Exception("补丁文件 {$file['pathname']} 校验失败。");
|
||||
@@ -110,13 +115,9 @@ class UpgradeService
|
||||
$version = $this->getVersions()->first()['name'];
|
||||
Config::query()->where('name', ConfigKey::AppVersion)->update(['value' => $version]);
|
||||
// 执行数据库迁移
|
||||
Artisan::call('migrate');
|
||||
// 清除配置缓存
|
||||
Cache::forget('configs');
|
||||
Artisan::call('migrate', ['--seed' => true]);
|
||||
// 清除缓存
|
||||
Artisan::call('route:clear');
|
||||
Artisan::call('cache:clear');
|
||||
Artisan::call('view:clear');
|
||||
Artisan::call('optimize:clear');
|
||||
Artisan::call('package:discover');
|
||||
} catch (\Throwable $e) {
|
||||
Utils::e($e, '升级失败');
|
||||
|
||||
@@ -16,14 +16,15 @@ class UserService
|
||||
*
|
||||
* @param array $keys
|
||||
* @param User|null $user 传入用户数据则会根据用户id过滤
|
||||
* @param string $field
|
||||
* @return int
|
||||
*/
|
||||
public function deleteImages(array $keys, ?User $user = null): int
|
||||
public function deleteImages(array $keys, ?User $user = null, string $field = 'id'): int
|
||||
{
|
||||
$count = 0;
|
||||
$model = Image::with('user', 'strategy', 'album')->when(! is_null($user), function (Builder $builder) use ($user) {
|
||||
$builder->where('user_id', $user->id);
|
||||
})->whereIn('id', $keys);
|
||||
})->whereIn($field, $keys);
|
||||
|
||||
DB::transaction(function () use ($model, $keys, &$count) {
|
||||
/** @var Image $image */
|
||||
|
||||
@@ -32,7 +32,7 @@ class Utils
|
||||
*/
|
||||
public static function getAvatar($email, int $s = 96, string $d = 'mp', string $r = 'g'): string
|
||||
{
|
||||
$url = 'https://gravatar.cat.net/avatar/';
|
||||
$url = 'https://cravatar.cn/avatar/';
|
||||
$url .= md5(strtolower(trim($email)));
|
||||
$url .= "?s=$s&d=$d&r=$r";
|
||||
return $url;
|
||||
@@ -147,7 +147,7 @@ class Utils
|
||||
{
|
||||
foreach ($array as &$value) {
|
||||
if (is_array($value)) {
|
||||
$value = self::filter($value);
|
||||
$value = self::filter($value, $callback, $mode);
|
||||
}
|
||||
}
|
||||
return array_filter($array, $callback, $mode);
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
"laravel/tinker": "^2.7",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"league/flysystem-ftp": "^3.0",
|
||||
"league/flysystem-sftp": "^3.0",
|
||||
"league/flysystem-sftp-v3": "^3.0",
|
||||
"league/flysystem-webdav": "^3.0",
|
||||
"overtrue/flysystem-cos": "^5.0",
|
||||
"overtrue/flysystem-qiniu": "^3.0",
|
||||
"tencentcloud/ims": "^3.0",
|
||||
"wispx/flysystem-upyun": "^1.0",
|
||||
"zing/flysystem-oss": "^2.1"
|
||||
},
|
||||
|
||||
3439
composer.lock
generated
3439
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -194,4 +194,11 @@ return [
|
||||
// ...
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Lsky configs
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'thumbnail_path' => env('THUMBNAIL_PATH', 'thumbnails')
|
||||
];
|
||||
|
||||
@@ -4,15 +4,21 @@
|
||||
|
||||
use App\Enums\ConfigKey;
|
||||
use App\Enums\GroupConfigKey;
|
||||
use App\Enums\ImagePermission;
|
||||
use App\Enums\Mail\SmtpOption;
|
||||
use App\Enums\PastedAction;
|
||||
use App\Enums\Scan\AliyunOption;
|
||||
use App\Enums\Scan\NsfwJsOption;
|
||||
use App\Enums\Scan\TencentOption;
|
||||
use App\Enums\UserConfigKey;
|
||||
use App\Enums\Watermark\FontOption;
|
||||
use App\Enums\Watermark\ImageOption;
|
||||
use App\Enums\Watermark\Mode;
|
||||
|
||||
return [
|
||||
'app' => [
|
||||
ConfigKey::AppName => 'Lsky Pro',
|
||||
ConfigKey::AppVersion => 'V 2.0.1',
|
||||
ConfigKey::AppVersion => 'V 2.1',
|
||||
ConfigKey::SiteKeywords => 'Lsky Pro,lsky,兰空图床',
|
||||
ConfigKey::SiteDescription => 'Lsky Pro, Your photo album on the cloud.',
|
||||
ConfigKey::SiteNotice => '',
|
||||
@@ -37,59 +43,81 @@ return [
|
||||
]
|
||||
],
|
||||
],
|
||||
ConfigKey::Group => [
|
||||
GroupConfigKey::MaximumFileSize => 5120,
|
||||
GroupConfigKey::ConcurrentUploadNum => 3,
|
||||
GroupConfigKey::IsEnableScan => 0,
|
||||
GroupConfigKey::IsEnableWatermark => 0,
|
||||
GroupConfigKey::IsEnableOriginalProtection => 0,
|
||||
GroupConfigKey::ScannedAction => 'mark', // in mark or delete
|
||||
GroupConfigKey::ScanConfigs => [
|
||||
'driver' => 'aliyun',
|
||||
'drivers' => [
|
||||
'aliyun' => [
|
||||
AliyunOption::AccessKeyId => '',
|
||||
AliyunOption::AccessKeySecret => '',
|
||||
AliyunOption::RegionId => '',
|
||||
AliyunOption::Scenes => ['porn'],
|
||||
AliyunOption::BizType => '',
|
||||
],
|
||||
],
|
||||
],
|
||||
GroupConfigKey::WatermarkConfigs => [
|
||||
'driver' => 'font',
|
||||
'drivers' => [
|
||||
'font' => [
|
||||
FontOption::Text => 'Lsky Pro',
|
||||
FontOption::Position => 'bottom-right',
|
||||
FontOption::Angle => 0,
|
||||
FontOption::Size => 50,
|
||||
FontOption::Font => '',
|
||||
FontOption::Color => '#000000',
|
||||
FontOption::X => 10,
|
||||
FontOption::Y => 10,
|
||||
],
|
||||
'image' => [
|
||||
ImageOption::Image => '',
|
||||
ImageOption::Position => 'bottom-right',
|
||||
ImageOption::Opacity => 100,
|
||||
ImageOption::Rotate => 0,
|
||||
ImageOption::Width => 0,
|
||||
ImageOption::Height => 0,
|
||||
ImageOption::X => 10,
|
||||
ImageOption::Y => 10,
|
||||
]
|
||||
],
|
||||
],
|
||||
GroupConfigKey::LimitPerMinute => 20,
|
||||
GroupConfigKey::LimitPerHour => 100,
|
||||
GroupConfigKey::LimitPerDay => 300,
|
||||
GroupConfigKey::LimitPerWeek => 600,
|
||||
GroupConfigKey::LimitPerMonth => 999,
|
||||
GroupConfigKey::AcceptedFileSuffixes => ['jpeg', 'jpg', 'png', 'gif', 'tif', 'bmp', 'ico', 'psd', 'webp'],
|
||||
GroupConfigKey::PathNamingRule => '{Y}/{m}/{d}',
|
||||
GroupConfigKey::FileNamingRule => '{uniqid}',
|
||||
GroupConfigKey::ImageCacheTtl => 2626560,
|
||||
],
|
||||
],
|
||||
'group' => [
|
||||
GroupConfigKey::MaximumFileSize => 5120,
|
||||
GroupConfigKey::ConcurrentUploadNum => 3,
|
||||
GroupConfigKey::IsEnableScan => 0,
|
||||
GroupConfigKey::IsEnableWatermark => 0,
|
||||
GroupConfigKey::IsEnableOriginalProtection => 0,
|
||||
GroupConfigKey::ScannedAction => 'mark', // in mark or delete
|
||||
GroupConfigKey::ScanConfigs => [
|
||||
'driver' => 'tencent',
|
||||
'drivers' => [
|
||||
'tencent' => [
|
||||
TencentOption::Endpoint => 'ims.tencentcloudapi.com',
|
||||
TencentOption::SecretId => '',
|
||||
TencentOption::SecretKey => '',
|
||||
TencentOption::Region => '',
|
||||
TencentOption::BizType => ''
|
||||
],
|
||||
'aliyun' => [
|
||||
AliyunOption::AccessKeyId => '',
|
||||
AliyunOption::AccessKeySecret => '',
|
||||
AliyunOption::RegionId => '',
|
||||
AliyunOption::Scenes => ['porn'],
|
||||
AliyunOption::BizType => '',
|
||||
],
|
||||
'nsfwjs' => [
|
||||
NsfwJsOption::ApiUrl => '',
|
||||
NsfwJsOption::AttrName => 'image',
|
||||
NsfwJsOption::Threshold => 60,
|
||||
]
|
||||
],
|
||||
],
|
||||
GroupConfigKey::WatermarkConfigs => [
|
||||
'mode' => Mode::Overlay,
|
||||
'driver' => 'font',
|
||||
'drivers' => [
|
||||
'font' => [
|
||||
FontOption::Text => 'Lsky Pro',
|
||||
FontOption::Position => 'bottom-right',
|
||||
FontOption::Angle => 0,
|
||||
FontOption::Size => 50,
|
||||
FontOption::Font => '',
|
||||
FontOption::Color => '#000000',
|
||||
FontOption::X => 10,
|
||||
FontOption::Y => 10,
|
||||
],
|
||||
'image' => [
|
||||
ImageOption::Image => '',
|
||||
ImageOption::Position => 'bottom-right',
|
||||
ImageOption::Opacity => 100,
|
||||
ImageOption::Rotate => 0,
|
||||
ImageOption::Width => 0,
|
||||
ImageOption::Height => 0,
|
||||
ImageOption::X => 10,
|
||||
ImageOption::Y => 10,
|
||||
]
|
||||
],
|
||||
],
|
||||
GroupConfigKey::LimitPerMinute => 20,
|
||||
GroupConfigKey::LimitPerHour => 100,
|
||||
GroupConfigKey::LimitPerDay => 300,
|
||||
GroupConfigKey::LimitPerWeek => 600,
|
||||
GroupConfigKey::LimitPerMonth => 999,
|
||||
GroupConfigKey::AcceptedFileSuffixes => ['jpeg', 'jpg', 'png', 'gif', 'tif', 'bmp', 'ico', 'psd', 'webp', 'svg'],
|
||||
GroupConfigKey::ImageSaveFormat => '',
|
||||
GroupConfigKey::ImageSaveQuality => 75,
|
||||
GroupConfigKey::PathNamingRule => '{Y}/{m}/{d}',
|
||||
GroupConfigKey::FileNamingRule => '{uniqid}',
|
||||
GroupConfigKey::ImageCacheTtl => 2626560,
|
||||
],
|
||||
'user' => [
|
||||
UserConfigKey::DefaultAlbum => 0,
|
||||
UserConfigKey::DefaultStrategy => 0,
|
||||
UserConfigKey::DefaultPermission => ImagePermission::Private,
|
||||
UserConfigKey::PastedAction => PastedAction::Waiting,
|
||||
UserConfigKey::IsAutoClearPreview => false,
|
||||
]
|
||||
];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Config;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
@@ -13,6 +14,10 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call([]);
|
||||
// 初始化系统默认配置
|
||||
foreach (config('convention.app') as $key => $value) {
|
||||
$content = is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value;
|
||||
Config::query()->firstOrCreate(['name' => $key], ['value' => $content]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\ConfigKey;
|
||||
use App\Enums\StrategyKey;
|
||||
use App\Models\Group;
|
||||
use Illuminate\Database\Seeder;
|
||||
@@ -19,9 +18,7 @@ class InstallSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$date = Carbon::now()->format('Y-m-d H:i:s');
|
||||
$array = collect(config('convention.app'))->except([
|
||||
ConfigKey::Group,
|
||||
])->transform(function ($value, $key) use ($date) {
|
||||
$array = collect(config('convention.app'))->transform(function ($value, $key) use ($date) {
|
||||
return [
|
||||
'name' => $key,
|
||||
'value' => is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value,
|
||||
@@ -37,7 +34,7 @@ class InstallSeeder extends Seeder
|
||||
'name' => '系统默认组&游客组',
|
||||
'is_default' => true,
|
||||
'is_guest' => true,
|
||||
'configs' => config('convention.app.group'),
|
||||
'configs' => config('convention.group'),
|
||||
]);
|
||||
// 创建默认策略
|
||||
$group->strategies()->create([
|
||||
|
||||
5008
package-lock.json
generated
5008
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
"@tailwindcss/forms": "^0.4.0",
|
||||
"alpinejs": "^3.4.2",
|
||||
"autoprefixer": "^10.1.0",
|
||||
"axios": "^0.25",
|
||||
"axios": "^1.8",
|
||||
"blueimp-canvas-to-blob": "^3.29.0",
|
||||
"blueimp-file-upload": "^10.32.0",
|
||||
"blueimp-load-image": "^5.16.0",
|
||||
@@ -33,7 +33,7 @@
|
||||
"less-loader": "^10.2.0",
|
||||
"lodash": "^4.17.19",
|
||||
"masonry-layout": "^4.2.2",
|
||||
"postcss": "^8.2.1",
|
||||
"postcss": "^8.4.31",
|
||||
"postcss-import": "^14.0.1",
|
||||
"resolve-url-loader": "^4.0.0",
|
||||
"sweetalert2": "^11.3.3",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/css/markdown-css/github-markdown-light.css
Normal file
1
public/css/markdown-css/github-markdown-light.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -20,5 +20,6 @@
|
||||
"/js/echarts/echarts.min.js": "/js/echarts/echarts.min.js",
|
||||
"/js/masonry/masonry.pkgd.min.js": "/js/masonry/masonry.pkgd.min.js",
|
||||
"/js/imagesloaded/imagesloaded.pkgd.min.js": "/js/imagesloaded/imagesloaded.pkgd.min.js",
|
||||
"/css/markdown-css/github-markdown.css": "/css/markdown-css/github-markdown.css"
|
||||
"/css/markdown-css/github-markdown.css": "/css/markdown-css/github-markdown.css",
|
||||
"/css/markdown-css/github-markdown-light.css": "/css/markdown-css/github-markdown-light.css"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@import '~toastr';
|
||||
|
||||
[x-cloak] { display: none !important; }
|
||||
|
||||
.scrollbar-none::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ window.utils = {
|
||||
|| navigator.userAgent.match(/BlackBerry/i)
|
||||
|| navigator.userAgent.match(/Windows Phone/i)
|
||||
) {
|
||||
return true;
|
||||
return window.screen.width < 768;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="my-6 md:my-9">
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">概览</p>
|
||||
<div class="relative grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-red-700 truncate">
|
||||
{{ \App\Utils::shortenNumber(\App\Models\Image::query()->count()) }}
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<i class="fas fa-images text-red-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-lime-700 truncate">
|
||||
{{ \App\Utils::shortenNumber(\App\Models\Album::query()->count()) }}
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<i class="fas fa-tags text-lime-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-blue-700 truncate">
|
||||
{{ \App\Utils::shortenNumber(\App\Models\User::query()->count()) }}
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<i class="fas fa-users text-blue-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-cyan-700 truncate">
|
||||
{{ \App\Utils::formatSize(\App\Models\Image::query()->sum('size') * 1024) }}
|
||||
@@ -47,28 +47,28 @@
|
||||
<i class="fas fa-server text-cyan-600 text-2xl"></i>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-zinc-700 truncate">{{ \App\Utils::shortenNumber($numbers['today']) }}</p>
|
||||
<p class="text-md text-gray-600">今日上传</p>
|
||||
</div>
|
||||
<i class="fas fa-upload text-zinc-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-zinc-700 truncate">{{ \App\Utils::shortenNumber($numbers['yesterday']) }}</p>
|
||||
<p class="text-md text-gray-600">昨日上传</p>
|
||||
</div>
|
||||
<i class="fas fa-upload text-zinc-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-zinc-700 truncate">{{ \App\Utils::shortenNumber($numbers['week']) }}</p>
|
||||
<p class="text-md text-gray-600">本周上传</p>
|
||||
</div>
|
||||
<i class="fas fa-upload text-zinc-600 text-2xl"></i>
|
||||
</div>
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden">
|
||||
<div class="flex justify-between rounded-md bg-white p-3 overflow-hidden shadow-custom">
|
||||
<div class="flex flex-col justify-between space-y-2 w-[80%]">
|
||||
<p class="font-bold text-2xl text-zinc-700 truncate">{{ \App\Utils::shortenNumber($numbers['month']) }}</p>
|
||||
<p class="text-md text-gray-600">本月上传</p>
|
||||
@@ -78,12 +78,12 @@
|
||||
</div>
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">趋势</p>
|
||||
<div class="relative p-4 rounded-md bg-white h-80 mb-8" id="chart">
|
||||
<div class="relative p-4 rounded-md bg-white h-80 mb-8 shadow-custom" id="chart">
|
||||
<canvas></canvas>
|
||||
</div>
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">系统情况</p>
|
||||
<div class="relative rounded-md bg-white mb-8 overflow-hidden">
|
||||
<div class="relative rounded-md bg-white mb-8 overflow-hidden shadow-custom">
|
||||
<dl>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm font-medium text-gray-500">操作系统</dt>
|
||||
@@ -119,7 +119,7 @@
|
||||
</div>
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">软件信息</p>
|
||||
<div class="relative rounded-md bg-white mb-8 overflow-hidden">
|
||||
<div class="relative rounded-md bg-white mb-8 overflow-hidden shadow-custom">
|
||||
<dl>
|
||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm font-medium text-gray-500">软件版本</dt>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<form action="{{ route('admin.group.create') }}" method="POST">
|
||||
<div class="overflow-hidden rounded-md rounded-l-none">
|
||||
<div class="overflow-hidden rounded-md rounded-l-none shadow-custom">
|
||||
<div class="px-4 py-5 bg-white sm:p-6">
|
||||
<div data-tab="basic" class="grid grid-cols-6 gap-6">
|
||||
<div class="col-span-6">
|
||||
@@ -68,7 +68,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="path_naming_rule" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>路径命名规则</label>
|
||||
<label for="path_naming_rule" class="block text-sm font-medium text-gray-700">路径命名规则</label>
|
||||
<x-input type="text" name="configs[path_naming_rule]" id="path_naming_rule" autocomplete="path_naming_rule" placeholder="请输入路径命名规则" value="{{ $default->get('path_naming_rule') }}" />
|
||||
<a href="javascript:void(0)" class="mt-1 text-sm text-indigo-600" id="rename-rules"><i class="fas fa-pencil-alt text-xs"></i> 命名规则对照表</a>
|
||||
@include('admin.group.rules')
|
||||
@@ -79,6 +79,21 @@
|
||||
<x-input type="text" name="configs[file_naming_rule]" id="file_naming_rule" autocomplete="file_naming_rule" placeholder="请输入文件命名规则" value="{{ $default->get('file_naming_rule') }}" />
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="image_save_quality" class="block text-sm font-medium text-gray-700">图片保存质量</label>
|
||||
<x-input type="number" name="configs[image_save_quality]" id="image_save_quality" autocomplete="path_naming_rule" placeholder="请输入图片保存质量" value="{{ $default->get('image_save_quality', 100) }}" />
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="image_save_format" class="block text-sm font-medium text-gray-700">图片转换格式</label>
|
||||
<x-select id="configs[image_save_format]" name="configs[image_save_format]" autocomplete="image_save_format">
|
||||
<option value="">不转换格式</option>
|
||||
@foreach($default->get('accepted_file_suffixes') as $extension)
|
||||
<option value="{{ strtolower($extension) }}">{{ strtoupper($extension) }}</option>
|
||||
@endforeach
|
||||
</x-select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6">
|
||||
<x-fieldset title="是否默认" faq="设置默认后,新用户注册以后将会属于该默认角色组,且默认组只能有一个。">
|
||||
<x-switch id="is_default" name="is_default" value="1"></x-switch>
|
||||
@@ -116,9 +131,35 @@
|
||||
</div>
|
||||
<div class="col-span-6 mb-4">
|
||||
<x-fieldset title="审核驱动">
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]" name="configs[scan_configs][driver]" data-select="scan" value="aliyun" checked>阿里云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_tencent" name="configs[scan_configs][driver]" data-select="scan" value="tencent" checked>腾讯云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_aliyun" name="configs[scan_configs][driver]" data-select="scan" value="aliyun">阿里云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_nsfwjs" name="configs[scan_configs][driver]" data-select="scan" value="nsfwjs">NsfwJs</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="tencent">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][endpoint]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>Endpoint</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][endpoint]" id="configs[scan_configs][drivers][tencent][endpoint]" autocomplete="endpoint" placeholder="请输入 Endpoint" value="ims.tencentcloudapi.com" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][secret_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>SecretId</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][secret_id]" id="configs[scan_configs][drivers][tencent][secret_id]" autocomplete="secret_id" placeholder="请输入 SecretId" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][secret_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>SecretKey</label>
|
||||
<x-input type="password" name="configs[scan_configs][drivers][tencent][secret_key]" id="configs[scan_configs][drivers][tencent][secret_key]" autocomplete="secret_key" placeholder="请输入 SecretKey" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][region]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>地域</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][region]" id="configs[scan_configs][drivers][tencent][region]" autocomplete="region" placeholder="请输入地域节点,例如:ap-beijing" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][biz_type]" class="block text-sm font-medium text-gray-700">场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][biz_type]" id="configs[scan_configs][drivers][tencent][biz_type]" autocomplete="biz_type" placeholder="业务场景名称,可为空" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="aliyun">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
@@ -128,14 +169,14 @@
|
||||
<label for="configs[scan_configs][drivers][aliyun][access_key_secret]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeySecret</label>
|
||||
<x-input type="password" name="configs[scan_configs][drivers][aliyun][access_key_secret]" id="configs[scan_configs][drivers][aliyun][access_key_secret]" autocomplete="access_key_id" placeholder="请输入 AccessKeySecret" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][biz_type]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][biz_type]" id="configs[scan_configs][drivers][aliyun][biz_type]" autocomplete="biz_type" placeholder="请输入业务场景名称" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][region_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>地域节点</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][region_id]" id="configs[scan_configs][drivers][aliyun][region_id]" autocomplete="region_id" placeholder="请输入地域节点,例如:cn-shanghai" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][biz_type]" class="block text-sm font-medium text-gray-700">场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][biz_type]" id="configs[scan_configs][drivers][aliyun][biz_type]" autocomplete="biz_type" placeholder="请输入业务场景名称" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<x-fieldset title="审核场景">
|
||||
@foreach($scenes as $key => $scene)
|
||||
@@ -144,6 +185,22 @@
|
||||
</x-fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="nsfwjs">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][api_url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>接口地址</label>
|
||||
<x-input type="url" name="configs[scan_configs][drivers][nsfwjs][api_url]" id="configs[scan_configs][drivers][nsfwjs][api_url]" autocomplete="api_url" placeholder="请输入接口地址,http(s)://domain.com/classify" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][attr_name]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>属性名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][nsfwjs][attr_name]" id="configs[scan_configs][drivers][nsfwjs][attr_name]" autocomplete="attr_name" placeholder="接口的表单文件属性名" value="image" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][threshold]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>阈值</label>
|
||||
<x-input type="number" name="configs[scan_configs][drivers][nsfwjs][threshold]" id="configs[scan_configs][drivers][nsfwjs][threshold]" autocomplete="threshold" placeholder="取值 1-100" value="60" />
|
||||
<small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 阈值是指图片违规程度上限,取值 1-100 之间,数值越低审核越严格</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-tab="protection" class="hidden grid grid-cols-6 gap-6">
|
||||
@@ -162,9 +219,15 @@
|
||||
<div data-tab="watermark" class="hidden grid grid-cols-6 gap-6">
|
||||
<p class="mb-3 text-red-600 text-sm"><i class="fas fa-exclamation"></i> 开启水印功能前请注意考虑图片版权问题。</p>
|
||||
<div class="col-span-6 mb-4">
|
||||
<x-fieldset title="开启水印" faq="请注意,水印功能仅在开启了「原图保护」功能的情况下生效。">
|
||||
<x-fieldset title="开启水印" faq="请注意,水印模式为动态生成时,仅在开启了「原图保护」功能的情况下生效。">
|
||||
<x-switch id="configs[is_enable_watermark]" name="configs[is_enable_watermark]" value="1"></x-switch>
|
||||
</x-fieldset>
|
||||
<div class="col-span-6 mt-4 mb-4">
|
||||
<x-fieldset title="水印模式">
|
||||
<x-fieldset-radio id="configs[watermark_configs][mode]_overlay" name="configs[watermark_configs][mode]" value="{{ \App\Enums\Watermark\Mode::Overlay }}" checked>覆盖原图</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[watermark_configs][mode]_dynamic" name="configs[watermark_configs][mode]" value="{{ \App\Enums\Watermark\Mode::Dynamic }}">动态生成</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
<div class="col-span-6 mt-4 mb-4">
|
||||
<x-fieldset title="水印类型">
|
||||
<x-fieldset-radio id="configs[watermark_configs][driver]_font" name="configs[watermark_configs][driver]" data-select="watermark" value="font" checked>文字水印</x-fieldset-radio>
|
||||
@@ -214,7 +277,7 @@
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[watermark_configs][drivers][image][image]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>水印图片</label>
|
||||
<x-input type="text" name="configs[watermark_configs][drivers][image][image]" id="configs[watermark_configs][drivers][image][image]" autocomplete="image" placeholder="请输入水印路径,例如:images/lsky.png" />
|
||||
<small class="text-yellow-500">请将水印图片放置 {{ public_path() }} 目录下</small>
|
||||
<small class="text-yellow-500">请将水印图片放置 {{ storage_path('app/public') }} 目录下</small>
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[watermark_configs][drivers][image][position]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>水印位置</label>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<form action="{{ route('admin.group.update', ['id' => $group->id]) }}" method="POST">
|
||||
<div class="overflow-hidden rounded-md rounded-l-none">
|
||||
<div class="overflow-hidden rounded-md rounded-l-none shadow-custom">
|
||||
<div class="px-4 py-5 bg-white sm:p-6">
|
||||
<div data-tab="basic" class="grid grid-cols-6 gap-6">
|
||||
<div class="col-span-6">
|
||||
@@ -64,7 +64,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="path_naming_rule" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>路径命名规则</label>
|
||||
<label for="path_naming_rule" class="block text-sm font-medium text-gray-700">路径命名规则</label>
|
||||
<x-input type="text" name="configs[path_naming_rule]" id="path_naming_rule" autocomplete="path_naming_rule" placeholder="请输入路径命名规则" value="{{ $group->configs->get('path_naming_rule') }}" />
|
||||
<a href="javascript:void(0)" class="mt-1 text-sm text-indigo-600" id="rename-rules"><i class="fas fa-pencil-alt text-xs"></i> 命名规则对照表</a>
|
||||
@include('admin.group.rules')
|
||||
@@ -75,6 +75,21 @@
|
||||
<x-input type="text" name="configs[file_naming_rule]" id="file_naming_rule" autocomplete="file_naming_rule" placeholder="请输入文件命名规则" value="{{ $group->configs->get('file_naming_rule') }}" />
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="image_save_quality" class="block text-sm font-medium text-gray-700">图片保存质量</label>
|
||||
<x-input type="number" name="configs[image_save_quality]" id="image_save_quality" autocomplete="path_naming_rule" placeholder="请输入图片保存质量" value="{{ $group->configs->get('image_save_quality', 100) }}" />
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="image_save_format" class="block text-sm font-medium text-gray-700">图片转换格式</label>
|
||||
<x-select id="configs[image_save_format]" name="configs[image_save_format]" autocomplete="image_save_format">
|
||||
<option value="">不转换格式</option>
|
||||
@foreach($default->get('accepted_file_suffixes') as $extension)
|
||||
<option value="{{ strtolower($extension) }}" @selected($group->configs->get('image_save_format') === $extension)>{{ strtoupper($extension) }}</option>
|
||||
@endforeach
|
||||
</x-select>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6">
|
||||
<x-fieldset title="是否默认" faq="设置默认后,新用户注册以后将会属于该默认角色组,且默认组只能有一个。">
|
||||
<x-switch id="is_default" name="is_default" value="1" :checked="(bool)$group->is_default"></x-switch>
|
||||
@@ -112,9 +127,35 @@
|
||||
</div>
|
||||
<div class="col-span-6 mb-4">
|
||||
<x-fieldset title="审核驱动">
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]" name="configs[scan_configs][driver]" data-select="scan" value="aliyun" :checked="($group->configs['scan_configs']['driver'] ?? '') === 'aliyun'">阿里云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_tencent" name="configs[scan_configs][driver]" data-select="scan" value="tencent" :checked="($group->configs['scan_configs']['driver'] ?? '') === 'tencent'">腾讯云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_aliyun" name="configs[scan_configs][driver]" data-select="scan" value="aliyun" :checked="($group->configs['scan_configs']['driver'] ?? '') === 'aliyun'">阿里云</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[scan_configs][driver]_nsfwjs" name="configs[scan_configs][driver]" data-select="scan" value="nsfwjs" :checked="($group->configs['scan_configs']['driver'] ?? '') === 'nsfwjs'">NsfwJs</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="tencent">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][endpoint]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>Endpoint</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][endpoint]" id="configs[scan_configs][drivers][tencent][endpoint]" autocomplete="endpoint" placeholder="请输入 Endpoint" value="{{ $group->configs['scan_configs']['drivers']['tencent']['endpoint'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][secret_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>SecretId</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][secret_id]" id="configs[scan_configs][drivers][tencent][secret_id]" autocomplete="secret_id" placeholder="请输入 SecretId" value="{{ $group->configs['scan_configs']['drivers']['tencent']['secret_id'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][secret_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>SecretKey</label>
|
||||
<x-input type="password" name="configs[scan_configs][drivers][tencent][secret_key]" id="configs[scan_configs][drivers][tencent][secret_key]" autocomplete="secret_key" placeholder="请输入 SecretKey" value="{{ $group->configs['scan_configs']['drivers']['tencent']['secret_key'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][region]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>地域</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][region]" id="configs[scan_configs][drivers][tencent][region]" autocomplete="region" placeholder="请输入地域节点,例如:ap-beijing" value="{{ $group->configs['scan_configs']['drivers']['tencent']['region'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][tencent][biz_type]" class="block text-sm font-medium text-gray-700">场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][tencent][biz_type]" id="configs[scan_configs][drivers][tencent][biz_type]" autocomplete="biz_type" placeholder="业务场景名称,可为空" value="{{ $group->configs['scan_configs']['drivers']['tencent']['biz_type'] ?? '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="aliyun">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
@@ -124,14 +165,14 @@
|
||||
<label for="configs[scan_configs][drivers][aliyun][access_key_secret]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeySecret</label>
|
||||
<x-input type="password" name="configs[scan_configs][drivers][aliyun][access_key_secret]" id="configs[scan_configs][drivers][aliyun][access_key_secret]" autocomplete="access_key_id" placeholder="请输入 AccessKeySecret" value="{{ $group->configs['scan_configs']['drivers']['aliyun']['access_key_secret'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][biz_type]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][biz_type]" id="configs[scan_configs][drivers][aliyun][biz_type]" autocomplete="biz_type" placeholder="请输入业务场景名称" value="{{ $group->configs['scan_configs']['drivers']['aliyun']['biz_type'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][region_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>地域节点</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][region_id]" id="configs[scan_configs][drivers][aliyun][region_id]" autocomplete="region_id" placeholder="请输入地域节点,例如:cn-shanghai" value="{{ $group->configs['scan_configs']['drivers']['aliyun']['region_id'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][aliyun][biz_type]" class="block text-sm font-medium text-gray-700">场景名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][aliyun][biz_type]" id="configs[scan_configs][drivers][aliyun][biz_type]" autocomplete="biz_type" placeholder="请输入业务场景名称" value="{{ $group->configs['scan_configs']['drivers']['aliyun']['biz_type'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<x-fieldset title="审核场景">
|
||||
@foreach($scenes as $key => $scene)
|
||||
@@ -140,6 +181,22 @@
|
||||
</x-fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden mb-4" data-scan-driver="nsfwjs">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][api_url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>接口地址</label>
|
||||
<x-input type="url" name="configs[scan_configs][drivers][nsfwjs][api_url]" id="configs[scan_configs][drivers][nsfwjs][api_url]" autocomplete="api_url" placeholder="请输入接口地址,http(s)://domain.com/classify" value="{{ $group->configs['scan_configs']['drivers']['nsfwjs']['api_url'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][attr_name]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>属性名称</label>
|
||||
<x-input type="text" name="configs[scan_configs][drivers][nsfwjs][attr_name]" id="configs[scan_configs][drivers][nsfwjs][attr_name]" autocomplete="attr_name" placeholder="接口的表单文件属性名" value="{{ $group->configs['scan_configs']['drivers']['nsfwjs']['attr_name'] ?? '' }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[scan_configs][drivers][nsfwjs][threshold]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>阈值</label>
|
||||
<x-input type="number" name="configs[scan_configs][drivers][nsfwjs][threshold]" id="configs[scan_configs][drivers][nsfwjs][threshold]" autocomplete="threshold" placeholder="取值 1-100" value="{{ $group->configs['scan_configs']['drivers']['nsfwjs']['threshold'] ?? '' }}" />
|
||||
<small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 阈值是指图片违规程度上限,取值 1-100 之间,数值越低审核越严格</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-tab="protection" class="hidden grid grid-cols-6 gap-6">
|
||||
@@ -162,9 +219,15 @@
|
||||
<div data-tab="watermark" class="hidden grid grid-cols-6 gap-6">
|
||||
<p class="mb-3 text-red-600 text-sm"><i class="fas fa-exclamation"></i> 开启水印功能前请注意考虑图片版权问题。</p>
|
||||
<div class="col-span-6 mb-4">
|
||||
<x-fieldset title="开启水印" faq="请注意,水印功能仅在开启了「原图保护」功能的情况下生效。">
|
||||
<x-fieldset title="开启水印" faq="请注意,水印模式为动态生成时,仅在开启了「原图保护」功能的情况下生效。">
|
||||
<x-switch id="configs[is_enable_watermark]" name="configs[is_enable_watermark]" value="1" :checked="(bool)$group->configs->get('is_enable_watermark')"></x-switch>
|
||||
</x-fieldset>
|
||||
<div class="col-span-6 mt-4 mb-4">
|
||||
<x-fieldset title="水印模式">
|
||||
<x-fieldset-radio id="configs[watermark_configs][mode]_overlay" name="configs[watermark_configs][mode]" value="{{ \App\Enums\Watermark\Mode::Overlay }}" :checked="($group->configs['watermark_configs']['mode'] ?? '') == \App\Enums\Watermark\Mode::Overlay">覆盖原图</x-fieldset-radio>
|
||||
<x-fieldset-radio id="configs[watermark_configs][mode]_dynamic" name="configs[watermark_configs][mode]" value="{{ \App\Enums\Watermark\Mode::Dynamic }}" :checked="($group->configs['watermark_configs']['mode'] ?? '') == \App\Enums\Watermark\Mode::Dynamic">动态生成</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
<div class="col-span-6 mt-4 mb-4">
|
||||
<x-fieldset title="水印类型">
|
||||
<x-fieldset-radio id="configs[watermark_configs][driver]_font" name="configs[watermark_configs][driver]" data-select="watermark" value="font" :checked="($group->configs['watermark_configs']['driver'] ?? '') === 'font'">文字水印</x-fieldset-radio>
|
||||
@@ -214,7 +277,7 @@
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[watermark_configs][drivers][image][image]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>水印图片</label>
|
||||
<x-input type="text" name="configs[watermark_configs][drivers][image][image]" id="configs[watermark_configs][drivers][image][image]" autocomplete="image" placeholder="请输入水印路径,例如:images/lsky.png" value="{{ $group->configs['watermark_configs']['drivers']['image']['image'] ?? '' }}" />
|
||||
<small class="text-yellow-500">请将水印图片放置 {{ public_path() }} 目录下</small>
|
||||
<small class="text-yellow-500">请将水印图片放置 {{ storage_path('app/public') }} 目录下</small>
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[watermark_configs][drivers][image][position]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>水印位置</label>
|
||||
|
||||
@@ -194,8 +194,8 @@
|
||||
</dl>
|
||||
<dl>
|
||||
<div class="bg-gray-50 px-2 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||
<dt class="text-sm font-medium text-gray-500">剩余容量</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2 truncate">__surplus_capacity__</dd>
|
||||
<dt class="text-sm font-medium text-gray-500">已用容量</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2 truncate">__used_capacity__</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<dl>
|
||||
@@ -353,9 +353,10 @@
|
||||
|
||||
$('.item').click(function () {
|
||||
let image = $(this).data('json');
|
||||
let previewUrl = ['psd', 'tif'].indexOf(image.extension) === -1 ? image.url : image.thumb_url;
|
||||
let html = $('#image-tpl').html()
|
||||
.replace(/__id__/g, image.id)
|
||||
.replace(/__url__/g, image.url)
|
||||
.replace(/__url__/g, previewUrl)
|
||||
.replace(/__user_name__/g, image.user ? image.user.name+'('+image.user.email+')' : '游客')
|
||||
.replace(/__user_email__/g, image.user ? image.user.email : '-')
|
||||
.replace(/__album_name__/g, image.album ? image.album.name : '-')
|
||||
@@ -388,7 +389,7 @@
|
||||
.replace(/__name__/g, user.name)
|
||||
.replace(/__email__/g, user.email)
|
||||
.replace(/__capacity__/g, utils.formatSize(user.capacity * 1024))
|
||||
.replace(/__surplus_capacity__/g, utils.formatSize(user.images_sum_size * 1024))
|
||||
.replace(/__used_capacity__/g, utils.formatSize(user.images_sum_size * 1024))
|
||||
.replace(/__image_num__/g, user.image_num)
|
||||
.replace(/__album_num__/g, user.album_num)
|
||||
.replace(/__registered_ip__/g, user.registered_ip || '-')
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
@section('title', '系统设置')
|
||||
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="{{ asset('css/markdown-css/github-markdown.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/markdown-css/github-markdown-light.css') }}">
|
||||
@endpush
|
||||
|
||||
<x-app-layout>
|
||||
<div class="my-6 md:my-9">
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">通用</p>
|
||||
<form action="{{ route('admin.settings.save') }}">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4 shadow-custom">
|
||||
<div>
|
||||
<label for="app_name" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>应用名称</label>
|
||||
<x-input type="text" name="app_name" id="app_name" value="{{ $configs->get('app_name') }}" placeholder="请输入应用名称"/>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">控制</p>
|
||||
<form action="{{ route('admin.settings.save') }}">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4 shadow-custom">
|
||||
<x-fieldset title="是否启用注册" faq="启用或关闭系统注册功能">
|
||||
<x-switch name="is_enable_registration" value="1" :checked="(bool) $configs->get('is_enable_registration')" />
|
||||
</x-fieldset>
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">用户</p>
|
||||
<form action="{{ route('admin.settings.save') }}">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4 shadow-custom">
|
||||
<div>
|
||||
<label for="user_initial_capacity" class="block text-sm font-medium text-gray-700">用户初始容量(kb)</label>
|
||||
<x-input type="number" name="user_initial_capacity" id="user_initial_capacity" step="0.01" value="{{ $configs->get('user_initial_capacity') }}" placeholder="请输入用户初始容量(kb)"/>
|
||||
@@ -75,7 +75,7 @@
|
||||
</form>
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">邮件配置</p>
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4 shadow-custom">
|
||||
<x-fieldset title="发信驱动">
|
||||
<x-fieldset-radio id="mail[default]" name="mail[default]" data-select="mailer" value="smtp" checked>SMTP</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
@@ -127,7 +127,7 @@
|
||||
</div>
|
||||
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">系统升级</p>
|
||||
<div class="relative p-4 rounded-md bg-white mb-8">
|
||||
<div class="relative p-4 rounded-md bg-white mb-8 shadow-custom">
|
||||
<p id="check-update" class="text-gray-600 text-center p-4" style="display: none">
|
||||
<i class="fas fa-cog animate-spin"></i> 正在检查更新...
|
||||
</p>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="md:mt-0 md:col-span-2">
|
||||
<form action="{{ route('admin.strategy.create') }}" method="POST">
|
||||
<div class="overflow-hidden rounded-md">
|
||||
<div class="px-4 py-5 bg-white sm:p-6 space-y-4">
|
||||
<div class="px-4 py-5 bg-white sm:p-6 space-y-4 shadow-custom">
|
||||
<div class="col-span-6">
|
||||
<label class="block">
|
||||
<span class="text-gray-700">选择角色组</span>
|
||||
@@ -46,6 +46,10 @@
|
||||
本地储存的访问网址必须有根路径,例如:https://www.lsky.pro/uploads 中的 uploads 就是根路径,且根路径不能和其他策略重复。修改根路径直接影响已经上传并已使用的链接的访问。
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700">储存路径</label>
|
||||
@@ -60,6 +64,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
<x-input type="text" name="configs[access_key_id]" id="configs[access_key_id]" placeholder="请输入 AccessKeyId" />
|
||||
@@ -87,6 +95,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
<x-input type="text" name="configs[access_key_id]" id="configs[access_key_id]" placeholder="请输入 AccessKeyId" />
|
||||
@@ -110,6 +122,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[app_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AppId</label>
|
||||
<x-input type="text" name="configs[app_id]" id="configs[app_id]" placeholder="请输入 AppId" />
|
||||
@@ -129,6 +145,7 @@
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[bucket]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>储存桶名称</label>
|
||||
<x-input type="text" name="configs[bucket]" id="configs[bucket]" placeholder="请输入储存桶名称" />
|
||||
<small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 腾讯云储存桶名称由 名称+appid 组合,例如:test-125146xxxx,此处应该填写 test</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,6 +154,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKey</label>
|
||||
<x-input type="text" name="configs[access_key]" id="configs[access_key]" placeholder="请输入 AccessKey" />
|
||||
@@ -156,6 +177,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[service]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>服务名称</label>
|
||||
<x-input type="text" name="configs[service]" id="configs[service]" placeholder="请输入服务名称" />
|
||||
@@ -175,11 +200,13 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="/" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="/" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
|
||||
@@ -221,11 +248,13 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="/" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="/" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
|
||||
@@ -259,10 +288,26 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<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="请输入连接地址" />
|
||||
</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">
|
||||
<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="请输入用户名" />
|
||||
@@ -278,6 +323,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKey</label>
|
||||
<x-input type="text" name="configs[access_key]" id="configs[access_key]" placeholder="请输入 AccessKey" />
|
||||
@@ -298,6 +347,11 @@
|
||||
<label for="configs[bucket]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>Bucket 名称</label>
|
||||
<x-input type="text" name="configs[bucket]" id="configs[bucket]" placeholder="请输入 Bucket 名称" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<label for="configs[bucket_endpoint]" class="block text-sm font-medium mb-2 text-gray-700">BucketEndpoint</label>
|
||||
<x-switch id="configs[bucket_endpoint]" name="configs[bucket_endpoint]" value="1"></x-switch>
|
||||
<p><small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 开启此选项后将会直接以「连接地址」作为数据交互传输域名,否则可能会以桶名称拼接域名(例如:http://桶名称.连接地址.com)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4 py-3 bg-gray-50 text-right sm:px-6">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="md:mt-0 md:col-span-2">
|
||||
<form action="{{ route('admin.strategy.update', ['id' => $strategy->id]) }}" method="POST">
|
||||
<div class="overflow-hidden rounded-md">
|
||||
<div class="px-4 py-5 bg-white sm:p-6 space-y-4">
|
||||
<div class="px-4 py-5 bg-white sm:p-6 space-y-4 shadow-custom">
|
||||
|
||||
<div class="col-span-6">
|
||||
<label class="block">
|
||||
@@ -50,6 +50,10 @@
|
||||
本地储存的访问网址必须有根路径,例如:https://www.lsky.pro/uploads 中的 uploads 就是根路径,且根路径不能和其他策略重复。修改根路径直接影响已经上传并已使用的链接的访问。
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700">储存路径</label>
|
||||
@@ -66,6 +70,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
<x-input type="text" name="configs[access_key_id]" id="configs[access_key_id]" placeholder="请输入 AccessKeyId" value="{{ $strategy->configs->get('access_key_id') }}" />
|
||||
@@ -95,6 +103,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKeyId</label>
|
||||
<x-input type="text" name="configs[access_key_id]" id="configs[access_key_id]" placeholder="请输入 AccessKeyId" value="{{ $strategy->configs->get('access_key_id') }}" />
|
||||
@@ -120,6 +132,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[app_id]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AppId</label>
|
||||
<x-input type="text" name="configs[app_id]" id="configs[app_id]" placeholder="请输入 AppId" value="{{ $strategy->configs->get('app_id') }}" />
|
||||
@@ -139,6 +155,7 @@
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[bucket]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>储存桶名称</label>
|
||||
<x-input type="text" name="configs[bucket]" id="configs[bucket]" placeholder="请输入储存桶名称" value="{{ $strategy->configs->get('bucket') }}" />
|
||||
<small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 腾讯云储存桶名称由 名称+appid 组合,例如:test-125146xxxx,此处应该填写 test</>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -149,6 +166,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKey</label>
|
||||
<x-input type="text" name="configs[access_key]" id="configs[access_key]" placeholder="请输入 AccessKey" value="{{ $strategy->configs->get('access_key') }}" />
|
||||
@@ -170,6 +191,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[service]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>服务名称</label>
|
||||
<x-input type="text" name="configs[service]" id="configs[service]" placeholder="请输入服务名称" value="{{ $strategy->configs->get('service') }}" />
|
||||
@@ -191,11 +216,13 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="{{ $strategy->configs->get('root') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="{{ $strategy->configs->get('root') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
|
||||
@@ -239,11 +266,13 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="{{ $strategy->configs->get('root') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3 mb-4">
|
||||
<label for="configs[root]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>根目录</label>
|
||||
<x-input type="text" name="configs[root]" id="configs[root]" autocomplete="text" placeholder="请输入根目录路径" value="{{ $strategy->configs->get('root') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
|
||||
@@ -279,10 +308,26 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<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') }}" />
|
||||
</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">
|
||||
<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') }}" />
|
||||
@@ -300,6 +345,10 @@
|
||||
<label for="configs[url]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>访问域名</label>
|
||||
<x-input type="url" name="configs[url]" id="configs[url]" placeholder="请输入图片访问域名 http(s)://" value="{{ $strategy->configs->get('url') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[queries]" class="block text-sm font-medium text-gray-700">URL Queries</label>
|
||||
<x-input type="text" name="configs[queries]" id="configs[queries]" placeholder="请输入 url 额外参数" value="{{ $strategy->configs->get('queries') }}" />
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2 mb-4">
|
||||
<label for="configs[access_key]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>AccessKey</label>
|
||||
<x-input type="text" name="configs[access_key]" id="configs[access_key]" placeholder="请输入 AccessKey" value="{{ $strategy->configs->get('access_key') }}" />
|
||||
@@ -320,6 +369,11 @@
|
||||
<label for="configs[bucket]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>储存桶名称</label>
|
||||
<x-input type="text" name="configs[bucket]" id="configs[bucket]" placeholder="请输入 Bucket 名称" value="{{ $strategy->configs->get('bucket') }}" />
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<label for="configs[bucket_endpoint]" class="block text-sm font-medium mb-2 text-gray-700">BucketEndpoint</label>
|
||||
<x-switch id="configs[bucket_endpoint]" name="configs[bucket_endpoint]" value="1" :checked="(bool)$strategy->configs->get('bucket_endpoint')"></x-switch>
|
||||
<p><small class="text-gray-500"><i class="fas fa-exclamation-circle"></i> 开启此选项后将会直接以「连接地址」作为数据交互传输域名,否则可能会以桶名称拼接域名(例如:http://桶名称.连接地址.com)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||
<form action="{{ route('admin.user.update', ['id' => $user->id ?: '0']) }}" method="POST">
|
||||
<div class="overflow-hidden rounded-md">
|
||||
<div class="overflow-hidden rounded-md shadow-custom">
|
||||
<div class="px-4 py-5 bg-white sm:p-6">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
<div class="col-span-6">
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
});
|
||||
$('[data-operate="delete"]').click(function () {
|
||||
Swal.fire({
|
||||
title: `确认删除用户【${$(this).closest('tr').find('td.name').text()}】吗?`,
|
||||
title: `确认删除用户【${$(this).closest('tr').data('json').name}】吗?`,
|
||||
text: "⚠️注意,删除后不可恢复,且该用户的图片将会变成游客身份!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<x-app-layout>
|
||||
<div class="my-6 md:my-9">
|
||||
<p class="text-xl mb-2 text-gray-800 font-semibold">接口说明</p>
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10">
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10 shadow-custom">
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">接口URL</p>
|
||||
<x-code>{{ request()->getSchemeAndHttpHost() }}/api/v1</x-code>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">验证方式</p>
|
||||
<div class="my-2 text-sm bg-white rounded-md p-4 overflow-x-auto">
|
||||
当前版本接口采用 「HTTP 基本验证」的方式验证授权,获取到 token 后,通过设置请求 header 标头来验证请求,例如:
|
||||
当前版本接口采用 「HTTP 基本验证」的方式验证授权,获取到 token 后,通过设置请求 header 标头来验证请求(Bearer Token),例如:
|
||||
<b class="block my-2 text-gray-600 text-sm">"Authorization": "Bearer 1|1bJbwlqBfnggmOMEZqXT5XusaIwqiZjCDs7r1Ob5"</b>
|
||||
<p class="text-sm">如果未设置 Authorization 的情况下请求上传接口,将会被视为游客上传。</p>
|
||||
</div>
|
||||
@@ -118,7 +118,7 @@
|
||||
</div>
|
||||
|
||||
<p class="text-xl mb-2 text-gray-800 font-semibold">授权相关</p>
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10">
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10 shadow-custom">
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">生成 Token</p>
|
||||
<x-code><span class="text-green-500 select-none">POST </span>/tokens</x-code>
|
||||
@@ -319,7 +319,7 @@
|
||||
</div>
|
||||
|
||||
<p class="text-xl mb-2 text-gray-800 font-semibold">策略相关</p>
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10">
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10 shadow-custom">
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">策略列表</p>
|
||||
<x-code><span class="text-sky-500 select-none">GET </span>/strategies</x-code>
|
||||
@@ -404,7 +404,7 @@
|
||||
</div>
|
||||
|
||||
<p class="text-xl mb-2 text-gray-800 font-semibold">图片相关</p>
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10">
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10 shadow-custom">
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">上传图片</p>
|
||||
<x-code><span class="text-green-500 select-none">POST </span>/upload</x-code>
|
||||
@@ -822,7 +822,7 @@
|
||||
</div>
|
||||
|
||||
<p class="text-xl mb-2 text-gray-800 font-semibold">相册相关</p>
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10">
|
||||
<div class="space-y-4 bg-white p-3 rounded-md mb-10 shadow-custom">
|
||||
<div>
|
||||
<p class="text-lg text-gray-700 font-semibold">相册列表</p>
|
||||
<x-code><span class="text-sky-500 select-none">GET </span>/albums</x-code>
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
@if(\App\Utils::config(\App\Enums\ConfigKey::SiteNotice))
|
||||
@if($_is_notice)
|
||||
|
||||
<x-modal id="notice-modal">
|
||||
<div class="markdown-body">
|
||||
{!! (new Parsedown())->parse(\App\Utils::config(\App\Enums\ConfigKey::SiteNotice)) !!}
|
||||
</div>
|
||||
<div class="mt-4 w-full text-right">
|
||||
<x-button type="button" @click="$store.modal.close('notice-modal');">OK</x-button>
|
||||
</div>
|
||||
</x-modal>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
if (! sessionStorage.getItem('noticed')) {
|
||||
Alpine.store('modal').open('notice-modal')
|
||||
sessionStorage.setItem('noticed', '1');
|
||||
let noticeHash = "{{ md5(\App\Utils::config(\App\Enums\ConfigKey::SiteNotice)) }}";
|
||||
|
||||
let openNotice = function () {
|
||||
Alpine.store('modal').open('notice-modal');
|
||||
localStorage.setItem('notice-hash', noticeHash);
|
||||
}
|
||||
|
||||
if (localStorage.getItem('notice-hash') !== noticeHash) {
|
||||
setTimeout(function () {
|
||||
openNotice();
|
||||
}, 1000)
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{ $logo }}
|
||||
</div>
|
||||
|
||||
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white overflow-hidden sm:rounded-lg">
|
||||
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white overflow-hidden sm:rounded-lg shadow-custom">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="rounded w-full overflow-hidden">
|
||||
<div class="rounded w-full overflow-hidden shadow-custom">
|
||||
<div class="px-4 py-3 bg-slate-50 text-gray-800 text-md truncate">{{ $title }}</div>
|
||||
<div class="bg-white w-full">
|
||||
{{ $content }}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-500 hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500']) }}>
|
||||
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex justify-center py-2 px-4 text-sm font-medium rounded-md text-gray-600 bg-black/10 hover:bg-black/20 hover:text-gray-700']) }}>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<a {{$attributes->merge(['class' => 'block px-4 py-2 active:bg-gray-100 text-sm text-gray-700', 'role' => 'menuitem', 'tabindex' => '-1']) }}>{{ $slot }}</a>
|
||||
<a {{$attributes->merge(['class' => 'block px-4 py-2 active:bg-gray-100 text-sm text-gray-700 truncate hover:bg-sky-500 hover:text-white', 'role' => 'menuitem', 'tabindex' => '-1']) }}>{{ $slot }}</a>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
<div x-show="open"
|
||||
x-transition:enter="transition ease-out duration-200"
|
||||
x-transition:enter-start="transform opacity-0 scale-95"
|
||||
x-transition:enter-end="transform opacity-100 scale-100"
|
||||
x-transition:enter-start="transform opacity-0 translate-y-9"
|
||||
x-transition:enter-end="transform opacity-100 translate-y-0"
|
||||
x-transition:leave="transition ease-in duration-75"
|
||||
x-transition:leave-start="transform opacity-100 scale-100"
|
||||
x-transition:leave-end="transform opacity-0 scale-95"
|
||||
class="absolute z-[9] {{ $classes[$direction] }} mt-2 w-48 rounded-md shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"
|
||||
x-transition:leave-start="transform opacity-100 translate-y-0"
|
||||
x-transition:leave-end="transform opacity-0 translate-y-9"
|
||||
class="absolute z-[9] {{ $classes[$direction] }} mt-2 w-48 rounded-md shadow-[10px_0px_50px_-15px_rgba(0,0,0,0.25)] py-1 bg-white "
|
||||
role="menu"
|
||||
aria-orientation="vertical"
|
||||
aria-labelledby="user-menu-button"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@props(['id' => 'modal'])
|
||||
|
||||
<div {{ $attributes->merge(['class' => "fixed z-10 inset-0 overflow-y-auto"]) }} role="dialog" aria-modal="true" x-data x-cloak x-show="$store.modal.isOpen('{{ $id }}')">
|
||||
<div {{ $attributes->merge(['id' => $id, 'class' => "fixed z-10 inset-0 overflow-y-auto"]) }} role="dialog" aria-modal="true" x-data x-cloak x-show="$store.modal.isOpen('{{ $id }}')">
|
||||
<div class="flex min-h-screen text-center md:block md:px-2 lg:px-4" style="font-size: 0">
|
||||
<div x-transition:enter="transition ease-out duration-300"
|
||||
x-transition:enter-start="transform opacity-0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="flex flex-col">
|
||||
<div class="-my-2 sm:-mx-6 lg:-mx-8">
|
||||
<div class="py-2 align-middle inline-block w-full sm:px-6 lg:px-8">
|
||||
<div class="overflow-x-auto sm:rounded-lg bg-white w-full">
|
||||
<div class="overflow-x-auto sm:rounded-lg bg-white w-full shadow-custom">
|
||||
<table class="min-w-full w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -45,6 +45,12 @@
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="mt-6 text-sm text-gray-500">
|
||||
<p><i class="fas fa-exclamation-circle"></i> 请确保<b>数据库版本</b>达到要求。</p>
|
||||
<p><i class="fas fa-exclamation-circle"></i> 请确保程序<b>目录、文件的权限</b>设置正确。</p>
|
||||
<p><i class="fas fa-exclamation-circle"></i> 出现安装拓展、启用函数后未生效,请尝试<b>重启 PHP</b>。</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 text-right">
|
||||
@if($status)
|
||||
<a href="javascript:void(0)" id="next" class="rounded-md px-4 py-2 bg-blue-500 text-white">下一步</a>
|
||||
|
||||
@@ -15,11 +15,8 @@
|
||||
@stack('styles')
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="{{ asset('css/common.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<link rel="stylesheet" href="{{ asset('css/common.css') }}?t=20220817">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}?t=20220817">
|
||||
</head>
|
||||
<body class="font-sans antialiased overflow-hidden">
|
||||
<div class="min-h-screen bg-gray-100" x-data x-cloak>
|
||||
@@ -46,6 +43,8 @@
|
||||
</x-container>
|
||||
</div>
|
||||
</body>
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}?t=20220817"></script>
|
||||
@include('common.notice')
|
||||
<script>
|
||||
// 开关组件默认值
|
||||
|
||||
@@ -15,17 +15,16 @@
|
||||
@stack('styles')
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="{{ asset('css/common.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}"></script>
|
||||
<link rel="stylesheet" href="{{ asset('css/common.css') }}?t=20220817">
|
||||
<link rel="stylesheet" href="{{ asset('css/app.css') }}?t=20220817">
|
||||
</head>
|
||||
<body class="font-sans antialiased">
|
||||
<div class="min-h-screen text-gray-900 bg-gray-100">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</body>
|
||||
<!-- Scripts -->
|
||||
<script src="{{ asset('js/app.js') }}?t=20220817"></script>
|
||||
@if(file_exists(public_path('js/custom.js')))
|
||||
<script src="{{ asset('js/custom.js') }}"></script>
|
||||
@endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<header class="transition-all duration-300 w-full h-14 bg-gray-700 text-white flex justify-center fixed top-0 z-[9]">
|
||||
<header class="transition-all duration-300 w-full h-14 bg-gray-700 text-white flex justify-center fixed top-0 z-[9] shadow-[0_15px_10px_-15px_rgba(0,0,0,0.3)]">
|
||||
<x-container class="w-full px-6 flex justify-between items-center">
|
||||
<div class="flex justify-start items-center max-w-[70%]">
|
||||
<a href="javascript:void(0)" @click="$store.sidebar.toggle()" class="w-6 h-6 p-4 rounded-full sm:hidden -ml-1 mr-4 flex justify-center items-center">
|
||||
@@ -7,9 +7,8 @@
|
||||
<a href="" class="text-xl truncate" id="header-title">@yield('title', \App\Utils::config(\App\Enums\ConfigKey::AppName))</a>
|
||||
</div>
|
||||
<div class="flex justify-end items-center space-x-4">
|
||||
@if($_group->strategies->isNotEmpty())
|
||||
@include('layouts.strategies')
|
||||
@endif
|
||||
@includeWhen($_is_notice, 'layouts.notice')
|
||||
@includeWhen($_group->strategies->isNotEmpty(), 'layouts.strategies')
|
||||
@include('layouts.user-nav')
|
||||
</div>
|
||||
</x-container>
|
||||
|
||||
15
resources/views/layouts/notice.blade.php
Normal file
15
resources/views/layouts/notice.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
@if($_is_notice)
|
||||
<button type="button" class="bg-gray-800 flex items-center text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white" id="open-notice" aria-expanded="false" aria-haspopup="true">
|
||||
<div class="h-8 w-8 rounded-full flex items-center justify-center bg-white">
|
||||
<i class="fas fa-envelope text-gray-900"></i>
|
||||
</div>
|
||||
<span class="px-2 sm:block hidden">公告</span>
|
||||
</button>
|
||||
@push('scripts')
|
||||
<script>
|
||||
$('#open-notice').click(function () {
|
||||
openNotice();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
@@ -1,7 +1,6 @@
|
||||
<nav class="transition-all duration-300 -left-64 sm:left-0 h-screen sm:w-64 bg-white fixed z-10 shadow-lg sm:shadow-none" :class="{
|
||||
'-left-64': ! $store.sidebar.open,
|
||||
'left-0': $store.sidebar.open,
|
||||
'w-3/4': $store.sidebar.open
|
||||
<nav class="transition-all duration-300 -left-[600px] sm:left-0 w-3/4 sm:w-64 h-screen bg-white fixed z-10 shadow-custom" :class="{
|
||||
'-left-[600px]': ! $store.sidebar.open,
|
||||
'left-0': $store.sidebar.open
|
||||
}">
|
||||
<div class="px-6 h-14 flex justify-between sm:justify-center items-center bg-gray-600 text-white text-xl">
|
||||
<a href="/" class="truncate">{{ \App\Utils::config(\App\Enums\ConfigKey::AppName) }}</a>
|
||||
@@ -81,9 +80,9 @@
|
||||
|
||||
<div id="capacity-progress" class="flex flex-col space-y-2 mb-5 px-5 w-full mt-10">
|
||||
<p class="text-gray-700 text-sm">容量使用</p>
|
||||
<progress class="w-full h-1.5" value="{{ Auth::user()->images->sum('size') }}" max="{{ Auth::user()->capacity }}"></progress>
|
||||
<progress class="w-full h-1.5" value="{{ Auth::user()->use_capacity }}" max="{{ Auth::user()->capacity }}"></progress>
|
||||
<p class="text-gray-700 text-sm truncate">
|
||||
<span class="used">{{ \App\Utils::formatSize(Auth::user()->images->sum('size') * 1024) }}</span>
|
||||
<span class="used">{{ \App\Utils::formatSize(Auth::user()->use_capacity * 1024) }}</span>
|
||||
/
|
||||
<span class="total">{{ \App\Utils::formatSize(Auth::user()->capacity * 1024) }}</span>
|
||||
</p>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
let defaultStrategy = {{ Auth::check() ? Auth::user()->configs[\App\Enums\UserConfigKey::DefaultStrategy] : 0 }} || (localStorage.getItem('strategy') || 0);
|
||||
let defaultStrategy = {{ Auth::check() ? Auth::user()->configs->get('default_strategy') : 0 }} || (localStorage.getItem('strategy') || 0);
|
||||
let setStrategy = function (id) {
|
||||
let isSelected = false;
|
||||
$('#strategies a').each(function () {
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
<x-app-layout>
|
||||
<div class="my-6 md:my-9">
|
||||
<div class="space-y-6 md:space-y-0 md:grid md:grid-cols-2 xl:grid-cols-4 md:gap-x-4 xl:gap-x-8 md:gap-y-4 xl:gap-y-8">
|
||||
<div class="flex bg-white rounded p-4 space-x-4">
|
||||
<div class="flex bg-white rounded p-4 space-x-4 shadow-custom">
|
||||
<i class="fas fa-images text-amber-500 text-5xl"></i>
|
||||
<div class="flex flex-col">
|
||||
<p class="text-gray-700 text-sm">图片数量</p>
|
||||
<p class="text-gray-800 font-semibold text-xl">{{ $user->image_num }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex bg-white rounded p-4 space-x-4">
|
||||
<div class="flex bg-white rounded p-4 space-x-4 shadow-custom">
|
||||
<i class="fas fa-hdd text-red-500 text-5xl"></i>
|
||||
<div class="flex flex-col">
|
||||
<p class="text-gray-700 text-sm">可用储存</p>
|
||||
<p class="text-gray-800 font-semibold text-xl">{{ \App\Utils::formatSize(($user->capacity - $user->images->sum('size')) * 1024) }}</p>
|
||||
<p class="text-gray-800 font-semibold text-xl">{{ \App\Utils::formatSize(($user->capacity - $user->use_capacity) * 1024) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex bg-white rounded p-4 space-x-4">
|
||||
<div class="flex bg-white rounded p-4 space-x-4 shadow-custom">
|
||||
<i class="fas fa-hdd text-green-500 text-5xl"></i>
|
||||
<div class="flex flex-col">
|
||||
<p class="text-gray-700 text-sm">使用储存</p>
|
||||
<p class="text-gray-800 font-semibold text-xl">{{ \App\Utils::formatSize($user->images->sum('size') * 1024) }}</p>
|
||||
<p class="text-gray-800 font-semibold text-xl">{{ \App\Utils::formatSize($user->use_capacity * 1024) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex bg-white rounded p-4 space-x-4">
|
||||
<div class="flex bg-white rounded p-4 space-x-4 shadow-custom">
|
||||
<i class="fas fa-hdd text-emerald-500 text-5xl"></i>
|
||||
<div class="flex flex-col">
|
||||
<p class="text-gray-700 text-sm">总储存</p>
|
||||
|
||||
@@ -116,8 +116,8 @@
|
||||
<form class="w-full space-y-2" action="/user/albums">
|
||||
<input type="text" class="w-full rounded px-2.5 py-1.5 text-sm border-0 bg-gray-200" name="name" placeholder="请输入名称">
|
||||
<textarea class="w-full resize-y rounded-md text-sm border-0 bg-gray-200" name="intro" placeholder="请输入简介"></textarea>
|
||||
<button class="w-full py-1 px-2 bg-indigo-500 text-white text-sm text-center tracking-wider font-semibold rounded-md">创建相册</button>
|
||||
</form>
|
||||
<a href="javascript:void(0)" class="w-full py-1 px-2 bg-indigo-500 text-white text-sm text-center tracking-wider font-semibold rounded-md">创建相册</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
@@ -139,8 +139,8 @@
|
||||
<form class="w-full space-y-2" action="/user/albums/__id__">
|
||||
<input type="text" class="w-full rounded px-2.5 py-1.5 text-sm border-0 bg-gray-200" placeholder="请输入名称" name="name" value="__name__">
|
||||
<textarea class="w-full resize-y rounded-md text-sm border-0 bg-gray-200" name="intro" placeholder="请输入简介">__intro__</textarea>
|
||||
<button class="w-full py-1 px-2 bg-indigo-500 text-white text-sm text-center tracking-wider font-semibold rounded-md">确认修改</button>
|
||||
</form>
|
||||
<a href="javascript:void(0)" class="w-full py-1 px-2 bg-indigo-500 text-white text-sm text-center tracking-wider font-semibold rounded-md">确认修改</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -269,14 +269,14 @@
|
||||
for (const i in images) {
|
||||
html += $('#images-item-tpl').html()
|
||||
.replace(/__id__/g, images[i].id)
|
||||
.replace(/__name__/g, images[i].filename)
|
||||
.replace(/__name__/g, images[i].filename.replace(/\$/g, '$$$$'))
|
||||
.replace(/__human_date__/g, images[i].human_date)
|
||||
.replace(/__date__/g, images[i].date)
|
||||
.replace(/__url__/g, images[i].url)
|
||||
.replace(/__thumb_url__/g, images[i].thumb_url)
|
||||
.replace(/__width__/g, images[i].width)
|
||||
.replace(/__height__/g, images[i].height)
|
||||
.replace(/__json__/g, JSON.stringify(images[i]))
|
||||
.replace(/__json__/g, JSON.stringify(images[i]).replace(/\$/g, '$$$$'))
|
||||
}
|
||||
|
||||
$photos.append(html);
|
||||
@@ -410,8 +410,9 @@
|
||||
});
|
||||
|
||||
// confirm create
|
||||
$albums.off('click', CREATE_ID + ' a').on('click', CREATE_ID + ' a', function (e) {
|
||||
let $form = $(this).siblings('form');
|
||||
$albums.off('submit', CREATE_ID + ' form').on('submit', CREATE_ID + ' form', function (e) {
|
||||
e.preventDefault();
|
||||
let $form = $(this);
|
||||
axios.post($form.attr('action'), $form.serialize()).then(response => {
|
||||
let $errorMessage = $albums.find(CREATE_ID + ' .error-message').html('').hide();
|
||||
if (response.data.status) {
|
||||
@@ -424,8 +425,9 @@
|
||||
});
|
||||
|
||||
// confirm update
|
||||
$albums.off('click', UPDATE_ID + ' a').on('click', UPDATE_ID + ' a', function (e) {
|
||||
let $form = $(this).siblings('form');
|
||||
$albums.off('submit', UPDATE_ID + ' form').on('submit', UPDATE_ID + ' form', function (e) {
|
||||
e.preventDefault();
|
||||
let $form = $(this);
|
||||
axios.put($form.attr('action'), $form.serialize()).then(response => {
|
||||
let $errorMessage = $albums.find(UPDATE_ID + ' .error-message').html('').hide();
|
||||
if (response.data.status) {
|
||||
@@ -684,8 +686,8 @@
|
||||
let content = $('#image-detail-tpl').html()
|
||||
.replace(/__album_name__/g, image.album ? image.album.name : '-')
|
||||
.replace(/__strategy_name__/g, image.strategy ? image.strategy.name : '-')
|
||||
.replace(/__filename__/g, image.filename)
|
||||
.replace(/__origin_name__/g, image.origin_name)
|
||||
.replace(/__filename__/g, image.filename.replace(/\$/g, '$$$$'))
|
||||
.replace(/__origin_name__/g, image.origin_name.replace(/\$/g, '$$$$'))
|
||||
.replace(/__size__/g, utils.formatSize(image.size * 1024))
|
||||
.replace(/__mimetype__/g, image.mimetype)
|
||||
.replace(/__width__/g, image.width)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<p class="mb-3 font-semibold text-lg text-gray-700">基础设置</p>
|
||||
<form action="{{ route('settings.update') }}" method="POST">
|
||||
@csrf
|
||||
<div class="overflow-hidden sm:rounded-md">
|
||||
<div class="overflow-hidden sm:rounded-md shadow-custom">
|
||||
<div class="px-3 py-4 bg-white sm:p-6">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
@@ -24,7 +24,7 @@
|
||||
@if(Auth::user()->group)
|
||||
<option value="0">未选择</option>
|
||||
@foreach(Auth::user()->group->strategies as $strategy)
|
||||
<option value="{{ $strategy->id }}" @selected(Auth::user()->configs->get(\App\Enums\UserConfigKey::DefaultStrategy) == $strategy->id)>{{ $strategy->name }}</option>
|
||||
<option value="{{ $strategy->id }}" @selected(Auth::user()->configs->get('default_strategy') == $strategy->id)>{{ $strategy->name }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
<option value="0">系统默认</option>
|
||||
@@ -38,7 +38,7 @@
|
||||
@if(Auth::user()->albums->isNotEmpty())
|
||||
<option value="0">未选择</option>
|
||||
@foreach(Auth::user()->albums as $album)
|
||||
<option value="{{ $album->id }}" @selected(Auth::user()->configs->get(\App\Enums\UserConfigKey::DefaultAlbum) == $album->id)>{{ $album->name }}</option>
|
||||
<option value="{{ $album->id }}" @selected(Auth::user()->configs->get('default_album') == $album->id)>{{ $album->name }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
<option value="0">没有可用相册</option>
|
||||
@@ -53,20 +53,27 @@
|
||||
|
||||
<div class="col-span-6">
|
||||
<label for="password" class="block text-sm font-medium text-gray-700">密码</label>
|
||||
<x-input type="password" name="password" id="password" placeholder="不修改请留空" autocomplete="password" />
|
||||
<x-input type="password" name="password" id="password" placeholder="不修改请留空" autocomplete="new-password" />
|
||||
</div>
|
||||
|
||||
<div class="col-span-6">
|
||||
<x-fieldset title="是否自动清除预览" faq="设置上传时,文件上传完成以后是否自动清除预览图片">
|
||||
<x-fieldset-radio id="is_auto_clear_preview_yes" name="configs[is_auto_clear_preview]" value="1" :checked="Auth::user()->configs->get(\App\Enums\UserConfigKey::IsAutoClearPreview)">是</x-fieldset-radio>
|
||||
<x-fieldset-radio id="is_auto_clear_preview_no" name="configs[is_auto_clear_preview]" value="0" :checked="! Auth::user()->configs->get(\App\Enums\UserConfigKey::IsAutoClearPreview)">否</x-fieldset-radio>
|
||||
<x-fieldset-radio id="is_auto_clear_preview_yes" name="configs[is_auto_clear_preview]" value="1" :checked="Auth::user()->configs->get('is_auto_clear_preview')">是</x-fieldset-radio>
|
||||
<x-fieldset-radio id="is_auto_clear_preview_no" name="configs[is_auto_clear_preview]" value="0" :checked="! Auth::user()->configs->get('is_auto_clear_preview')">否</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6">
|
||||
<x-fieldset title="图片粘贴后动作" faq="设置上传页面粘贴图片后的动作">
|
||||
<x-fieldset-radio id="pasted_action_upload" name="configs[pasted_action]" value="{{ \App\Enums\PastedAction::Upload }}" :checked="Auth::user()->configs->get('pasted_action') == \App\Enums\PastedAction::Upload">直接上传</x-fieldset-radio>
|
||||
<x-fieldset-radio id="pasted_action_waiting" name="configs[pasted_action]" value="{{ \App\Enums\PastedAction::Waiting }}" :checked="Auth::user()->configs->get('pasted_action') == \App\Enums\PastedAction::Waiting">等待上传</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6">
|
||||
<x-fieldset title="图片默认权限" faq="设置上传的图片默认的权限(公开还是私有,公开的图片将会出现在画廊中,你也可以通过图片管理单独设置权限)">
|
||||
<x-fieldset-radio id="private" name="configs[default_permission]" value="{{ \App\Enums\ImagePermission::Private }}" :checked="Auth::user()->configs->get(\App\Enums\UserConfigKey::DefaultPermission) == \App\Enums\ImagePermission::Private">私有</x-fieldset-radio>
|
||||
<x-fieldset-radio id="public" name="configs[default_permission]" value="{{ \App\Enums\ImagePermission::Public }}" :checked="Auth::user()->configs->get(\App\Enums\UserConfigKey::DefaultPermission) == \App\Enums\ImagePermission::Public">公开</x-fieldset-radio>
|
||||
<x-fieldset-radio id="default_permission_private" name="configs[default_permission]" value="{{ \App\Enums\ImagePermission::Private }}" :checked="Auth::user()->configs->get('default_permission') == \App\Enums\ImagePermission::Private">私有</x-fieldset-radio>
|
||||
<x-fieldset-radio id="default_permission_public" name="configs[default_permission]" value="{{ \App\Enums\ImagePermission::Public }}" :checked="Auth::user()->configs->get('default_permission') == \App\Enums\ImagePermission::Public">公开</x-fieldset-radio>
|
||||
</x-fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="{{ asset('css/markdown-css/github-markdown.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/markdown-css/github-markdown-light.css') }}">
|
||||
@endpush
|
||||
|
||||
<x-guest-layout>
|
||||
@@ -10,9 +10,8 @@
|
||||
<a href="{{ route('/') }}" class="text-white text-xl truncate">{{ \App\Utils::config(\App\Enums\ConfigKey::AppName) }}</a>
|
||||
</div>
|
||||
<div class="flex justify-end items-center space-x-4">
|
||||
@if($_group->strategies->isNotEmpty())
|
||||
@include('layouts.strategies')
|
||||
@endif
|
||||
@includeWhen($_is_notice, 'layouts.notice')
|
||||
@includeWhen($_group->strategies->isNotEmpty(), 'layouts.strategies')
|
||||
|
||||
@if(Auth::check())
|
||||
@include('layouts.user-nav')
|
||||
@@ -29,8 +28,8 @@
|
||||
<x-upload/>
|
||||
</div>
|
||||
<footer class="absolute bottom-0 left-0 right-0 w-full bg-gray-200">
|
||||
<p class="container mx-auto py-2 px-5 sm:px-10 md:px-10 lg:px-10 xl:px-10 2xl:px-60 flex items-center text-gray-500 text-sm">
|
||||
Copyright © 2018 - present Lsky Pro. All rights reserved. <a href="https://beian.miit.gov.cn/">{{ \App\Utils::config(\App\Enums\ConfigKey::IcpNo) }}</a> 请勿上传违反中国大陆和香港法律的图片,违者后果自负。
|
||||
<p class="container mx-auto py-2 px-5 sm:px-10 md:px-10 lg:px-10 xl:px-10 2xl:px-60 text-gray-500 text-sm">
|
||||
Copyright © 2018 - present Lsky Pro. All rights reserved. <a href="https://beian.miit.gov.cn/" target="_blank" rel="noreferrer">{{ \App\Utils::config(\App\Enums\ConfigKey::IcpNo) }}</a> 请勿上传违反中国大陆和香港法律的图片,违者后果自负。
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
|
||||
use App\Enums\GroupConfigKey;
|
||||
use App\Enums\ConfigKey;
|
||||
|
||||
$extensions = config('convention.app.'.ConfigKey::Group)[GroupConfigKey::AcceptedFileSuffixes];
|
||||
$extensions = config('convention.group.accepted_file_suffixes');
|
||||
Route::middleware('cache.headers:public;max_age=2628000;etag')->group(function () use ($extensions) {
|
||||
$extensions = array_merge(array_map('strtoupper', $extensions), array_map('strtolower', $extensions));
|
||||
Route::any('{key}.{extension}', [
|
||||
|
||||
@@ -13,6 +13,9 @@ module.exports = {
|
||||
fontFamily: {
|
||||
sans: ['Nunito', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
boxShadow: {
|
||||
custom: '0px 4px 6px -1px rgba(0, 0, 0, 0.04)',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -54,3 +54,4 @@ mix.copy('node_modules/imagesloaded/imagesloaded.pkgd.min.js', 'public/js/images
|
||||
|
||||
// markdown css
|
||||
mix.copy('node_modules/github-markdown-css/github-markdown.css', 'public/css/markdown-css')
|
||||
mix.copy('node_modules/github-markdown-css/github-markdown-light.css', 'public/css/markdown-css')
|
||||
|
||||
Reference in New Issue
Block a user