#121: Added new configuration tab (Image Processing) for RabbitMQ-related settings

This commit is contained in:
Andy Heathershaw 2019-07-09 13:08:57 +01:00
parent de66c489a6
commit ca893359c9
4 changed files with 96 additions and 4 deletions

View File

@ -119,6 +119,11 @@ class ConfigHelper
'photo_comments_allowed_html' => 'p,div,span,a,b,i,u',
'photo_comments_thread_depth' => 3,
'public_statistics' => true,
'rabbitmq_enabled' => false,
'rabbitmq_server' => 'localhost',
'rabbitmq_password' => encrypt('guest'),
'rabbitmq_port' => 5672,
'rabbitmq_username' => 'guest',
'recaptcha_enabled_registration' => false,
'recaptcha_secret_key' => '',
'recaptcha_site_key' => '',

View File

@ -39,6 +39,7 @@ class DefaultController extends Controller
View::share('is_admin', true);
$this->passwordSettingKeys = [
'rabbitmq_password',
'smtp_password',
'facebook_app_secret',
'google_app_secret',
@ -241,6 +242,7 @@ class DefaultController extends Controller
'hotlink_protection',
'moderate_anonymous_users',
'moderate_known_users',
'rabbitmq_enabled',
'recaptcha_enabled_registration',
'remove_copyright',
'require_email_verification',
@ -262,6 +264,10 @@ class DefaultController extends Controller
'google_app_secret',
'photo_comments_allowed_html',
'photo_comments_thread_depth',
'rabbitmq_server',
'rabbitmq_port',
'rabbitmq_username',
'rabbitmq_password',
'sender_address',
'sender_name',
'smtp_server',
@ -285,10 +291,17 @@ class DefaultController extends Controller
// Bit of a hack when the browser returns an empty password field - meaning the user didn't change it
// - don't touch it!
if (
(
$key == 'smtp_password' &&
strlen($config->value) > 0 &&
strlen($request->request->get($key)) == 0 &&
strlen($request->request->get('smtp_username')) > 0
) || (
$key == 'rabbitmq_password' &&
strlen($config->value) > 0 &&
strlen($request->request->get($key)) == 0 &&
strlen($request->request->get('rabbitmq_username')) > 0
)
)
{
continue;

View File

@ -270,6 +270,14 @@ return [
'comments_tab' => 'Comments',
'default_album_permissions' => 'Default Album Permissions',
'default_album_permissions_intro' => 'Configure a set of permissions to apply to top-level albums that do not have their own permissions, and as a base set of permissions for newly-created albums.',
'image_processing_queue' => 'Queue Intensive Operations in RabbitMQ',
'image_processing_queue_beta' => 'Beta',
'image_processing_queue_enabled' => 'Queue intensive operations in RabbitMQ',
'image_processing_queue_enabled_help' => 'If you enable this option, you will also need to provide the connection details to your RabbitMQ server for this to take effect.',
'image_processing_queue_intro' => 'Blue Twilight can off-load the processing of intensive operations (uploads, image analysis and bulk changes) to a secondary server using RabbitMQ.',
'image_processing_queue_intro_2' => 'This requires a significant amount of configuration outside of Blue Twilight, so it is disabled by default. Only enable it if you know what you are doing.',
'image_processing_queue_intro_3' => 'This is a beta-quality feature. We would appreciate feedback through <a href="https://apps.andysh.uk/aheathershaw/blue-twilight/issues">the project\'s issue tracker</a>.',
'image_processing_tab' => 'Image Processing',
'permissions_cache' => 'Permissions Cache',
'permissions_cache_intro' => 'Blue Twilight maintains the permissions each user has to albums in the database. If you feel these aren\'t correct based on what\'s configured, you can rebuild the cache by clicking the button below.',
'rebuild_permissions_cache' => 'Rebuild Permissions Cache',

View File

@ -20,6 +20,7 @@
{{-- Nav tabs --}}
<ul class="nav nav-tabs" role="tablist">
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'general', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.settings_general_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'image-processing', 'tab_icon' => 'picture-o', 'tab_text' => trans('admin.settings.image_processing_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'email', 'tab_icon' => 'envelope', 'tab_text' => trans('admin.settings_email_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'security', 'tab_icon' => 'lock', 'tab_text' => trans('admin.settings_security_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'analytics', 'tab_icon' => 'line-chart', 'tab_text' => trans('admin.settings.analytics_tab')])
@ -118,6 +119,71 @@
</fieldset>
</div>
{{-- Image Processing --}}
<div role="tabpanel" class="tab-pane" id="image-processing-tab">
<fieldset>
<legend>@lang('admin.settings.image_processing_queue') <span class="badge badge-warning">@lang('admin.settings.image_processing_queue_beta')</span></legend>
<p>@lang('admin.settings.image_processing_queue_intro')</p>
<p>@lang('admin.settings.image_processing_queue_intro_2')</p>
<div class="alert alert-info mb-5">
<p class="mb-0">@lang('admin.settings.image_processing_queue_intro_3')</p>
</div>
</fieldset>
<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="rabbitmq-enabled" name="rabbitmq_enabled" @if (UserConfig::get('rabbitmq_enabled'))checked="checked"@endif>
<label class="form-check-label" for="rabbitmq-enabled">
<strong>@lang('admin.settings.image_processing_queue_enabled')</strong><br/>
<span class="text-muted">@lang('admin.settings.image_processing_queue_enabled_help')</span>
</label>
</div>
<div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-server">Hostname:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_server') ? ' is-invalid' : '' }}" id="rabbitmq-server" name="rabbitmq_server" value="{{ old('rabbitmq_server', $config['rabbitmq_server']) }}">
@if ($errors->has('rabbitmq_server'))
<div class="invalid-feedback">
<strong>{{ $errors->first('rabbitmq_server') }}</strong>
</div>
@endif
</div>
<div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-port">Port:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_port') ? ' is-invalid' : '' }}" id="rabbitmq-port" name="rabbitmq_port" value="{{ old('rabbitmq_port', $config['rabbitmq_port']) }}">
@if ($errors->has('rabbitmq_port'))
<div class="invalid-feedback">
<strong>{{ $errors->first('rabbitmq_port') }}</strong>
</div>
@endif
</div>
<div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-username">Username:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_username') ? ' is-invalid' : '' }}" id="rabbitmq-username" name="rabbitmq_username" value="{{ old('rabbitmq_username', $config['rabbitmq_username']) }}">
@if ($errors->has('rabbitmq_username'))
<div class="invalid-feedback">
<strong>{{ $errors->first('rabbitmq_username') }}</strong>
</div>
@endif
</div>
<div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-password">Password:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_password') ? ' is-invalid' : '' }}" id="rabbitmq-password" name="rabbitmq_password" value="{{ old('rabbitmq_password', $config['rabbitmq_password']) }}">
@if ($errors->has('rabbitmq_password'))
<div class="invalid-feedback">
<strong>{{ $errors->first('rabbitmq_password') }}</strong>
</div>
@endif
</div>
</div>
{{-- E-mail --}}
<div role="tabpanel" class="tab-pane" id="email-tab">
<div class="form-group">