Merge pull request #13677 from annando/site-settings

Several settings can now be reached via the site settings
This commit is contained in:
Hypolite Petovan 2023-11-28 12:01:58 -05:00 committed by GitHub
commit 9fb493bf18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 292 additions and 239 deletions

View file

@ -92,8 +92,10 @@ class Site extends BaseAdmin
$private_addons = !empty($_POST['private_addons']);
$disable_embedded = !empty($_POST['disable_embedded']);
$allow_users_remote_self = !empty($_POST['allow_users_remote_self']);
$adjust_poll_frequency = !empty($_POST['adjust_poll_frequency']);
$explicit_content = !empty($_POST['explicit_content']);
$proxify_content = !empty($_POST['proxify_content']);
$local_search = !empty($_POST['local_search']);
$cache_contact_avatar = !empty($_POST['cache_contact_avatar']);
$enable_multi_reg = !empty($_POST['enable_multi_reg']);
@ -136,7 +138,9 @@ class Site extends BaseAdmin
$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);
$worker_load_cooldown = (!empty($_POST['worker_load_cooldown']) ? intval($_POST['worker_load_cooldown']) : 0);
$worker_fastlane = !empty($_POST['worker_fastlane']);
$decoupled_receiver = (!empty($_POST['decoupled_receiver']) ? intval(trim($_POST['decoupled_receiver'])) : false);
$relay_directly = !empty($_POST['relay_directly']);
$relay_scope = (!empty($_POST['relay_scope']) ? trim($_POST['relay_scope']) : '');
@ -236,8 +240,10 @@ class Site extends BaseAdmin
$transactionConfig->set('system', 'enotify_no_content' , $enotify_no_content);
$transactionConfig->set('system', 'disable_embedded' , $disable_embedded);
$transactionConfig->set('system', 'allow_users_remote_self', $allow_users_remote_self);
$transactionConfig->set('system', 'adjust_poll_frequency' , $adjust_poll_frequency);
$transactionConfig->set('system', 'explicit_content' , $explicit_content);
$transactionConfig->set('system', 'proxify_content' , $proxify_content);
$transactionConfig->set('system', 'local_search' , $local_search);
$transactionConfig->set('system', 'cache_contact_avatar' , $cache_contact_avatar);
$transactionConfig->set('system', 'check_new_version_url' , $check_new_version_url);
@ -283,7 +289,9 @@ class Site extends BaseAdmin
$transactionConfig->set('system', 'compute_circle_counts', $compute_circle_counts);
$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', 'relay_directly' , $relay_directly);
$transactionConfig->set('system', 'relay_scope' , $relay_scope);
@ -460,8 +468,10 @@ class Site extends BaseAdmin
'$disable_embedded' => ['disable_embedded', DI::l10n()->t('Don\'t embed private images in posts'), DI::config()->get('system', 'disable_embedded'), DI::l10n()->t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
'$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.')],
'$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.')],
'$enable_multi_reg' => ['enable_multi_reg', DI::l10n()->t('Enable multiple registrations'), !DI::config()->get('system', 'block_extended_register'), DI::l10n()->t('Enable users to register additional accounts for use as pages.')],
'$enable_openid' => ['enable_openid', DI::l10n()->t('Enable OpenID'), !DI::config()->get('system', 'no_openid'), DI::l10n()->t('Enable OpenID support for registration and logins.')],
'$enable_regfullname' => ['enable_regfullname', DI::l10n()->t('Enable full name check'), !DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Prevents users from registering with a display name with fewer than two parts separated by spaces.')],
@ -510,7 +520,9 @@ class Site extends BaseAdmin
'$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.')],
'$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.')],
'$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')]],

View file

@ -612,6 +612,7 @@ class Image
$dest = imagecreatetruecolor($max, $max);
imagealphablending($dest, false);
imagesavealpha($dest, true);
if ($this->type=='image/png') {
imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
}

View file

@ -93,10 +93,6 @@ return [
'php_path' => 'php',
],
'system' => [
// adjust_poll_frequency (Boolean)
// Automatically detect and set the best feed poll frequency.
'adjust_poll_frequency' => false,
// allowed_link_protocols (Array)
// Allowed protocols in links URLs, add at your own risk. http(s) is always allowed.
'allowed_link_protocols' => ['ftp://', 'ftps://', 'mailto:', 'cid:', 'gopher://'],
@ -138,7 +134,7 @@ return [
// big_emojis (Boolean)
// Display "Emoji Only" posts in big.
'big_emojis' => false,
'big_emojis' => true,
// bulk_delivery (Boolean)
// Delivers AP messages in a bulk (experimental)
@ -168,10 +164,6 @@ return [
// Whether to use Memcache, Memcached, Redis or APCu to store temporary cache.
'cache_driver' => 'database',
// decoupled_receiver (Boolean)
// Decouple incoming AP posts by doing the processing in the background.
'decoupled_receiver' => false,
// distributed_cache_driver (database|memcache|memcached|redis)
// Whether to use database, Memcache, Memcached or Redis as a distributed cache.
'distributed_cache_driver' => 'database',
@ -184,10 +176,6 @@ return [
// Allow to switch the configuration adapter to improve performances at the cost of memory consumption.
'config_adapter' => 'jit',
// curl_range_bytes (Integer)
// Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".
'curl_range_bytes' => 0,
// crawl_permit_period (Integer)
// Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated.
'crawl_permit_period' => 60,
@ -372,13 +360,9 @@ return [
// Used in conjunction with "block_public".
'local_block' => false,
// local_search (Boolean)
// Blocks search for users who are not logged in to prevent crawlers from blocking your system.
'local_search' => false,
// local_tags (Boolean)
// If activated, all hashtags will point to the local server.
'local_tags' => false,
'local_tags' => true,
// lock_driver (semaphore|database|memcache|memcached|redis|apcu)
// Whether to use semaphores, the database, Memcache, Memcached, Redis or APCu to handle locks.
@ -636,10 +620,6 @@ return [
// Transmit pending events upon accepted contact request for groups
'transmit_pending_events' => false,
// update_active_contacts (Boolean)
// When activated, only public contacts will be activated regularly that are used for example in items or tags.
'update_active_contacts' => false,
// username_min_length (Integer)
// The minimum character length a username can be.
// This length is checked once the username has been trimmed and multiple spaces have been collapsed into one.
@ -677,10 +657,6 @@ return [
// List of minutes for the jobs per minute (JPM) calculation
'worker_jpm_range' => '1, 10, 60',
// worker_load_cooldown (Integer)
// Maximum load that causes a cooldown before each worker function call.
'worker_load_cooldown' => 0,
// worker_load_exponent (Integer)
// Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load.
// For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1.

View file

@ -56,6 +56,10 @@ return [
// Checks for missing entries in "post", "post-thread" or "post-thread-user" and creates them
'add_missing_posts' => false,
// adjust_poll_frequency (Boolean)
// Automatically detect and set the best feed poll frequency.
'adjust_poll_frequency' => false,
// allowed_themes (Comma-separated list)
// Themes users can change to in their settings.
'allowed_themes' => 'frio,vier',
@ -96,6 +100,10 @@ return [
// Enable/Disable Debugging (logging)
'debugging' => false,
// decoupled_receiver (Boolean)
// Decouple incoming AP posts by doing the processing in the background.
'decoupled_receiver' => false,
// default_timezone (String)
// Choose a default timezone. See https://secure.php.net/manual/en/timezones.php
// It only applies to timestamps for anonymous viewers.
@ -127,6 +135,10 @@ return [
// Two-letters ISO 639-1 code.
'language' => 'en',
// local_search (Boolean)
// Blocks search for users who are not logged in to prevent crawlers from blocking your system.
'local_search' => false,
// logfile (String)
// The logfile for storing logs.
// Can be a full path or a relative path to the Friendica home directory
@ -208,6 +220,10 @@ return [
// System theme name.
'theme' => 'frio',
// update_active_contacts (Boolean)
// When activated, only public contacts will be activated regularly that are used for example in items or tags.
'update_active_contacts' => false,
// url (String)
// The fully-qualified URL of this Friendica node.
// Used by the worker in a non-HTTP execution environment.
@ -220,6 +236,10 @@ return [
// poco_requery_days (Integer)
// Number of days after which a server is requeried for their contacts and servers it knows of.
'poco_requery_days' => 30,
// worker_load_cooldown (Integer)
// Maximum load that causes a cooldown before each worker function call.
'worker_load_cooldown' => 0,
],
// Used in the admin settings to lock certain features

File diff suppressed because it is too large Load diff

View file

@ -83,8 +83,10 @@
{{include file="field_checkbox.tpl" field=$private_addons}}
{{include file="field_checkbox.tpl" field=$disable_embedded}}
{{include file="field_checkbox.tpl" field=$allow_users_remote_self}}
{{include file="field_checkbox.tpl" field=$adjust_poll_frequency}}
{{include file="field_checkbox.tpl" field=$explicit_content}}
{{include file="field_checkbox.tpl" field=$proxify_content}}
{{include file="field_checkbox.tpl" field=$local_search}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}"/></div>
<h2>{{$advanced}}</h2>
@ -125,7 +127,9 @@
{{include file="field_input.tpl" field=$maxloadavg}}
{{include file="field_input.tpl" field=$min_memory}}
{{include file="field_input.tpl" field=$worker_queues}}
{{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}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}"/></div>

View file

@ -163,8 +163,10 @@
{{include file="field_checkbox.tpl" field=$private_addons}}
{{include file="field_checkbox.tpl" field=$disable_embedded}}
{{include file="field_checkbox.tpl" field=$allow_users_remote_self}}
{{include file="field_checkbox.tpl" field=$adjust_poll_frequency}}
{{include file="field_checkbox.tpl" field=$explicit_content}}
{{include file="field_checkbox.tpl" field=$proxify_content}}
{{include file="field_checkbox.tpl" field=$local_search}}
</div>
<div class="panel-footer">
<input type="submit" name="page_site" class="btn btn-primary" value="{{$submit}}"/>
@ -277,7 +279,9 @@
{{include file="field_input.tpl" field=$maxloadavg}}
{{include file="field_input.tpl" field=$min_memory}}
{{include file="field_input.tpl" field=$worker_queues}}
{{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}}
</div>
<div class="panel-footer">
<input type="submit" name="page_site" class="btn btn-primary" value="{{$submit}}"/>