Always prefer browser URL and always enable SFTP server.

Both settings are no longer relevant and turning them off would cause unexpected issues, so they're being removed completely instead to ease configuration difficulty.
This commit is contained in:
Buster "Silver Eagle" Neece 2020-01-15 14:52:47 -06:00
parent 535f9c7449
commit b6f558eb54
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
5 changed files with 8 additions and 46 deletions

View File

@ -33,18 +33,6 @@ $config = [
],
],
Entity\Settings::PREFER_BROWSER_URL => [
'toggle',
[
'label' => __('Prefer Browser URL (If Available)'),
'description' => __('If this setting is set to "Yes", the browser URL will be used instead of the base URL when it\'s available. Set to "No" to always use the base URL.'),
'selected_text' => __('Yes'),
'deselected_text' => __('No'),
'default' => true,
'form_group_class' => 'col-md-6',
],
],
Entity\Settings::USE_RADIO_PROXY => [
'toggle',
[
@ -108,18 +96,6 @@ $config = [
],
],
Entity\Settings::ENABLE_FTP_SERVER => [
'toggle',
[
'label' => __('Enable Built-in FTP Server'),
'description' => __('If enabled, users can connect via FTP using their AzuraCast credentials to upload media directly to any stations they manage.'),
'selected_text' => __('Yes'),
'deselected_text' => __('No'),
'default' => true,
'form_group_class' => 'col-md-6',
],
],
Entity\Settings::API_ACCESS_CONTROL => [
'text',
[
@ -211,8 +187,4 @@ $config = [
],
];
if (!$settings->isDocker()) {
unset($config['groups']['security']['elements'][Entity\Settings::ENABLE_FTP_SERVER]);
}
return $config;

View File

@ -13,7 +13,6 @@ class Settings extends AbstractFixture
Entity\Settings::BASE_URL => getenv('INIT_BASE_URL') ?? 'docker.local',
Entity\Settings::INSTANCE_NAME => getenv('INIT_INSTANCE_NAME') ?? 'local test',
Entity\Settings::GEOLITE_LICENSE_KEY => getenv('INIT_GEOLITE_LICENSE_KEY') ?? '',
Entity\Settings::PREFER_BROWSER_URL => 1,
Entity\Settings::SETUP_COMPLETE => time(),
Entity\Settings::USE_RADIO_PROXY => 1,
Entity\Settings::SEND_ERROR_REPORTS => 0,

View File

@ -12,13 +12,10 @@ class Settings
// Predefined settings constants.
public const BASE_URL = 'base_url';
public const INSTANCE_NAME = 'instance_name';
public const PREFER_BROWSER_URL = 'prefer_browser_url';
public const USE_RADIO_PROXY = 'use_radio_proxy';
public const HISTORY_KEEP_DAYS = 'history_keep_days';
public const ENABLE_FTP_SERVER = 'enable_ftp_server';
public const ALWAYS_USE_SSL = 'always_use_ssl';
public const API_ACCESS_CONTROL = 'api_access_control';
public const NOWPLAYING_USE_WEBSOCKETS = 'nowplaying_use_websockets';

View File

@ -40,15 +40,12 @@ class Router extends \Azura\Http\Router
$use_https = true;
}
$prefer_browser_url = (bool)$this->settingsRepo->getSetting(Entity\Settings::PREFER_BROWSER_URL, 0);
if ($prefer_browser_url || $base_url->getHost() === '') {
$ignored_hosts = ['web', 'nginx', 'localhost'];
if (!in_array($current_uri->getHost(), $ignored_hosts, true)) {
$base_url = (new Uri())
->withScheme($current_uri->getScheme())
->withHost($current_uri->getHost())
->withPort($current_uri->getPort());
}
$ignored_hosts = ['web', 'nginx', 'localhost'];
if (!in_array($current_uri->getHost(), $ignored_hosts, true)) {
$base_url = (new Uri())
->withScheme($current_uri->getScheme())
->withHost($current_uri->getHost())
->withPort($current_uri->getPort());
}
}

View File

@ -40,9 +40,6 @@ class Api
Entity\AuditLog::setCurrentUser($api_user);
}
// Set default cache control for API pages.
$prefer_browser_url = (bool)$this->settings_repo->getSetting(Entity\Settings::PREFER_BROWSER_URL, 0);
$response = $handler->handle($request);
// Check for a user-set CORS header override.
@ -75,7 +72,7 @@ class Api
}
if ($response instanceof Response) {
if ($prefer_browser_url || $request->getAttribute(ServerRequest::ATTR_USER) instanceof Entity\User) {
if ($request->getAttribute(ServerRequest::ATTR_USER) instanceof Entity\User) {
$response = $response->withNoCache();
} else {
$response = $response->withCacheLifetime(15);