Merge pull request #2762 from pixelfed/staging

Staging
This commit is contained in:
daniel 2021-05-19 02:20:28 -06:00 committed by GitHub
commit 446ccc6a58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 170 additions and 62 deletions

View file

@ -6,18 +6,20 @@ use Artisan, Cache, DB;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use App\{Comment, Like, Media, Page, Profile, Report, Status, User}; use App\{Comment, Like, Media, Page, Profile, Report, Status, User};
use App\Models\InstanceActor;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Util\Lexer\PrettyNumber; use App\Util\Lexer\PrettyNumber;
use App\Models\ConfigCache; use App\Models\ConfigCache;
use App\Services\ConfigCacheService; use App\Services\ConfigCacheService;
use App\Util\Site\Config;
trait AdminSettingsController trait AdminSettingsController
{ {
public function settings(Request $request) public function settings(Request $request)
{ {
$name = ConfigCacheService::get('app.name'); $cloud_storage = ConfigCacheService::get('pixelfed.cloud_storage');
$short_description = ConfigCacheService::get('app.short_description'); $cloud_disk = config('filesystems.cloud');
$description = ConfigCacheService::get('app.description'); $cloud_ready = !empty(config('filesystems.disks.' . $cloud_disk . '.key')) && !empty(config('filesystems.disks.' . $cloud_disk . '.secret'));
$types = explode(',', ConfigCacheService::get('pixelfed.media_types')); $types = explode(',', ConfigCacheService::get('pixelfed.media_types'));
$rules = ConfigCacheService::get('app.rules') ? json_decode(ConfigCacheService::get('app.rules'), true) : null; $rules = ConfigCacheService::get('app.rules') ? json_decode(ConfigCacheService::get('app.rules'), true) : null;
$jpeg = in_array('image/jpg', $types) ? true : in_array('image/jpeg', $types); $jpeg = in_array('image/jpg', $types) ? true : in_array('image/jpeg', $types);
@ -25,15 +27,23 @@ trait AdminSettingsController
$gif = in_array('image/gif', $types); $gif = in_array('image/gif', $types);
$mp4 = in_array('video/mp4', $types); $mp4 = in_array('video/mp4', $types);
// $system = [
// 'permissions' => is_writable(base_path('storage')) && is_writable(base_path('bootstrap')),
// 'max_upload_size' => ini_get('post_max_size'),
// 'image_driver' => config('image.driver'),
// 'image_driver_loaded' => extension_loaded(config('image.driver'))
// ];
return view('admin.settings.home', compact( return view('admin.settings.home', compact(
'name',
'short_description',
'description',
'jpeg', 'jpeg',
'png', 'png',
'gif', 'gif',
'mp4', 'mp4',
'rules' 'rules',
'cloud_storage',
'cloud_disk',
'cloud_ready',
// 'system'
)); ));
} }
@ -98,7 +108,8 @@ trait AdminSettingsController
'image_quality' => 'pixelfed.image_quality', 'image_quality' => 'pixelfed.image_quality',
'account_limit' => 'pixelfed.max_account_size', 'account_limit' => 'pixelfed.max_account_size',
'custom_css' => 'uikit.custom.css', 'custom_css' => 'uikit.custom.css',
'custom_js' => 'uikit.custom.js' 'custom_js' => 'uikit.custom.js',
'about_title' => 'about.title'
]; ];
foreach ($keys as $key => $value) { foreach ($keys as $key => $value) {
@ -120,11 +131,25 @@ trait AdminSettingsController
'enforce_account_limit' => 'pixelfed.enforce_account_limit', 'enforce_account_limit' => 'pixelfed.enforce_account_limit',
'show_custom_css' => 'uikit.show_custom.css', 'show_custom_css' => 'uikit.show_custom.css',
'show_custom_js' => 'uikit.show_custom.js', 'show_custom_js' => 'uikit.show_custom.js',
'cloud_storage' => 'pixelfed.cloud_storage'
]; ];
foreach ($bools as $key => $value) { foreach ($bools as $key => $value) {
$active = $request->input($key) == 'on'; $active = $request->input($key) == 'on';
if($key == 'activitypub' && $active && !InstanceActor::exists()) {
Artisan::call('instance:actor');
}
if( $key == 'mobile_apis' &&
$active &&
!file_exists(storage_path('oauth-public.key')) &&
!file_exists(storage_path('oauth-private.key'))
) {
Artisan::call('passport:keys');
Artisan::call('route:cache');
}
if(config_cache($value) !== $active) { if(config_cache($value) !== $active) {
ConfigCacheService::put($value, (bool) $active); ConfigCacheService::put($value, (bool) $active);
} }
@ -142,9 +167,9 @@ trait AdminSettingsController
} }
} }
Cache::forget('api:site:configuration:_v0.2'); Cache::forget(Config::CACHE_KEY);
return redirect('/i/admin/settings'); return redirect('/i/admin/settings')->with('status', 'Successfully updated settings!');
} }
public function settingsBackups(Request $request) public function settingsBackups(Request $request)
@ -167,19 +192,6 @@ trait AdminSettingsController
if(config('pixelfed.admin.env_editor') !== true) { if(config('pixelfed.admin.env_editor') !== true) {
abort(400); abort(400);
} }
$res = $request->input('res');
$old = file_get_contents(app()->environmentFilePath());
if(empty($old) || $old != $res) {
$oldFile = fopen(app()->environmentFilePath().'.backup', 'w');
fwrite($oldFile, $old);
fclose($oldFile);
}
$file = fopen(app()->environmentFilePath(), 'w');
fwrite($file, $res);
fclose($file);
Artisan::call('config:cache');
return ['msg' => 200]; return ['msg' => 200];
} }
@ -188,14 +200,6 @@ trait AdminSettingsController
if(config('pixelfed.admin.env_editor') !== true) { if(config('pixelfed.admin.env_editor') !== true) {
abort(400); abort(400);
} }
$res = file_get_contents(app()->environmentFilePath().'.backup');
if(empty($res)) {
abort(400, 'No backup exists.');
}
$file = fopen(app()->environmentFilePath(), 'w');
fwrite($file, $res);
fclose($file);
Artisan::call('config:cache');
return ['msg' => 200]; return ['msg' => 200];
} }

View file

@ -646,7 +646,7 @@ class ComposeController extends Controller
case 'image/jpeg': case 'image/jpeg':
case 'image/png': case 'image/png':
case 'video/mp4': case 'video/mp4':
$finished = config('pixelfed.cloud_storage') ? (bool) $media->cdn_url : (bool) $media->processed_at; $finished = config_cache('pixelfed.cloud_storage') ? (bool) $media->cdn_url : (bool) $media->processed_at;
break; break;
default: default:

View file

@ -51,7 +51,7 @@ class RemoteAvatarFetch implements ShouldQueue
{ {
$profile = $this->profile; $profile = $this->profile;
if(config('pixelfed.cloud_storage') !== true) { if(config_cache('pixelfed.cloud_storage') !== true) {
return 1; return 1;
} }

View file

@ -36,7 +36,7 @@ class MediaDeletePipeline implements ShouldQueue
array_pop($e); array_pop($e);
$i = implode('/', $e); $i = implode('/', $e);
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
$disk = Storage::disk(config('filesystems.cloud')); $disk = Storage::disk(config('filesystems.cloud'));
if($disk->exists($path)) { if($disk->exists($path)) {
$disk->delete($path); $disk->delete($path);

View file

@ -8,12 +8,13 @@ use App\Models\ConfigCache as ConfigCacheModel;
class ConfigCacheService class ConfigCacheService
{ {
const CACHE_KEY = 'config_cache:_key:'; const CACHE_KEY = 'config_cache:_v0-key:';
public static function get($key) public static function get($key)
{ {
$cacheKey = "config_cache:_key:{$key}"; $cacheKey = self::CACHE_KEY . $key;
$ttl = now()->addHours(12); $ttl = now()->addHours(12);
return Cache::remember($cacheKey, $ttl, function() use($key) { return Cache::remember($cacheKey, $ttl, function() use($key) {
$allowed = [ $allowed = [
@ -29,8 +30,8 @@ class ConfigCacheService
'pixelfed.open_registration', 'pixelfed.open_registration',
'federation.activitypub.enabled', 'federation.activitypub.enabled',
'pixelfed.oauth_enabled',
'instance.stories.enabled', 'instance.stories.enabled',
'pixelfed.oauth_enabled',
'pixelfed.import.instagram.enabled', 'pixelfed.import.instagram.enabled',
'pixelfed.bouncer.enabled', 'pixelfed.bouncer.enabled',
@ -41,7 +42,10 @@ class ConfigCacheService
'uikit.custom.css', 'uikit.custom.css',
'uikit.custom.js', 'uikit.custom.js',
'uikit.show_custom.css', 'uikit.show_custom.css',
'uikit.show_custom.js' 'uikit.show_custom.js',
'about.title',
'pixelfed.cloud_storage'
]; ];
if(!config('instance.enable_cc')) { if(!config('instance.enable_cc')) {
@ -79,7 +83,7 @@ class ConfigCacheService
if($exists) { if($exists) {
$exists->v = $val; $exists->v = $val;
$exists->save(); $exists->save();
Cache::forget(self::CACHE_KEY . $key); Cache::put(self::CACHE_KEY . $key, $val, now()->addHours(12));
return self::get($key); return self::get($key);
} }
@ -88,7 +92,7 @@ class ConfigCacheService
$cc->v = $val; $cc->v = $val;
$cc->save(); $cc->save();
Cache::forget(self::CACHE_KEY . $key); Cache::put(self::CACHE_KEY . $key, $val, now()->addHours(12));
return self::get($key); return self::get($key);
} }

View file

@ -20,7 +20,7 @@ class MediaStorageService {
public static function store(Media $media) public static function store(Media $media)
{ {
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
(new self())->cloudStore($media); (new self())->cloudStore($media);
} }

View file

@ -441,7 +441,7 @@ class Helpers {
$media->version = 3; $media->version = 3;
$media->save(); $media->save();
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
MediaStoragePipeline::dispatch($media); MediaStoragePipeline::dispatch($media);
} }
} }
@ -511,7 +511,7 @@ class Helpers {
$profile->webfinger = Purify::clean($webfinger); $profile->webfinger = Purify::clean($webfinger);
$profile->last_fetched_at = now(); $profile->last_fetched_at = now();
$profile->save(); $profile->save();
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
RemoteAvatarFetch::dispatch($profile); RemoteAvatarFetch::dispatch($profile);
} }
return $profile; return $profile;
@ -528,7 +528,7 @@ class Helpers {
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) && Helpers::validateUrl($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null; $profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) && Helpers::validateUrl($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
$profile->save(); $profile->save();
} }
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
RemoteAvatarFetch::dispatch($profile); RemoteAvatarFetch::dispatch($profile);
} }
} }

View file

@ -7,8 +7,10 @@ use Illuminate\Support\Str;
class Config { class Config {
const CACHE_KEY = 'api:site:configuration:_v0.3';
public static function get() { public static function get() {
return Cache::remember('api:site:configuration:_v0.3', now()->addMinutes(5), function() { return Cache::remember(self::CACHE_KEY, now()->addMinutes(5), function() {
return [ return [
'open_registration' => (bool) config_cache('pixelfed.open_registration'), 'open_registration' => (bool) config_cache('pixelfed.open_registration'),
'uploader' => [ 'uploader' => [

View file

@ -6,23 +6,28 @@
<div class="title mb-4"> <div class="title mb-4">
<h3 class="font-weight-bold">Settings</h3> <h3 class="font-weight-bold">Settings</h3>
@if(config('instance.enable_cc')) @if(config('instance.enable_cc'))
<p class="lead mb-0">Manage instance settings.</p> <p class="lead mb-0">Manage instance settings</p>
<p class="mb-0"><span class="font-weight-bold">Warning</span>: These settings will override .env variables</p>
</div> </div>
<form method="post"> <form method="post">
@csrf @csrf
<ul class="nav nav-tabs nav-fill border-bottom-0" id="myTab" role="tablist"> <ul class="nav nav-tabs nav-fill border-bottom-0" id="myTab" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link font-weight-bold px-4 active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">General</a> <a class="nav-link font-weight-bold active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true"><i class="fas fa-home"></i></a>
</li> </li>
<li class="nav-item border-none">
<a class="nav-link font-weight-bold px-4" id="brand-tab" data-toggle="tab" href="#brand" role="tab" aria-controls="brand">Brand</a>
</li>
{{-- <li class="nav-item border-none">
<a class="nav-link font-weight-bold px-4" id="media-tab" data-toggle="tab" href="#media" role="tab" aria-controls="media">Mail</a>
</li> --}}
<li class="nav-item border-none"> <li class="nav-item border-none">
<a class="nav-link font-weight-bold px-4" id="media-tab" data-toggle="tab" href="#media" role="tab" aria-controls="media">Media</a> <a class="nav-link font-weight-bold px-4" id="media-tab" data-toggle="tab" href="#media" role="tab" aria-controls="media">Media</a>
</li> </li>
<li class="nav-item border-none"> <li class="nav-item border-none">
<a class="nav-link font-weight-bold px-4" id="users-tab" data-toggle="tab" href="#users" role="tab" aria-controls="users">Users</a> <a class="nav-link font-weight-bold px-4" id="rules-tab" data-toggle="tab" href="#rules" role="tab" aria-controls="rules">Rules</a>
</li> </li>
<li class="nav-item border-none"> <li class="nav-item border-none">
<a class="nav-link font-weight-bold px-4" id="rules-tab" data-toggle="tab" href="#rules" role="tab" aria-controls="rules">Rules</a> <a class="nav-link font-weight-bold px-4" id="users-tab" data-toggle="tab" href="#users" role="tab" aria-controls="users">Users</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link font-weight-bold px-4" id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced">Advanced</a> <a class="nav-link font-weight-bold px-4" id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced">Advanced</a>
@ -31,35 +36,115 @@
<div class="tab-content" id="myTabContent"> <div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"> <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
{{-- <div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
<label class="font-weight-bold text-muted">System Configuration</label>
<ul class="list-unstyled">
<li>
<span class="text-muted">Max Upload Size: </span>
<span class="font-weight-bold">{{$system['max_upload_size']}}</span>
</li>
<li>
<span class="text-muted">Image Driver: </span>
<span class="font-weight-bold">{{$system['image_driver']}}</span>
</li>
<li>
<span class="text-muted">Image Driver Loaded: </span>
<span class="font-weight-bold">
@if($system['image_driver_loaded'])
<i class="fas fa-check text-success"></i>
@else
<i class="fas fa-times text-danger"></i>
@endif
</span>
</li>
<li>
<span class="text-muted">File Permissions: </span>
<span class="font-weight-bold">
@if($system['permissions'])
<i class="fas fa-check text-success"></i>
@else
<i class="fas fa-times text-danger"></i>
@endif
</span>
</li>
<li>
<span class="text-muted"></span>
<span class="font-weight-bold"></span>
</li>
</ul>
</div> --}}
<div class="form-group mb-0"> <div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-top"> <div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
<label class="font-weight-bold text-muted">Manage Core Features</label> <label class="font-weight-bold text-muted">Features</label>
@if($cloud_ready)
<div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="cloud_storage" class="custom-control-input" id="cls1" {{config_cache('pixelfed.cloud_storage') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="cls1">Cloud Storage</label>
</div>
<p class="mb-4 small">Store photos &amp; videos on S3 compatible object storage providers.</p>
@endif
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="activitypub" class="custom-control-input" id="ap" {{config_cache('federation.activitypub.enabled') ? 'checked' : ''}}> <input type="checkbox" name="activitypub" class="custom-control-input" id="ap" {{config_cache('federation.activitypub.enabled') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="ap">ActivityPub</label> <label class="custom-control-label font-weight-bold" for="ap">ActivityPub</label>
</div> </div>
<p class="mb-4 small">ActivityPub federation, compatible with Pixelfed, Mastodon and other projects.</p>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="open_registration" class="custom-control-input" id="openReg" {{config_cache('pixelfed.open_registration') ? 'checked' : ''}}> <input type="checkbox" name="open_registration" class="custom-control-input" id="openReg" {{config_cache('pixelfed.open_registration') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="openReg">Open Registrations</label> <label class="custom-control-label font-weight-bold" for="openReg">Open Registrations</label>
</div> </div>
{{-- <div class="custom-control custom-checkbox mt-2"> <p class="mb-4 small">Allow new user registrations.</p>
<div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="mobile_apis" class="custom-control-input" id="cf2" {{config_cache('pixelfed.oauth_enabled') ? 'checked' : ''}}> <input type="checkbox" name="mobile_apis" class="custom-control-input" id="cf2" {{config_cache('pixelfed.oauth_enabled') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="cf2">Mobile APIs</label> <label class="custom-control-label font-weight-bold" for="cf2">Mobile APIs</label>
</div> --}} </div>
<p class="mb-4 small">Enable apis required for mobile app support.</p>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="stories" class="custom-control-input" id="cf3" {{config_cache('instance.stories.enabled') ? 'checked' : ''}}> <input type="checkbox" name="stories" class="custom-control-input" id="cf3" {{config_cache('instance.stories.enabled') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="cf3">Stories</label> <label class="custom-control-label font-weight-bold" for="cf3">Stories</label>
</div> </div>
<p class="mb-4 small">Allow users to share ephemeral Stories.</p>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="ig_import" class="custom-control-input" id="cf4" {{config_cache('pixelfed.import.instagram.enabled') ? 'checked' : ''}}> <input type="checkbox" name="ig_import" class="custom-control-input" id="cf4" {{config_cache('pixelfed.import.instagram.enabled') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="cf4">Instagram Import</label> <label class="custom-control-label font-weight-bold" for="cf4">Instagram Import</label>
</div> </div>
<p class="mb-4 small">Allow <span class="font-weight-bold">experimental</span> Instagram Import support.</p>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="spam_detection" class="custom-control-input" id="cf5" {{config_cache('pixelfed.bouncer.enabled') ? 'checked' : ''}}> <input type="checkbox" name="spam_detection" class="custom-control-input" id="cf5" {{config_cache('pixelfed.bouncer.enabled') ? 'checked' : ''}}>
<label class="custom-control-label font-weight-bold" for="cf5">Spam detection</label> <label class="custom-control-label font-weight-bold" for="cf5">Spam detection</label>
</div> </div>
<p class="mb-4 small">Detect and remove spam from timelines.</p>
</div> </div>
</div> </div>
{{-- <div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
<label class="font-weight-bold text-muted">Name</label>
<input class="form-control col-8" name="name" placeholder="Pixelfed" value="{{config_cache('app.name')}}">
<p class="help-text small text-muted mt-3 mb-0">The instance name used in titles, metadata and apis.</p>
</div>
</div>
<div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-bottom">
<label class="font-weight-bold text-muted">Short Description</label>
<textarea class="form-control" rows="3" name="short_description">{{config_cache('app.short_description')}}</textarea>
<p class="help-text small text-muted mt-3 mb-0">Short description of instance used on various pages and apis.</p>
</div>
</div>
<div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-bottom">
<label class="font-weight-bold text-muted">Long Description</label>
<textarea class="form-control" rows="3" name="long_description">{{config_cache('app.description')}}</textarea>
<p class="help-text small text-muted mt-3 mb-0">Longer description of instance used on about page.</p>
</div>
</div> --}}
</div>
<div class="tab-pane" id="brand" role="tabpanel" aria-labelledby="brand-tab">
<div class="form-group mb-0"> <div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom"> <div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
<label class="font-weight-bold text-muted">Name</label> <label class="font-weight-bold text-muted">Name</label>
@ -81,6 +166,13 @@
<p class="help-text small text-muted mt-3 mb-0">Longer description of instance used on about page.</p> <p class="help-text small text-muted mt-3 mb-0">Longer description of instance used on about page.</p>
</div> </div>
</div> </div>
<div class="form-group mb-0">
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
<label class="font-weight-bold text-muted">About Title</label>
<input class="form-control col-8" name="about_title" placeholder="Photo Sharing. For Everyone" value="{{config_cache('about.title')}}">
<p class="help-text small text-muted mt-3 mb-0">The header title used on the <a href="/site/about">about page</a>.</p>
</div>
</div>
</div> </div>
<div class="tab-pane" id="users" role="tabpanel" aria-labelledby="users-tab"> <div class="tab-pane" id="users" role="tabpanel" aria-labelledby="users-tab">
@ -135,19 +227,19 @@
<label class="font-weight-bold text-muted">Media Types</label> <label class="font-weight-bold text-muted">Media Types</label>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="type_jpeg" class="custom-control-input" id="mediaType1" {{$jpeg ? 'checked' : ''}}> <input type="checkbox" name="type_jpeg" class="custom-control-input" id="mediaType1" {{$jpeg ? 'checked' : ''}}>
<label class="custom-control-label" for="mediaType1">Allow <span class="border border-dark px-1 rounded font-weight-bold">JPEG</span> images (image/jpg)</label> <label class="custom-control-label" for="mediaType1"><span class="border border-dark px-1 rounded font-weight-bold">JPEG</span></label>
</div> </div>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="type_png" class="custom-control-input" id="mediaType2" {{$png ? 'checked' : ''}}> <input type="checkbox" name="type_png" class="custom-control-input" id="mediaType2" {{$png ? 'checked' : ''}}>
<label class="custom-control-label" for="mediaType2">Allow <span class="border border-dark px-1 rounded font-weight-bold">PNG</span> images (image/png)</label> <label class="custom-control-label" for="mediaType2"><span class="border border-dark px-1 rounded font-weight-bold">PNG</span></label>
</div> </div>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="type_gif" class="custom-control-input" id="mediaType3" {{$gif ? 'checked' : ''}}> <input type="checkbox" name="type_gif" class="custom-control-input" id="mediaType3" {{$gif ? 'checked' : ''}}>
<label class="custom-control-label" for="mediaType3">Allow <span class="border border-dark px-1 rounded font-weight-bold">GIF</span> images (image/gif)</label> <label class="custom-control-label" for="mediaType3"><span class="border border-dark px-1 rounded font-weight-bold">GIF</span></label>
</div> </div>
<div class="custom-control custom-checkbox mt-2"> <div class="custom-control custom-checkbox mt-2">
<input type="checkbox" name="type_mp4" class="custom-control-input" id="mediaType4" {{$mp4 ? 'checked' : ''}}> <input type="checkbox" name="type_mp4" class="custom-control-input" id="mediaType4" {{$mp4 ? 'checked' : ''}}>
<label class="custom-control-label" for="mediaType4">Allow <span class="border border-dark px-1 rounded font-weight-bold">MP4</span> video (video/mp4)</label> <label class="custom-control-label" for="mediaType4"><span class="border border-dark px-1 rounded font-weight-bold">MP4</span></label>
</div> </div>
<p class="help-text small text-muted mt-3 mb-0">Allowed media types.</p> <p class="help-text small text-muted mt-3 mb-0">Allowed media types.</p>
</div> </div>
@ -226,5 +318,11 @@
}); });
} }
}); });
$(document).ready(function() {
setTimeout(() => {
$('.alert-success').fadeOut();
}, 1000);
});
</script> </script>
@endpush @endpush