mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 14:26:58 +00:00
Fix #9770
This commit is contained in:
@@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers\Admin;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||||
use FireflyIII\Http\Requests\ConfigurationRequest;
|
use FireflyIII\Http\Requests\ConfigurationRequest;
|
||||||
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@@ -68,8 +69,8 @@ class ConfigurationController extends Controller
|
|||||||
|
|
||||||
// all available configuration and their default value in case
|
// all available configuration and their default value in case
|
||||||
// they don't exist yet.
|
// they don't exist yet.
|
||||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||||
$siteOwner = config('firefly.site_owner');
|
$siteOwner = config('firefly.site_owner');
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
@@ -89,8 +90,8 @@ class ConfigurationController extends Controller
|
|||||||
Log::channel('audit')->info('User updates global configuration.', $data);
|
Log::channel('audit')->info('User updates global configuration.', $data);
|
||||||
|
|
||||||
// store config values
|
// store config values
|
||||||
app('fireflyconfig')->set('single_user_mode', $data['single_user_mode']);
|
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
||||||
app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);
|
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
||||||
|
|
||||||
// flash message
|
// flash message
|
||||||
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
||||||
|
@@ -28,6 +28,7 @@ use FireflyIII\Events\Test\OwnerTestNotificationChannel;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\NotificationRequest;
|
use FireflyIII\Http\Requests\NotificationRequest;
|
||||||
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
|
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
|
||||||
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@@ -44,14 +45,14 @@ class NotificationController extends Controller
|
|||||||
$subTitleIcon = 'envelope-o';
|
$subTitleIcon = 'envelope-o';
|
||||||
|
|
||||||
// notification settings:
|
// notification settings:
|
||||||
$slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
|
$slackUrl = FireflyConfig::getEncrypted('slack_webhook_url', '')->data;
|
||||||
$pushoverAppToken = app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;
|
$pushoverAppToken = FireflyConfig::getEncrypted('pushover_app_token', '')->data;
|
||||||
$pushoverUserToken = app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
|
$pushoverUserToken = FireflyConfig::getEncrypted('pushover_user_token', '')->data;
|
||||||
$ntfyServer = app('fireflyconfig')->getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
|
$ntfyServer = FireflyConfig::getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
|
||||||
$ntfyTopic = app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data;
|
$ntfyTopic = FireflyConfig::getEncrypted('ntfy_topic', '')->data;
|
||||||
$ntfyAuth = app('fireflyconfig')->get('ntfy_auth', false)->data;
|
$ntfyAuth = FireflyConfig::get('ntfy_auth', false)->data;
|
||||||
$ntfyUser = app('fireflyconfig')->getEncrypted('ntfy_user', '')->data;
|
$ntfyUser = FireflyConfig::getEncrypted('ntfy_user', '')->data;
|
||||||
$ntfyPass = app('fireflyconfig')->getEncrypted('ntfy_pass', '')->data;
|
$ntfyPass = FireflyConfig::getEncrypted('ntfy_pass', '')->data;
|
||||||
$channels = config('notifications.channels');
|
$channels = config('notifications.channels');
|
||||||
$forcedAvailability = [];
|
$forcedAvailability = [];
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ class NotificationController extends Controller
|
|||||||
$notifications = [];
|
$notifications = [];
|
||||||
foreach (config('notifications.notifications.owner') as $key => $info) {
|
foreach (config('notifications.notifications.owner') as $key => $info) {
|
||||||
if (true === $info['enabled']) {
|
if (true === $info['enabled']) {
|
||||||
$notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data;
|
$notifications[$key] = FireflyConfig::get(sprintf('notification_%s', $key), true)->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,19 +99,19 @@ class NotificationController extends Controller
|
|||||||
|
|
||||||
foreach (config('notifications.notifications.owner') as $key => $info) {
|
foreach (config('notifications.notifications.owner') as $key => $info) {
|
||||||
if (array_key_exists($key, $all)) {
|
if (array_key_exists($key, $all)) {
|
||||||
app('fireflyconfig')->set(sprintf('notification_%s', $key), $all[$key]);
|
FireflyConfig::set(sprintf('notification_%s', $key), $all[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$variables = ['slack_webhook_url', 'pushover_app_token', 'pushover_user_token', 'ntfy_server', 'ntfy_topic', 'ntfy_user', 'ntfy_pass'];
|
$variables = ['slack_webhook_url', 'pushover_app_token', 'pushover_user_token', 'ntfy_server', 'ntfy_topic', 'ntfy_user', 'ntfy_pass'];
|
||||||
foreach ($variables as $variable) {
|
foreach ($variables as $variable) {
|
||||||
if ('' === $all[$variable]) {
|
if ('' === $all[$variable]) {
|
||||||
app('fireflyconfig')->delete($variable);
|
FireflyConfig::delete($variable);
|
||||||
}
|
}
|
||||||
if ('' !== $all[$variable]) {
|
if ('' !== $all[$variable]) {
|
||||||
app('fireflyconfig')->setEncrypted($variable, $all[$variable]);
|
FireflyConfig::setEncrypted($variable, $all[$variable]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app('fireflyconfig')->set('ntfy_auth', $all['ntfy_auth'] ?? false);
|
FireflyConfig::set('ntfy_auth', $all['ntfy_auth'] ?? false);
|
||||||
|
|
||||||
|
|
||||||
session()->flash('success', (string) trans('firefly.notification_settings_saved'));
|
session()->flash('success', (string) trans('firefly.notification_settings_saved'));
|
||||||
|
@@ -55,7 +55,7 @@ class ReturnsSettings
|
|||||||
if ('user' === $type && null !== $user) {
|
if ('user' === $type && null !== $user) {
|
||||||
$settings['ntfy_server'] = Preferences::getEncryptedForUser($user, 'ntfy_server', 'https://ntfy.sh')->data;
|
$settings['ntfy_server'] = Preferences::getEncryptedForUser($user, 'ntfy_server', 'https://ntfy.sh')->data;
|
||||||
$settings['ntfy_topic'] = Preferences::getEncryptedForUser($user, 'ntfy_topic', '')->data;
|
$settings['ntfy_topic'] = Preferences::getEncryptedForUser($user, 'ntfy_topic', '')->data;
|
||||||
$settings['ntfy_auth'] = Preferences::getForUser($user, 'ntfy_auth', false)->data;
|
$settings['ntfy_auth'] = '1' === Preferences::getForUser($user, 'ntfy_auth', false)->data;
|
||||||
$settings['ntfy_user'] = Preferences::getEncryptedForUser($user, 'ntfy_user', '')->data;
|
$settings['ntfy_user'] = Preferences::getEncryptedForUser($user, 'ntfy_user', '')->data;
|
||||||
$settings['ntfy_pass'] = Preferences::getEncryptedForUser($user, 'ntfy_pass', '')->data;
|
$settings['ntfy_pass'] = Preferences::getEncryptedForUser($user, 'ntfy_pass', '')->data;
|
||||||
Log::debug(sprintf('Auth is %s, user = "%s"', var_export($settings['ntfy_auth'], true), $settings['ntfy_user']));
|
Log::debug(sprintf('Auth is %s, user = "%s"', var_export($settings['ntfy_auth'], true), $settings['ntfy_user']));
|
||||||
|
Reference in New Issue
Block a user