Merge branch 'master' into v2.2

This commit is contained in:
Andy Heathershaw 2019-08-11 07:51:02 +01:00
commit cefff7ef4b
4 changed files with 21 additions and 6 deletions

View File

@ -128,6 +128,7 @@ class ConfigHelper
'rabbitmq_port' => 5672, 'rabbitmq_port' => 5672,
'rabbitmq_queue' => 'blue_twilight', 'rabbitmq_queue' => 'blue_twilight',
'rabbitmq_username' => 'guest', 'rabbitmq_username' => 'guest',
'rabbitmq_vhost' => '/',
'recaptcha_enabled_registration' => false, 'recaptcha_enabled_registration' => false,
'recaptcha_secret_key' => '', 'recaptcha_secret_key' => '',
'recaptcha_site_key' => '', 'recaptcha_site_key' => '',
@ -210,7 +211,8 @@ class ConfigHelper
!empty($this->get('rabbitmq_port')) && !empty($this->get('rabbitmq_port')) &&
!empty($this->get('rabbitmq_username')) && !empty($this->get('rabbitmq_username')) &&
!empty($this->get('rabbitmq_password')) && !empty($this->get('rabbitmq_password')) &&
!empty($this->get('rabbitmq_queue')); !empty($this->get('rabbitmq_queue')) &&
!empty($this->get('rabbitmq_vhost'));
} }
public function isSocialMediaLoginEnabled() public function isSocialMediaLoginEnabled()

View File

@ -3,12 +3,10 @@
namespace App\Http\Controllers\Admin; namespace App\Http\Controllers\Admin;
use App\Album; use App\Album;
use App\Configuration;
use App\Facade\Theme; use App\Facade\Theme;
use App\Facade\UserConfig; use App\Facade\UserConfig;
use App\Group; use App\Group;
use App\Helpers\AnalysisQueueHelper; use App\Helpers\AnalysisQueueHelper;
use App\Helpers\ConfigHelper;
use App\Helpers\DbHelper; use App\Helpers\DbHelper;
use App\Helpers\MiscHelper; use App\Helpers\MiscHelper;
use App\Helpers\PermissionsHelper; use App\Helpers\PermissionsHelper;
@ -19,12 +17,10 @@ use App\Mail\TestMailConfig;
use App\Photo; use App\Photo;
use App\PhotoComment; use App\PhotoComment;
use App\Services\GiteaService; use App\Services\GiteaService;
use App\Services\GithubService;
use App\Services\PhotoService; use App\Services\PhotoService;
use App\Storage; use App\Storage;
use App\User; use App\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
@ -275,6 +271,7 @@ class DefaultController extends Controller
'rabbitmq_username', 'rabbitmq_username',
'rabbitmq_password', 'rabbitmq_password',
'rabbitmq_queue', 'rabbitmq_queue',
'rabbitmq_vhost',
'sender_address', 'sender_address',
'sender_name', 'sender_name',
'smtp_server', 'smtp_server',

View File

@ -19,6 +19,8 @@ class RabbitMQService
protected $server; protected $server;
protected $username; protected $username;
protected $vhost;
/** /**
* @var AMQPChannel * @var AMQPChannel
@ -37,6 +39,9 @@ class RabbitMQService
$this->username = UserConfig::get('rabbitmq_username'); $this->username = UserConfig::get('rabbitmq_username');
$this->password = decrypt(UserConfig::get('rabbitmq_password')); $this->password = decrypt(UserConfig::get('rabbitmq_password'));
$this->queue = UserConfig::get('rabbitmq_queue'); $this->queue = UserConfig::get('rabbitmq_queue');
$vhost = UserConfig::get('rabbitmq_vhost');
$this->vhost = empty($vhost) ? '/' : $vhost;
} }
public function queueItem(QueueItem $queueItem) public function queueItem(QueueItem $queueItem)
@ -78,7 +83,7 @@ class RabbitMQService
private function connectAndInit() private function connectAndInit()
{ {
$this->connection = new AMQPStreamConnection($this->server, $this->port, $this->username, $this->password); $this->connection = new AMQPStreamConnection($this->server, $this->port, $this->username, $this->password, $this->vhost);
$this->channel = $this->connection->channel(); $this->channel = $this->connection->channel();
$this->channel->queue_declare($this->queue, false, true, false, false); $this->channel->queue_declare($this->queue, false, true, false, false);

View File

@ -182,6 +182,17 @@
@endif @endif
</div> </div>
<div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-vhost">Virtual host:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_vhost') ? ' is-invalid' : '' }}" id="rabbitmq-vhost" name="rabbitmq_vhost" value="{{ old('rabbitmq_vhost', $config['rabbitmq_vhost']) }}">
@if ($errors->has('rabbitmq_vhost'))
<div class="invalid-feedback">
<strong>{{ $errors->first('rabbitmq_vhost') }}</strong>
</div>
@endif
</div>
<div class="form-group ml-4"> <div class="form-group ml-4">
<label class="form-control-label" for="rabbitmq-queue">Queue:</label> <label class="form-control-label" for="rabbitmq-queue">Queue:</label>
<input type="text" class="form-control{{ $errors->has('rabbitmq_queue') ? ' is-invalid' : '' }}" id="rabbitmq-queue" name="rabbitmq_queue" value="{{ old('rabbitmq_queue', $config['rabbitmq_queue']) }}"> <input type="text" class="form-control{{ $errors->has('rabbitmq_queue') ? ' is-invalid' : '' }}" id="rabbitmq-queue" name="rabbitmq_queue" value="{{ old('rabbitmq_queue', $config['rabbitmq_queue']) }}">