🐛 修复 BUG

This commit is contained in:
Wisp X 2022-01-19 09:38:38 +08:00
parent 0e8ac365a5
commit d8ee38573b
4 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Intervention\Image\Facades\Image as InterventionImage; use Intervention\Image\Facades\Image as InterventionImage;
use Intervention\Image\Gd\Font; use Intervention\Image\Imagick\Font;
use Intervention\Image\ImageManager; use Intervention\Image\ImageManager;
use League\Flysystem\Filesystem; use League\Flysystem\Filesystem;
use League\Flysystem\FilesystemAdapter; use League\Flysystem\FilesystemAdapter;

View File

@ -15,6 +15,5 @@ return [
| |
*/ */
'driver' => 'gd' 'driver' => 'imagick'
]; ];

View File

@ -80,7 +80,7 @@ class DatabaseSeeder extends Seeder
GroupConfigKey::LimitPerDay => 300, GroupConfigKey::LimitPerDay => 300,
GroupConfigKey::LimitPerWeek => 600, GroupConfigKey::LimitPerWeek => 600,
GroupConfigKey::LimitPerMonth => 999, GroupConfigKey::LimitPerMonth => 999,
GroupConfigKey::AcceptedFileSuffixes => ['jpg', 'jpeg', 'gif', 'png', 'apng', 'bmp', 'ico'], GroupConfigKey::AcceptedFileSuffixes => ['jpeg', 'png', 'gif', 'tif', 'bmp', 'ico', 'psd', 'webp'],
GroupConfigKey::PathNamingRule => '{Y}/{m}/{d}', GroupConfigKey::PathNamingRule => '{Y}/{m}/{d}',
GroupConfigKey::FileNamingRule => '{uniqid}', GroupConfigKey::FileNamingRule => '{uniqid}',
])->toJson(), ])->toJson(),

View File

@ -79,11 +79,13 @@
@push('scripts') @push('scripts')
@if(Auth::check() && Auth::user()->group) @if(Auth::check() && Auth::user()->group)
<script> <script>
let maxSize = {{ Auth::user()->group->configs->get(\App\Enums\GroupConfigKey::MaximumFileSize) * 1024 }} let allowSuffixes = @json(Auth::user()->group->configs->get(\App\Enums\GroupConfigKey::AcceptedFileSuffixes));
let maxSize = {{ Auth::user()->group->configs->get(\App\Enums\GroupConfigKey::MaximumFileSize) * 1024 }};
</script> </script>
@else @else
<script> <script>
let maxSize = {{ \App\Models\Group::getDefaultConfigs()->get(\App\Enums\GroupConfigKey::MaximumFileSize) * 1024 }} let allowSuffixes = @json(\App\Models\Group::getDefaultConfigs()->get(\App\Enums\GroupConfigKey::AcceptedFileSuffixes));
let maxSize = {{ \App\Models\Group::getDefaultConfigs()->get(\App\Enums\GroupConfigKey::MaximumFileSize) * 1024 }};
</script> </script>
@endif @endif
<script> <script>
@ -161,7 +163,6 @@
add: (e, data) => { add: (e, data) => {
let file = data.files[0]; let file = data.files[0];
let ext = file.name.substr(file.name.lastIndexOf('.') + 1); let ext = file.name.substr(file.name.lastIndexOf('.') + 1);
let allowSuffixes = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff', 'ico'];
if (allowSuffixes.indexOf(ext.toLowerCase()) === -1) { if (allowSuffixes.indexOf(ext.toLowerCase()) === -1) {
toastr.warning(`不支持的文件格式 ${file.name}`); toastr.warning(`不支持的文件格式 ${file.name}`);
return false; return false;