The channel settings are now available on the site settings

This commit is contained in:
Michael 2023-12-03 09:45:13 +00:00
parent e0fb149466
commit f93192bc28
6 changed files with 402 additions and 257 deletions

View file

@ -147,6 +147,17 @@ class Site extends BaseAdmin
$relay_server_tags = (!empty($_POST['relay_server_tags']) ? trim($_POST['relay_server_tags']) : ''); $relay_server_tags = (!empty($_POST['relay_server_tags']) ? trim($_POST['relay_server_tags']) : '');
$relay_deny_tags = (!empty($_POST['relay_deny_tags']) ? trim($_POST['relay_deny_tags']) : ''); $relay_deny_tags = (!empty($_POST['relay_deny_tags']) ? trim($_POST['relay_deny_tags']) : '');
$relay_user_tags = !empty($_POST['relay_user_tags']); $relay_user_tags = !empty($_POST['relay_user_tags']);
$relay_deny_undetected_language = !empty($_POST['relay_deny_undetected_language']);
$relay_language_quality = (!empty($_POST['relay_language_quality']) ? (float)($_POST['relay_language_quality']) : 0);
$relay_languages = (!empty($_POST['relay_languages']) ? intval($_POST['relay_languages']) : 0);
$engagement_hours = (!empty($_POST['engagement_hours']) ? intval($_POST['engagement_hours']) : 0);
$engagement_post_limit = (!empty($_POST['engagement_post_limit']) ? intval($_POST['engagement_post_limit']) : 0);
$interaction_score_days = (!empty($_POST['interaction_score_days']) ? intval($_POST['interaction_score_days']) : 0);
$max_posts_per_author = (!empty($_POST['max_posts_per_author']) ? intval($_POST['max_posts_per_author']) : 0);
$sharer_interaction_days = (!empty($_POST['sharer_interaction_days']) ? intval($_POST['sharer_interaction_days']) : 0);
$active_panel = (!empty($_POST['active_panel']) ? "#" . trim($_POST['active_panel']) : ''); $active_panel = (!empty($_POST['active_panel']) ? "#" . trim($_POST['active_panel']) : '');
$transactionConfig = DI::config()->beginTransaction(); $transactionConfig = DI::config()->beginTransaction();
@ -298,6 +309,15 @@ class Site extends BaseAdmin
$transactionConfig->set('system', 'relay_server_tags' , $relay_server_tags); $transactionConfig->set('system', 'relay_server_tags' , $relay_server_tags);
$transactionConfig->set('system', 'relay_deny_tags' , $relay_deny_tags); $transactionConfig->set('system', 'relay_deny_tags' , $relay_deny_tags);
$transactionConfig->set('system', 'relay_user_tags' , $relay_user_tags); $transactionConfig->set('system', 'relay_user_tags' , $relay_user_tags);
$transactionConfig->set('system', 'relay_deny_undetected_language', $relay_deny_undetected_language);
$transactionConfig->set('system', 'relay_language_quality' , $relay_language_quality);
$transactionConfig->set('system', 'relay_languages' , $relay_languages);
$transactionConfig->set('channel', 'engagement_hours' , $engagement_hours);
$transactionConfig->set('channel', 'engagement_post_limit' , $engagement_post_limit);
$transactionConfig->set('channel', 'interaction_score_days' , $interaction_score_days);
$transactionConfig->set('channel', 'max_posts_per_author' , $max_posts_per_author);
$transactionConfig->set('channel', 'sharer_interaction_days', $sharer_interaction_days);
$transactionConfig->commit(); $transactionConfig->commit();
@ -422,6 +442,7 @@ class Site extends BaseAdmin
'$no_relay_list' => DI::l10n()->t('The system is not subscribed to any relays at the moment.'), '$no_relay_list' => DI::l10n()->t('The system is not subscribed to any relays at the moment.'),
'$relay_list_title' => DI::l10n()->t('The system is currently subscribed to the following relays:'), '$relay_list_title' => DI::l10n()->t('The system is currently subscribed to the following relays:'),
'$relay_list' => Relay::getList(['url']), '$relay_list' => Relay::getList(['url']),
'$channel_title' => DI::l10n()->t('Channels'),
'$relocate' => DI::l10n()->t('Relocate Node'), '$relocate' => DI::l10n()->t('Relocate Node'),
'$relocate_msg' => DI::l10n()->t('Relocating your node enables you to change the DNS domain of this node and keep all the existing users and posts. This process takes a while and can only be started from the relocate console command like this:'), '$relocate_msg' => DI::l10n()->t('Relocating your node enables you to change the DNS domain of this node and keep all the existing users and posts. This process takes a while and can only be started from the relocate console command like this:'),
'$relocate_cmd' => DI::l10n()->t('(Friendica directory)# bin/console relocate https://newdomain.com'), '$relocate_cmd' => DI::l10n()->t('(Friendica directory)# bin/console relocate https://newdomain.com'),
@ -529,6 +550,15 @@ class Site extends BaseAdmin
'$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.')], '$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.')],
'$relay_deny_tags' => ['relay_deny_tags', DI::l10n()->t('Deny Server tags'), DI::config()->get('system', 'relay_deny_tags'), DI::l10n()->t('Comma separated list of tags that are rejected.')], '$relay_deny_tags' => ['relay_deny_tags', DI::l10n()->t('Deny Server tags'), DI::config()->get('system', 'relay_deny_tags'), DI::l10n()->t('Comma separated list of tags that are rejected.')],
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags'), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')], '$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags'), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],
'$relay_deny_undetected_language' => ['relay_deny_undetected_language', DI::l10n()->t('Deny undetected languages'), DI::config()->get('system', 'relay_deny_undetected_language'), DI::l10n()->t('If enabled, posts with undetected languages will be rejected.')],
'$relay_language_quality' => ['relay_language_quality', DI::l10n()->t('Language Quality'), DI::config()->get('system', 'relay_language_quality'), DI::l10n()->t('The minimum language quality that is required to accept the post.')],
'$relay_languages' => ['relay_languages', DI::l10n()->t('Number of languages for the language detection'), DI::config()->get('system', 'relay_languages'), DI::l10n()->t('The system detects a list of languages per post. Only if the desired languages are in the list, the message will be accepted. The higher the number, the more posts will be falsely detected.')],
'$engagement_hours' => ['engagement_hours', DI::l10n()->t('Maximum age of channel'), DI::config()->get('channel', 'engagement_hours'), DI::l10n()->t('This defines the maximum age of items that should be displayed in channels. This affects the channel performance.')],
'$engagement_post_limit' => ['engagement_post_limit', DI::l10n()->t('Maximum number of channel posts'), DI::config()->get('channel', 'engagement_post_limit'), DI::l10n()->t('For performance reasons, the channels use a dedicated table to store content. The higher the value the slower the channels.')],
'$interaction_score_days' => ['interaction_score_days', DI::l10n()->t('Interaction score days'), DI::config()->get('channel', 'interaction_score_days'), DI::l10n()->t('Number of days that are used to calculate the interaction score.')],
'$max_posts_per_author' => ['max_posts_per_author', DI::l10n()->t('Maximum number of posts per author'), DI::config()->get('channel', 'max_posts_per_author'), DI::l10n()->t('Maximum number of posts per page by author. If there are more posts, then the post with the most interactions will be displayed.')],
'$sharer_interaction_days' => ['sharer_interaction_days', DI::l10n()->t('Sharer interaction days'), DI::config()->get('channel', 'sharer_interaction_days'), DI::l10n()->t('Number of days of the last interaction that are used to define which sharers are used for the "sharers of sharers" channel.')],
'$form_security_token' => self::getFormSecurityToken('admin_site'), '$form_security_token' => self::getFormSecurityToken('admin_site'),
'$relocate_button' => DI::l10n()->t('Start Relocation'), '$relocate_button' => DI::l10n()->t('Start Relocation'),

View file

@ -542,18 +542,6 @@ return [
// Redistribute incoming activities via ActivityPub // Redistribute incoming activities via ActivityPub
'redistribute_activities' => true, 'redistribute_activities' => true,
// relay_deny_undetected_language (Boolean)
// Deny undetected languages
'relay_deny_undetected_language' => false,
// relay_language_quality (Float)
// Minimum value for the language detection quality for relay posts. The value must be between 0 and 1.
'relay_language_quality' => 0,
// relay_languages (Integer)
// Number of languages that are used per post to check for acceptable posts.
'relay_languages' => 10,
// session_handler (database|cache|native) // session_handler (database|cache|native)
// Whether to use Cache to store session data or to use PHP native session storage. // Whether to use Cache to store session data or to use PHP native session storage.
'session_handler' => 'database', 'session_handler' => 'database',
@ -772,25 +760,4 @@ return [
// Wether the blocklist is publicly listed under /about (or in any later API) // Wether the blocklist is publicly listed under /about (or in any later API)
'public' => true, 'public' => true,
], ],
'channel' => [
// engagement_hours (Integer)
// Maximum age of incoming posts for the engagement table, when the engagement post limit is 0 or hasn't been reached yet.
'engagement_hours' => 24,
// engagement_post_limit (Integer)
// NUmber of posts that are held in the engagement table
'engagement_post_limit' => 20000,
// interaction_score_days (Integer)
// Number of days that are used to calculate the interaction score.
'interaction_score_days' => 30,
// max_posts_per_author (Integer)
// Maixmum number of posts per page by author
'max_posts_per_author' => 2,
// sharer_interaction_days (Integer)
// Number of days of the last interaction that are used to define which sharers are used for the "sharers of sharers" channel.
'sharer_interaction_days' => 90,
],
]; ];

View file

@ -192,6 +192,18 @@ return [
// Comma separated list of tags that are rejected. // Comma separated list of tags that are rejected.
'relay_deny_tags' => '', 'relay_deny_tags' => '',
// relay_deny_undetected_language (Boolean)
// Deny undetected languages
'relay_deny_undetected_language' => false,
// relay_languages (Integer)
// Number of languages that are used per post to check for acceptable posts.
'relay_languages' => 10,
// relay_language_quality (Float)
// Minimum value for the language detection quality for relay posts. The value must be between 0 and 1.
'relay_language_quality' => 0,
// proxify_content (Boolean) // proxify_content (Boolean)
// Use the proxy functionality for fetching external content // Use the proxy functionality for fetching external content
'proxify_content' => true, 'proxify_content' => true,
@ -242,6 +254,28 @@ return [
'worker_load_cooldown' => 0, 'worker_load_cooldown' => 0,
], ],
'channel' => [
// engagement_hours (Integer)
// Maximum age of incoming posts for the engagement table, when the engagement post limit is 0 or hasn't been reached yet.
'engagement_hours' => 24,
// engagement_post_limit (Integer)
// NUmber of posts that are held in the engagement table
'engagement_post_limit' => 20000,
// interaction_score_days (Integer)
// Number of days that are used to calculate the interaction score.
'interaction_score_days' => 30,
// max_posts_per_author (Integer)
// Maixmum number of posts per page by author
'max_posts_per_author' => 2,
// sharer_interaction_days (Integer)
// Number of days of the last interaction that are used to define which sharers are used for the "sharers of sharers" channel.
'sharer_interaction_days' => 90,
],
// Used in the admin settings to lock certain features // Used in the admin settings to lock certain features
'featurelock' => [ 'featurelock' => [
], ],

File diff suppressed because it is too large Load diff

View file

@ -150,6 +150,16 @@
{{include file="field_input.tpl" field=$relay_deny_tags}} {{include file="field_input.tpl" field=$relay_deny_tags}}
{{include file="field_checkbox.tpl" field=$relay_user_tags}} {{include file="field_checkbox.tpl" field=$relay_user_tags}}
{{include file="field_checkbox.tpl" field=$relay_directly}} {{include file="field_checkbox.tpl" field=$relay_directly}}
{{include file="field_checkbox.tpl" field=$relay_deny_undetected_language}}
{{include file="field_input.tpl" field=$relay_language_quality}}
{{include file="field_input.tpl" field=$relay_languages}}
<h2>{{$channel_title}}</h2>
{{include file="field_input.tpl" field=$engagement_hours}}
{{include file="field_input.tpl" field=$engagement_post_limit}}
{{include file="field_input.tpl" field=$interaction_score_days}}
{{include file="field_input.tpl" field=$max_posts_per_author}}
{{include file="field_input.tpl" field=$sharer_interaction_days}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}"/></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit}}"/></div>

View file

@ -319,6 +319,34 @@
{{include file="field_input.tpl" field=$relay_deny_tags}} {{include file="field_input.tpl" field=$relay_deny_tags}}
{{include file="field_checkbox.tpl" field=$relay_user_tags}} {{include file="field_checkbox.tpl" field=$relay_user_tags}}
{{include file="field_checkbox.tpl" field=$relay_directly}} {{include file="field_checkbox.tpl" field=$relay_directly}}
{{include file="field_checkbox.tpl" field=$relay_deny_undetected_language}}
{{include file="field_input.tpl" field=$relay_language_quality}}
{{include file="field_input.tpl" field=$relay_languages}}
</div>
<div class="panel-footer">
<input type="submit" name="page_site" class="btn btn-primary" value="{{$submit}}"/>
</div>
</div>
</div>
<!--
/*
* Channel
*/ -->
<div class="panel">
<div class="section-subtitle-wrapper panel-heading" role="tab" id="admin-channel">
<h2>
<button class="btn-link accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-channel-collapse" aria-expanded="false" aria-controls="admin-settings-channel-collapse">
{{$channel_title}}
</button>
</h2>
</div>
<div id="admin-settings-channel-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-channel">
<div class="panel-body">
{{include file="field_input.tpl" field=$engagement_hours}}
{{include file="field_input.tpl" field=$engagement_post_limit}}
{{include file="field_input.tpl" field=$interaction_score_days}}
{{include file="field_input.tpl" field=$max_posts_per_author}}
{{include file="field_input.tpl" field=$sharer_interaction_days}}
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<input type="submit" name="page_site" class="btn btn-primary" value="{{$submit}}"/> <input type="submit" name="page_site" class="btn btn-primary" value="{{$submit}}"/>