From e99c916df1fe981b57a055765f2aff1ce201c1eb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 3 Dec 2023 13:43:48 +0000 Subject: [PATCH] Some more settings moved to the admin frontend --- src/Module/Admin/Site.php | 14 +++++++++++++- static/defaults.config.php | 16 ---------------- static/settings.config.php | 16 ++++++++++++++++ view/templates/admin/site.tpl | 4 ++++ view/theme/frio/templates/admin/site.tpl | 6 +++++- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index d4a0a753a0..05cb35641d 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -97,6 +97,7 @@ class Site extends BaseAdmin $explicit_content = !empty($_POST['explicit_content']); $proxify_content = !empty($_POST['proxify_content']); $local_search = !empty($_POST['local_search']); + $blocked_tags = (!empty($_POST['blocked_tags']) ? trim($_POST['blocked_tags']) : ''); $cache_contact_avatar = !empty($_POST['cache_contact_avatar']); $enable_multi_reg = !empty($_POST['enable_multi_reg']); @@ -136,6 +137,8 @@ class Site extends BaseAdmin $singleuser = (!empty($_POST['singleuser']) ? trim($_POST['singleuser']) : ''); $only_tag_search = !empty($_POST['only_tag_search']); $compute_circle_counts = !empty($_POST['compute_circle_counts']); + $process_view = !empty($_POST['process_view']); + $archival_days = (!empty($_POST['archival_days']) ? intval($_POST['archival_days']) : 0); $check_new_version_url = (!empty($_POST['check_new_version_url']) ? trim($_POST['check_new_version_url']) : 'none'); $worker_queues = (!empty($_POST['worker_queues']) ? intval($_POST['worker_queues']) : 10); @@ -143,6 +146,7 @@ class Site extends BaseAdmin $worker_fastlane = !empty($_POST['worker_fastlane']); $decoupled_receiver = (!empty($_POST['decoupled_receiver']) ? intval(trim($_POST['decoupled_receiver'])) : false); $cron_interval = (!empty($_POST['cron_interval']) ? intval($_POST['cron_interval']) : 0); + $worker_defer_limit = (!empty($_POST['worker_defer_limit']) ? intval($_POST['worker_defer_limit']) : 15); $relay_directly = !empty($_POST['relay_directly']); $relay_scope = (!empty($_POST['relay_scope']) ? trim($_POST['relay_scope']) : ''); @@ -258,6 +262,7 @@ class Site extends BaseAdmin $transactionConfig->set('system', 'explicit_content' , $explicit_content); $transactionConfig->set('system', 'proxify_content' , $proxify_content); $transactionConfig->set('system', 'local_search' , $local_search); + $transactionConfig->set('system', 'blocked_tags' , $blocked_tags); $transactionConfig->set('system', 'cache_contact_avatar' , $cache_contact_avatar); $transactionConfig->set('system', 'check_new_version_url' , $check_new_version_url); @@ -301,12 +306,15 @@ class Site extends BaseAdmin $transactionConfig->set('system', 'only_tag_search' , $only_tag_search); $transactionConfig->set('system', 'compute_circle_counts', $compute_circle_counts); + $transactionConfig->set('system', 'process_view', $process_view); + $transactionConfig->set('system', 'archival_days', $archival_days); $transactionConfig->set('system', 'worker_queues' , $worker_queues); $transactionConfig->set('system', 'worker_load_cooldown', $worker_load_cooldown); $transactionConfig->set('system', 'worker_fastlane' , $worker_fastlane); $transactionConfig->set('system', 'decoupled_receiver' , $decoupled_receiver); $transactionConfig->set('system', 'cron_interval' , $cron_interval); + $transactionConfig->set('system', 'worker_defer_limit' , $worker_defer_limit); $transactionConfig->set('system', 'relay_directly' , $relay_directly); $transactionConfig->set('system', 'relay_scope' , $relay_scope); @@ -494,6 +502,7 @@ class Site extends BaseAdmin '$explicit_content' => ['explicit_content', DI::l10n()->t('Explicit Content'), DI::config()->get('system', 'explicit_content'), DI::l10n()->t('Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page.')], '$proxify_content' => ['proxify_content', DI::l10n()->t('Proxify external content'), DI::config()->get('system', 'proxify_content'), DI::l10n()->t('Route external content via the proxy functionality. This is used for example for some OEmbed accesses and in some other rare cases.')], '$local_search' => ['local_search', DI::l10n()->t('Only local search'), DI::config()->get('system', 'local_search'), DI::l10n()->t('Blocks search for users who are not logged in to prevent crawlers from blocking your system.')], + '$blocked_tags' => ['blocked_tags', DI::l10n()->t('Blocked tags for trending tags'), DI::config()->get('system', 'blocked_tags'), DI::l10n()->t("Comma separated list of hashtags that shouldn't be displayed in the trending tags.")], '$cache_contact_avatar' => ['cache_contact_avatar', DI::l10n()->t('Cache contact avatars'), DI::config()->get('system', 'cache_contact_avatar'), DI::l10n()->t('Locally store the avatar pictures of the contacts. This uses a lot of storage space but it increases the performance.')], '$allow_users_remote_self'=> ['allow_users_remote_self', DI::l10n()->t('Allow Users to set remote_self'), DI::config()->get('system', 'allow_users_remote_self'), DI::l10n()->t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')], '$adjust_poll_frequency' => ['adjust_poll_frequency', DI::l10n()->t('Adjust the feed poll frequency'), DI::config()->get('system', 'adjust_poll_frequency'), DI::l10n()->t('Automatically detect and set the best feed poll frequency.')], @@ -544,13 +553,16 @@ class Site extends BaseAdmin '$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')], '$only_tag_search' => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')], '$compute_circle_counts' => ['compute_circle_counts', DI::l10n()->t('Generate counts per contact circle when calculating network count'), DI::config()->get('system', 'compute_circle_counts'), DI::l10n()->t('On systems with users that heavily use contact circles the query can be very expensive.')], + '$process_view' => ['process_view', DI::l10n()->t('Process "view" activities'), DI::config()->get('system', 'process_view'), DI::l10n()->t('"view" activities are mostly geberated by Peertube systems. Per default they are not processed for performance reasons. Only activate this option on performant system.')], + '$archival_days' => ['archival_days', DI::l10n()->t('Days, after which a contact is archived'), DI::config()->get('system', 'archival_days'), DI::l10n()->t('Number of days that we try to deliver content or to update the contact data before we archive a contact.')], '$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::l10n()->t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)], '$worker_load_cooldown' => ['worker_load_cooldown', DI::l10n()->t('Maximum load for workers'), DI::config()->get('system', 'worker_load_cooldown'), DI::l10n()->t('Maximum load that causes a cooldown before each worker function call.')], '$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')], '$decoupled_receiver' => ['decoupled_receiver', DI::l10n()->t('Decoupled receiver'), DI::config()->get('system', 'decoupled_receiver'), DI::l10n()->t('Decouple incoming ActivityPub posts by processing them in the background via a worker process. Only enable this on fast systems.')], '$cron_interval' => ['cron_interval', DI::l10n()->t('Cron interval'), DI::config()->get('system', 'decoupled_receiver'), DI::l10n()->t('Minimal period in minutes between two calls of the "Cron" worker job.')], - + '$worker_defer_limit' => ['worker_defer_limit', DI::l10n()->t('Worker defer limit'), DI::config()->get('system', 'worker_defer_limit'), DI::l10n()->t('Per default the systems tries delivering for 15 times before dropping it.')], + '$relay_directly' => ['relay_directly', DI::l10n()->t('Direct relay transfer'), DI::config()->get('system', 'relay_directly'), DI::l10n()->t('Enables the direct transfer to other servers without using the relay servers')], '$relay_scope' => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [Relay::SCOPE_NONE => DI::l10n()->t('Disabled'), Relay::SCOPE_ALL => DI::l10n()->t('all'), Relay::SCOPE_TAGS => DI::l10n()->t('tags')]], '$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')], diff --git a/static/defaults.config.php b/static/defaults.config.php index 3b537195c5..f65e6c9dbd 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -105,10 +105,6 @@ return [ // Addresses non-mentioned ActivityPub receivers by BCC instead of CC. Increases privacy, decreases performance. 'ap_always_bcc' => false, - // archival_days (Integer) - // Number of days that we try to deliver content before we archive a contact. - 'archival_days' => 32, - // auth_cookie_lifetime (Integer) // Number of days that should pass without any activity before a user who // chose "Remember me" when logging in is considered logged out. @@ -144,10 +140,6 @@ return [ // Deny public access to the local user directory. 'block_local_dir' => false, - // blocked_tags (String) - // Comma separated list of hashtags that shouldn't be displayed in the trending tags - 'blocked_tags' => '', - // community_no_sharer (Boolean) // Don't display sharing accounts on the global community 'community_no_sharer' => false, @@ -499,10 +491,6 @@ return [ // Sets the ImageMagick compression level for PNG images. Values range from 0 (uncompressed) to 9 (most compressed). 'png_quality' => 8, - // process_view (Boolean) - // Process the "View" activity that is used by Peertube. - 'process_view' => false, - // profiler (Boolean) // Enable internal timings to help optimize code. Needed for "rendertime" addon. 'profiler' => false, @@ -667,10 +655,6 @@ return [ // Does not work when "worker_fork" is enabled (Needs more testing) 'worker_multiple_fetch' => false, - // worker_defer_limit (Integer) - // Per default the systems tries delivering for 15 times before dropping it. - 'worker_defer_limit' => 15, - // xrd_timeout (Integer) // Timeout in seconds for fetching the XRD links and other requests with an expected shorter timeout 'xrd_timeout' => 20, diff --git a/static/settings.config.php b/static/settings.config.php index 1bb3ace054..3c577bf2b7 100644 --- a/static/settings.config.php +++ b/static/settings.config.php @@ -64,10 +64,18 @@ return [ // Themes users can change to in their settings. 'allowed_themes' => 'frio,vier', + // archival_days (Integer) + // Number of days that we try to deliver content before we archive a contact. + 'archival_days' => 32, + // banner (HTML string) // HTML snippet of the top navigation banner. Not supported by frio. 'banner' => 'logoFriendica', + // blocked_tags (String) + // Comma separated list of hashtags that shouldn't be displayed in the trending tags + 'blocked_tags' => '', + // cache_contact_avatar (Boolean) // Cache versions of the contact avatars. Uses a lot of storage space 'cache_contact_avatar' => true, @@ -188,6 +196,10 @@ return [ // Periodically (once an hour) run an "optimize table" command for cache tables 'optimize_tables' => false, + // process_view (Boolean) + // Process the "View" activity that is used by Peertube. + 'process_view' => false, + // register_notification (Boolean) // Send a notification mail to the admin for each new registration. 'register_notification' => true, @@ -253,6 +265,10 @@ return [ // Number of days after which a server is requeried for their contacts and servers it knows of. 'poco_requery_days' => 30, + // worker_defer_limit (Integer) + // Per default the systems tries delivering for 15 times before dropping it. + 'worker_defer_limit' => 15, + // worker_load_cooldown (Integer) // Maximum load that causes a cooldown before each worker function call. 'worker_load_cooldown' => 0, diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index ed16c761fd..e047b62aad 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -87,6 +87,7 @@ {{include file="field_checkbox.tpl" field=$explicit_content}} {{include file="field_checkbox.tpl" field=$proxify_content}} {{include file="field_checkbox.tpl" field=$local_search}} + {{include file="field_input.tpl" field=$blocked_tags}}

{{$advanced}}

@@ -123,6 +124,8 @@ {{include file="field_checkbox.tpl" field=$cache_contact_avatar}} {{include file="field_input.tpl" field=$min_poll_interval}} {{include file="field_input.tpl" field=$cron_interval}} + {{include file="field_checkbox.tpl" field=$process_view}} + {{include file="field_input.tpl" field=$archival_days}}

{{$worker_title}}

@@ -132,6 +135,7 @@ {{include file="field_input.tpl" field=$worker_load_cooldown}} {{include file="field_checkbox.tpl" field=$worker_fastlane}} {{include file="field_checkbox.tpl" field=$decoupled_receiver}} + {{include file="field_input.tpl" field=$worker_defer_limit}}
diff --git a/view/theme/frio/templates/admin/site.tpl b/view/theme/frio/templates/admin/site.tpl index ddfbf7f7e1..a3be0a4315 100644 --- a/view/theme/frio/templates/admin/site.tpl +++ b/view/theme/frio/templates/admin/site.tpl @@ -167,7 +167,8 @@ {{include file="field_checkbox.tpl" field=$explicit_content}} {{include file="field_checkbox.tpl" field=$proxify_content}} {{include file="field_checkbox.tpl" field=$local_search}} - + {{include file="field_input.tpl" field=$blocked_tags}} + @@ -257,6 +258,8 @@ {{include file="field_checkbox.tpl" field=$cache_contact_avatar}} {{include file="field_input.tpl" field=$min_poll_interval}} {{include file="field_input.tpl" field=$cron_interval}} + {{include file="field_checkbox.tpl" field=$process_view}} + {{include file="field_input.tpl" field=$archival_days}}