forked from GNUsocial/gnu-social
[CONFIG][DB] Remove config from the database, put it in yaml, so it can be baked into the container
This commit is contained in:
parent
d1ea9d2fdf
commit
dd40255c4a
@ -1,12 +1,6 @@
|
||||
# This file is the entry point to configure your own services.
|
||||
# Files in the packages/ subdirectory configure your dependencies.
|
||||
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||
imports:
|
||||
- resource: '../social.yaml'
|
||||
- resource: '../social.local.yaml'
|
||||
|
||||
parameters:
|
||||
|
||||
services:
|
||||
|
564
social.yaml
564
social.yaml
@ -1,3 +1,563 @@
|
||||
parameters:
|
||||
remember_me_httponly: true
|
||||
remember_me_samesite: strict
|
||||
remember_me_httponly: true
|
||||
remember_me_samesite: strict
|
||||
|
||||
gnusocial:
|
||||
site:
|
||||
name: GNU social
|
||||
notice:
|
||||
theme: default
|
||||
logo:
|
||||
language: en
|
||||
detect_language: true
|
||||
languages:
|
||||
af:
|
||||
q: 0.8
|
||||
lang: af
|
||||
name: Afrikaans
|
||||
direction: ltr
|
||||
ar:
|
||||
q: 0.8
|
||||
lang: ar
|
||||
name: Arabic
|
||||
direction: rtl
|
||||
ast:
|
||||
q: 1
|
||||
lang: ast
|
||||
name: Asturian
|
||||
direction: ltr
|
||||
eu:
|
||||
q: 1
|
||||
lang: eu
|
||||
name: Basque
|
||||
direction: ltr
|
||||
be-tarask:
|
||||
q: 0.5
|
||||
lang: be-tarask
|
||||
name: Belarusian (Taraškievica orthography)
|
||||
direction: ltr
|
||||
br:
|
||||
q: 0.8
|
||||
lang: br
|
||||
name: Breton
|
||||
direction: ltr
|
||||
bg:
|
||||
q: 0.8
|
||||
lang: bg
|
||||
name: Bulgarian
|
||||
direction: ltr
|
||||
my:
|
||||
q: 1
|
||||
lang: my
|
||||
name: Burmese
|
||||
direction: ltr
|
||||
ca:
|
||||
q: 0.5
|
||||
lang: ca
|
||||
name: Catalan
|
||||
direction: ltr
|
||||
zh-cn:
|
||||
q: 0.9
|
||||
lang: zh_CN
|
||||
name: Chinese (Simplified)
|
||||
direction: ltr
|
||||
zh-hant:
|
||||
q: 0.2
|
||||
lang: zh_TW
|
||||
name: Chinese (Taiwanese)
|
||||
direction: ltr
|
||||
ksh:
|
||||
q: 1
|
||||
lang: ksh
|
||||
name: Colognian
|
||||
direction: ltr
|
||||
cs:
|
||||
q: 0.5
|
||||
lang: cs
|
||||
name: Czech
|
||||
direction: ltr
|
||||
da:
|
||||
q: 0.8
|
||||
lang: da
|
||||
name: Danish
|
||||
direction: ltr
|
||||
nl:
|
||||
q: 0.5
|
||||
lang: nl
|
||||
name: Dutch
|
||||
direction: ltr
|
||||
arz:
|
||||
q: 0.8
|
||||
lang: arz
|
||||
name: Egyptian Spoken Arabic
|
||||
direction: rtl
|
||||
en:
|
||||
q: 1
|
||||
lang: en
|
||||
name: English
|
||||
direction: ltr
|
||||
en-us:
|
||||
q: 1
|
||||
lang: en
|
||||
name: English (US)
|
||||
direction: ltr
|
||||
en-gb:
|
||||
q: 1
|
||||
lang: en_GB
|
||||
name: English (UK)
|
||||
direction: ltr
|
||||
eo:
|
||||
q: 0.8
|
||||
lang: eo
|
||||
name: Esperanto
|
||||
direction: ltr
|
||||
fi:
|
||||
q: 1
|
||||
lang: fi
|
||||
name: Finnish
|
||||
direction: ltr
|
||||
fr:
|
||||
q: 1
|
||||
lang: fr
|
||||
name: French
|
||||
direction: ltr
|
||||
fr-fr:
|
||||
q: 1
|
||||
lang: fr
|
||||
name: French (France)
|
||||
direction: ltr
|
||||
fur:
|
||||
q: 0.8
|
||||
lang: fur
|
||||
name: Friulian
|
||||
direction: ltr
|
||||
gl:
|
||||
q: 0.8
|
||||
lang: gl
|
||||
name: Galician
|
||||
direction: ltr
|
||||
ka:
|
||||
q: 0.8
|
||||
lang: ka
|
||||
name: Georgian
|
||||
direction: ltr
|
||||
de:
|
||||
q: 0.8
|
||||
lang: de
|
||||
name: German
|
||||
direction: ltr
|
||||
el:
|
||||
q: 0.1
|
||||
lang: el
|
||||
name: Greek
|
||||
direction: ltr
|
||||
he:
|
||||
q: 0.5
|
||||
lang: he
|
||||
name: Hebrew
|
||||
direction: rtl
|
||||
hu:
|
||||
q: 0.8
|
||||
lang: hu
|
||||
name: Hungarian
|
||||
direction: ltr
|
||||
is:
|
||||
q: 0.1
|
||||
lang: is
|
||||
name: Icelandic
|
||||
direction: ltr
|
||||
id:
|
||||
q: 1
|
||||
lang: id
|
||||
name: Indonesian
|
||||
direction: ltr
|
||||
ia:
|
||||
q: 0.8
|
||||
lang: ia
|
||||
name: Interlingua
|
||||
direction: ltr
|
||||
ga:
|
||||
q: 0.5
|
||||
lang: ga
|
||||
name: Irish
|
||||
direction: ltr
|
||||
it:
|
||||
q: 1
|
||||
lang: it
|
||||
name: Italian
|
||||
direction: ltr
|
||||
ja:
|
||||
q: 0.5
|
||||
lang: ja
|
||||
name: Japanese
|
||||
direction: ltr
|
||||
ko:
|
||||
q: 0.9
|
||||
lang: ko
|
||||
name: Korean
|
||||
direction: ltr
|
||||
lv:
|
||||
q: 1
|
||||
lang: lv
|
||||
name: Latvian
|
||||
direction: ltr
|
||||
lt:
|
||||
q: 1
|
||||
lang: lt
|
||||
name: Lithuanian
|
||||
direction: ltr
|
||||
lb:
|
||||
q: 1
|
||||
lang: lb
|
||||
name: Luxembourgish
|
||||
direction: ltr
|
||||
mk:
|
||||
q: 0.5
|
||||
lang: mk
|
||||
name: Macedonian
|
||||
direction: ltr
|
||||
mg:
|
||||
q: 1
|
||||
lang: mg
|
||||
name: Malagasy
|
||||
direction: ltr
|
||||
ms:
|
||||
q: 1
|
||||
lang: ms
|
||||
name: Malay
|
||||
direction: ltr
|
||||
ml:
|
||||
q: 0.5
|
||||
lang: ml
|
||||
name: Malayalam
|
||||
direction: ltr
|
||||
ne:
|
||||
q: 1
|
||||
lang: ne
|
||||
name: Nepali
|
||||
direction: ltr
|
||||
nb:
|
||||
q: 0.1
|
||||
lang: nb
|
||||
name: Norwegian (Bokmål)
|
||||
direction: ltr
|
||||
'no':
|
||||
q: 0.1
|
||||
lang: nb
|
||||
name: Norwegian (Bokmål)
|
||||
direction: ltr
|
||||
nn:
|
||||
q: 1
|
||||
lang: nn
|
||||
name: Norwegian (Nynorsk)
|
||||
direction: ltr
|
||||
fa:
|
||||
q: 1
|
||||
lang: fa
|
||||
name: Persian
|
||||
direction: rtl
|
||||
pl:
|
||||
q: 0.5
|
||||
lang: pl
|
||||
name: Polish
|
||||
direction: ltr
|
||||
pt:
|
||||
q: 1
|
||||
lang: pt
|
||||
name: Portuguese
|
||||
direction: ltr
|
||||
pt-br:
|
||||
q: 0.9
|
||||
lang: pt_BR
|
||||
name: Brazilian Portuguese
|
||||
direction: ltr
|
||||
ru:
|
||||
q: 0.9
|
||||
lang: ru
|
||||
name: Russian
|
||||
direction: ltr
|
||||
sr-ec:
|
||||
q: 1
|
||||
lang: sr-ec
|
||||
name: Serbian
|
||||
direction: ltr
|
||||
es:
|
||||
q: 1
|
||||
lang: es
|
||||
name: Spanish
|
||||
direction: ltr
|
||||
sv:
|
||||
q: 0.8
|
||||
lang: sv
|
||||
name: Swedish
|
||||
direction: ltr
|
||||
tl:
|
||||
q: 0.8
|
||||
lang: tl
|
||||
name: Tagalog
|
||||
direction: ltr
|
||||
ta:
|
||||
q: 1
|
||||
lang: ta
|
||||
name: Tamil
|
||||
direction: ltr
|
||||
te:
|
||||
q: 0.3
|
||||
lang: te
|
||||
name: Telugu
|
||||
direction: ltr
|
||||
tr:
|
||||
q: 0.5
|
||||
lang: tr
|
||||
name: Turkish
|
||||
direction: ltr
|
||||
uk:
|
||||
q: 1
|
||||
lang: uk
|
||||
name: Ukrainian
|
||||
direction: ltr
|
||||
hsb:
|
||||
q: 0.8
|
||||
lang: hsb
|
||||
name: Upper Sorbian
|
||||
direction: ltr
|
||||
ur:
|
||||
q: 1
|
||||
lang: ur_PK
|
||||
name: Urdu (Pakistan)
|
||||
direction: rtl
|
||||
vi:
|
||||
q: 0.8
|
||||
lang: vi
|
||||
name: Vietnamese
|
||||
direction: ltr
|
||||
email: ''
|
||||
use_email: false
|
||||
recovery_disclose: false
|
||||
timezone: UTC
|
||||
brought_by:
|
||||
brought_by_url:
|
||||
closed: false
|
||||
register_type: public
|
||||
nickname: foo
|
||||
ssl: always
|
||||
ssl_proxy: false
|
||||
duplicate_time_limit: 60
|
||||
text_limit: 1000
|
||||
x_static_delivery: false
|
||||
|
||||
security:
|
||||
algorithm: bcrypt
|
||||
options:
|
||||
cost: 12
|
||||
|
||||
db:
|
||||
mirror:
|
||||
|
||||
cache:
|
||||
notice_max_count: 128
|
||||
|
||||
avatar:
|
||||
server:
|
||||
ssl:
|
||||
dir: "%kernel.project_dir%/file/avatar/"
|
||||
default: "/assets/default-avatar.svg"
|
||||
max_size_px: 300
|
||||
|
||||
javascript:
|
||||
server:
|
||||
ssl:
|
||||
|
||||
attachments:
|
||||
server:
|
||||
ssl:
|
||||
dir: "%kernel.project_dir%/file/attachments/"
|
||||
supported:
|
||||
application/vnd.oasis.opendocument.chart: odc
|
||||
application/vnd.oasis.opendocument.formula: odf
|
||||
application/vnd.oasis.opendocument.graphics: odg
|
||||
application/vnd.oasis.opendocument.graphics-template: otg
|
||||
application/vnd.oasis.opendocument.image: odi
|
||||
application/vnd.oasis.opendocument.presentation: odp
|
||||
application/vnd.oasis.opendocument.presentation-template: otp
|
||||
application/vnd.oasis.opendocument.spreadsheet: ods
|
||||
application/vnd.oasis.opendocument.spreadsheet-template: ots
|
||||
application/vnd.oasis.opendocument.text: odt
|
||||
application/vnd.oasis.opendocument.text-master: odm
|
||||
application/vnd.oasis.opendocument.text-template: ott
|
||||
application/vnd.oasis.opendocument.text-web: oth
|
||||
application/pdf: pdf
|
||||
application/zip: zip
|
||||
application/x-bzip2: bz2
|
||||
application/x-go-sgf: sgf
|
||||
application/xml: xml
|
||||
application/gpx+xml: gpx
|
||||
image/png: ".png"
|
||||
image/jpeg: ".jpeg"
|
||||
image/gif: ".gif"
|
||||
image/vnd.microsoft.icon: ".ico"
|
||||
image/svg+xml: svg
|
||||
audio/ogg: ogg
|
||||
audio/mpeg: mpg
|
||||
audio/x-speex: spx
|
||||
application/ogg: ogx
|
||||
text/plain: txt
|
||||
video/mpeg: mpeg
|
||||
video/mp4: mp4
|
||||
video/ogg: ogv
|
||||
video/quicktime: mov
|
||||
video/webm: webm
|
||||
file_quota: 2097152
|
||||
user_quota: 209715200
|
||||
monthly_quota: 20971520
|
||||
uploads: true
|
||||
show_html: true
|
||||
show_thumbs: true
|
||||
process_links: true
|
||||
ext_blacklist: []
|
||||
memory_limit: 1024M
|
||||
|
||||
thumbnail:
|
||||
server:
|
||||
ssl:
|
||||
dir: "%kernel.project_dir%/file/thumbnails/"
|
||||
crop: false
|
||||
max_size_px: 1000
|
||||
width: 450
|
||||
height: 600
|
||||
upscale: false
|
||||
animated: false
|
||||
|
||||
theme:
|
||||
server:
|
||||
ssl:
|
||||
dir: "%kernel.project_dir%/public/theme/"
|
||||
|
||||
plugins:
|
||||
server:
|
||||
ssl:
|
||||
core: []
|
||||
default: []
|
||||
locale_path:
|
||||
|
||||
license:
|
||||
type: cc
|
||||
owner:
|
||||
url: https://creativecommons.org/licenses/by/4.0/
|
||||
title: Creative Commons Attribution 4.0
|
||||
image: "/theme/licenses/cc_by_4.0.png"
|
||||
|
||||
nickname:
|
||||
reserved:
|
||||
- doc
|
||||
- main
|
||||
- avatar
|
||||
- theme
|
||||
- settings
|
||||
- admin
|
||||
featured: []
|
||||
|
||||
profile:
|
||||
bio_text_limit:
|
||||
allow_nick_change: false
|
||||
allow_private_stream: true
|
||||
backup: false
|
||||
restore: false
|
||||
delete: false
|
||||
move: false
|
||||
|
||||
image:
|
||||
jpegquality: 85
|
||||
|
||||
foaf:
|
||||
mbox_sha1sum: false
|
||||
|
||||
public:
|
||||
local_only: false
|
||||
blacklist: []
|
||||
exclude_sources: []
|
||||
|
||||
invite:
|
||||
enabled: true
|
||||
|
||||
tag:
|
||||
dropoff: 864000
|
||||
cutoff: 7776000
|
||||
|
||||
popular:
|
||||
dropoff: 864000
|
||||
cutoff: 7776000
|
||||
|
||||
new_users:
|
||||
default_subscriptions:
|
||||
welcome_user:
|
||||
|
||||
linkify:
|
||||
bare_domains: false
|
||||
ipv4: false
|
||||
ipv6: false
|
||||
|
||||
group:
|
||||
max_aliases: 3
|
||||
description_limit:
|
||||
|
||||
people_tag:
|
||||
max_tags: 100
|
||||
max_people: 500
|
||||
allow_tagging:
|
||||
local: true
|
||||
remote: true
|
||||
description_limit:
|
||||
|
||||
search:
|
||||
type: fulltext
|
||||
|
||||
html_filter:
|
||||
tags:
|
||||
- img
|
||||
- video
|
||||
- audio
|
||||
- script
|
||||
|
||||
notice:
|
||||
content_limit:
|
||||
allow_private: false
|
||||
hide_banned: true
|
||||
|
||||
message:
|
||||
content_limit:
|
||||
|
||||
location:
|
||||
share: user
|
||||
|
||||
robots_txt:
|
||||
crawl_delay: 0
|
||||
disallow:
|
||||
- main
|
||||
- settings
|
||||
- admin
|
||||
- search
|
||||
- message
|
||||
|
||||
nofollow:
|
||||
subscribers: true
|
||||
members: true
|
||||
peopletag: true
|
||||
external: sometimes
|
||||
|
||||
url_shortener:
|
||||
service: internal
|
||||
max_url_length: 100
|
||||
max_notice_length:
|
||||
|
||||
http:
|
||||
ssl_ca_file: "/docker/certbot/files/live/"
|
||||
timeout: 60
|
||||
proxy_host:
|
||||
proxy_port:
|
||||
proxy_user:
|
||||
proxy_password:
|
||||
proxy_auth_scheme:
|
||||
|
||||
discovery:
|
||||
CORS: false
|
||||
|
@ -1,311 +0,0 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* Write the default settings to the database
|
||||
*
|
||||
* @package GNUsocial
|
||||
* @category DB
|
||||
*
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
namespace App\Core\DB;
|
||||
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\I18n\I18n;
|
||||
use App\Util\Common;
|
||||
|
||||
abstract class DefaultSettings
|
||||
{
|
||||
public static array $defaults;
|
||||
public static function setDefaults()
|
||||
{
|
||||
self::$defaults = [
|
||||
'site' => [
|
||||
'name' => $_ENV['SOCIAL_SITENAME'] ?? 'Another social instance',
|
||||
'notice' => null, // site wide notice text
|
||||
'theme' => 'default',
|
||||
'logo' => null,
|
||||
'language' => 'en',
|
||||
'detect_language' => true,
|
||||
'languages' => I18n::getAllLanguages(),
|
||||
'email' => $_ENV['SERVER_ADMIN'] ?? $_ENV['SOCIAL_ADMIN_EMAIL'] ?? null,
|
||||
'use_email' => false, // TODO
|
||||
'recovery_disclose' => false, // Whether to not say that we found the email in the database, when asking for recovery
|
||||
'timezone' => 'UTC',
|
||||
'brought_by' => null,
|
||||
'brought_by_url' => null,
|
||||
'closed' => false,
|
||||
'register_type' => $_ENV['SOCIAL_SITE_PROFILE'], // public, private, community, single-user
|
||||
'nickname' => $_ENV['SOCIAL_ADMIN_NICK'],
|
||||
'ssl' => 'always',
|
||||
'ssl_proxy' => false, // set to true to force GNU social to think it is HTTPS (i.e. using reverse proxy to enable it)
|
||||
'duplicate_time_limit' => 60, // default for same person saying the same thing
|
||||
'text_limit' => 1000, // in chars; 0 == no limit
|
||||
'x_static_delivery' => false,
|
||||
'defaults_modified' => time(),
|
||||
],
|
||||
'security' => [
|
||||
'algorithm' => 'bcrypt', // bcrypt, argon2i or argon2id
|
||||
'options' => ['cost' => 12], // for argon, ['memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST, 'time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST, 'threads' => PASSWORD_ARGON2_DEFAULT_THREADS]
|
||||
],
|
||||
'db' => ['mirror' => null], // TODO implement
|
||||
'cache' => [
|
||||
'notice_max_count' => 128,
|
||||
],
|
||||
'avatar' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
'dir' => INSTALLDIR . '/file/avatar/',
|
||||
'default' => '/assets/default-avatar.svg',
|
||||
'max_size_px' => 300,
|
||||
],
|
||||
'javascript' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
],
|
||||
'attachments' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
'dir' => INSTALLDIR . '/file/attachments/',
|
||||
'supported' => [
|
||||
'application/vnd.oasis.opendocument.chart' => 'odc',
|
||||
'application/vnd.oasis.opendocument.formula' => 'odf',
|
||||
'application/vnd.oasis.opendocument.graphics' => 'odg',
|
||||
'application/vnd.oasis.opendocument.graphics-template' => 'otg',
|
||||
'application/vnd.oasis.opendocument.image' => 'odi',
|
||||
'application/vnd.oasis.opendocument.presentation' => 'odp',
|
||||
'application/vnd.oasis.opendocument.presentation-template' => 'otp',
|
||||
'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots',
|
||||
'application/vnd.oasis.opendocument.text' => 'odt',
|
||||
'application/vnd.oasis.opendocument.text-master' => 'odm',
|
||||
'application/vnd.oasis.opendocument.text-template' => 'ott',
|
||||
'application/vnd.oasis.opendocument.text-web' => 'oth',
|
||||
'application/pdf' => 'pdf',
|
||||
'application/zip' => 'zip',
|
||||
'application/x-bzip2' => 'bz2',
|
||||
'application/x-go-sgf' => 'sgf',
|
||||
'application/xml' => 'xml',
|
||||
'application/gpx+xml' => 'gpx',
|
||||
image_type_to_mime_type(IMAGETYPE_PNG) => image_type_to_extension(IMAGETYPE_PNG),
|
||||
image_type_to_mime_type(IMAGETYPE_JPEG) => image_type_to_extension(IMAGETYPE_JPEG),
|
||||
image_type_to_mime_type(IMAGETYPE_GIF) => image_type_to_extension(IMAGETYPE_GIF),
|
||||
image_type_to_mime_type(IMAGETYPE_ICO) => image_type_to_extension(IMAGETYPE_ICO),
|
||||
'image/svg+xml' => 'svg', // No built-in constant
|
||||
'audio/ogg' => 'ogg',
|
||||
'audio/mpeg' => 'mpg',
|
||||
'audio/x-speex' => 'spx',
|
||||
'application/ogg' => 'ogx',
|
||||
'text/plain' => 'txt',
|
||||
'video/mpeg' => 'mpeg',
|
||||
'video/mp4' => 'mp4',
|
||||
'video/ogg' => 'ogv',
|
||||
'video/quicktime' => 'mov',
|
||||
'video/webm' => 'webm',
|
||||
],
|
||||
'file_quota' => Common::getPreferredPhpUploadLimit(),
|
||||
'user_quota' => Common::sizeStrToInt('200M'),
|
||||
'monthly_quota' => Common::sizeStrToInt('20M'),
|
||||
'uploads' => true,
|
||||
'show_html' => true, // show (filtered) text/html attachments (and oEmbed HTML etc.). Doesn't affect AJAX calls.
|
||||
'show_thumbs' => true, // show thumbnails in notice lists for uploaded images, and photos and videos linked remotely that provide oEmbed info
|
||||
'process_links' => true, // check linked resources for embeddable photos and videos; this will hit referenced external web sites when processing new messages.
|
||||
'ext_blacklist' => [],
|
||||
'memory_limit' => '1024M', // PHP memory limit to use temporarily when handling images
|
||||
],
|
||||
'thumbnail' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
'dir' => INSTALLDIR . '/file/thumbnails/', // falls back to File::path('thumb') (equivalent to ['attachments']['dir'] . '/thumb/')
|
||||
'crop' => false, // overridden to true if thumb height === null
|
||||
'max_size_px' => 1000, // thumbs with an edge larger than this will not be generated
|
||||
'width' => 450,
|
||||
'height' => 600,
|
||||
'upscale' => false,
|
||||
'animated' => false, // null="UseFileAsThumbnail", false="can use still frame". true="allow animated"
|
||||
],
|
||||
'theme' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
'dir' => INSTALLDIR . '/public/theme/',
|
||||
],
|
||||
'plugins' => [
|
||||
'server' => null,
|
||||
'ssl' => null,
|
||||
'core' => [],
|
||||
'default' => [],
|
||||
'locale_path' => null, // Set to a path to use *instead of* each plugin's own locale subdirectories
|
||||
],
|
||||
'license' => [
|
||||
'type' => 'cc', // can be 'cc', 'allrightsreserved', 'private'
|
||||
'owner' => null, // can be name of content owner e.g. for enterprise
|
||||
'url' => 'https://creativecommons.org/licenses/by/4.0/',
|
||||
'title' => 'Creative Commons Attribution 4.0',
|
||||
'image' => '/theme/licenses/cc_by_4.0.png',
|
||||
],
|
||||
'nickname' => [
|
||||
'reserved' => ['doc', 'main', 'avatar', 'theme', 'settings', 'admin'],
|
||||
'featured' => [],
|
||||
],
|
||||
'profile' => [
|
||||
'bio_text_limit' => null,
|
||||
'allow_nick_change' => false,
|
||||
'allow_private_stream' => true, // whether to allow setting stream to private ("only followers can read")
|
||||
'backup' => false, // can cause DoS, so should be done via CLI
|
||||
'restore' => false,
|
||||
'delete' => false,
|
||||
'move' => false,
|
||||
],
|
||||
'image' => ['jpegquality' => 85],
|
||||
'foaf' => ['mbox_sha1sum' => false],
|
||||
'public' => [
|
||||
'local_only' => false,
|
||||
'blacklist' => [],
|
||||
'exclude_sources' => [],
|
||||
],
|
||||
'invite' => ['enabled' => true],
|
||||
'tag' => [
|
||||
'dropoff' => 86400 * 10, // controls weighting based on age
|
||||
'cutoff' => 86400 * 90, // only look at notices posted in last 90 days
|
||||
],
|
||||
'popular' => [
|
||||
'dropoff' => 86400 * 10, // controls weighting based on age
|
||||
'cutoff' => 86400 * 90, // only look at notices favorited in last 90 days
|
||||
],
|
||||
'new_users' => [
|
||||
'default_subscriptions' => null,
|
||||
'welcome_user' => null,
|
||||
],
|
||||
'linkify' => [ // "bare" below means "without schema", like domain.com vs. https://domain.com
|
||||
'bare_domains' => false, // convert domain.com to <a href="http://domain.com/" ...>domain.com</a> ?
|
||||
'ipv4' => false, // convert IPv4 addresses to hyperlinks?
|
||||
'ipv6' => false, // convert IPv6 addresses to hyperlinks?
|
||||
],
|
||||
'group' => [
|
||||
'max_aliases' => 3,
|
||||
'description_limit' => null,
|
||||
],
|
||||
'people_tag' => [
|
||||
'max_tags' => 100, // maximum number of tags a user can create.
|
||||
'max_people' => 500, // maximum no. of people with the same tag by the same user
|
||||
'allow_tagging' => ['local' => true, 'remote' => true],
|
||||
'description_limit' => null,
|
||||
],
|
||||
'search' => ['type' => 'fulltext'],
|
||||
'html_filter' => ['tags' => ['img', 'video', 'audio', 'script']],
|
||||
'notice' => [
|
||||
'content_limit' => null,
|
||||
'allow_private' => false, // whether to allow users to "check the padlock" to publish notices available for their subscribers.
|
||||
'hide_banned' => true, // whether to hide silenced users from timelines
|
||||
],
|
||||
'message' => ['content_limit' => null],
|
||||
'location' => ['share' => 'user'],
|
||||
'robots_txt' => [
|
||||
'crawl_delay' => 0,
|
||||
'disallow' => ['main', 'settings', 'admin', 'search', 'message'],
|
||||
],
|
||||
'nofollow' => [
|
||||
'subscribers' => true,
|
||||
'members' => true,
|
||||
'peopletag' => true,
|
||||
'external' => 'sometimes', // Options: 'sometimes', 'never', default = 'sometimes'
|
||||
],
|
||||
'url_shortener' => [
|
||||
'service' => 'internal',
|
||||
'max_url_length' => 100,
|
||||
'max_notice_length' => null,
|
||||
],
|
||||
'http' => [ // HTTP client settings when contacting other sites
|
||||
'ssl_ca_file' => '/docker/certbot/files/live/',
|
||||
'timeout' => (int) (ini_get('default_socket_timeout')), // effectively should be this by default already, but this makes it more explicitly configurable for you users .)
|
||||
'proxy_host' => null,
|
||||
'proxy_port' => null,
|
||||
'proxy_user' => null,
|
||||
'proxy_password' => null,
|
||||
'proxy_auth_scheme' => null,
|
||||
],
|
||||
'discovery' => ['CORS' => false], // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.)
|
||||
];
|
||||
|
||||
if (!DB::getConnection()->getSchemaManager()->tablesExist(['config'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$modified = Common::config('site', 'defaults_modified');
|
||||
if ($modified > filemtime(__FILE__)) {
|
||||
// Don't bother modifying the table if this file is older
|
||||
return;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// It seems the table wasn't initialized yet, carry on
|
||||
}
|
||||
|
||||
self::loadDefaults($_ENV['APP_ENV'] == 'prod');
|
||||
}
|
||||
|
||||
public static function loadDefaults(bool $optimize = false)
|
||||
{
|
||||
if ($optimize || !isset($_ENV['HTTPS']) || !isset($_ENV['HTTP_HOST'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In dev mode, delete everything and reinsert, in case
|
||||
// defaults changed
|
||||
if ($_ENV['APP_ENV'] === 'dev' && !isset($_ENV['SOCIAL_NO_RELOAD_DEFAULTS'])) {
|
||||
DB::getConnection()->executeQuery('delete from config;');
|
||||
}
|
||||
|
||||
// So, since not all DBMSs support multi row inserts, doctrine
|
||||
// doesn't implement it. The difference between this and the
|
||||
// normal version is that that one does 221 queries in 30 to
|
||||
// 50ms, while this does 2 in 10 to 15 ms.
|
||||
if (DB::getRepository('config')->count([]) == 0) {
|
||||
$sql = 'insert into config (section, setting, value) values';
|
||||
foreach (self::$defaults as $section => $def) {
|
||||
foreach ($def as $setting => $value) {
|
||||
$v = serialize($value);
|
||||
$sql .= " ('{$section}', '{$setting}', '{$v}'),";
|
||||
}
|
||||
}
|
||||
$sql = preg_replace('/,$/', ';', $sql);
|
||||
DB::getConnection()->executeQuery($sql);
|
||||
}
|
||||
}
|
||||
|
||||
public static function _m_dynamic(): array
|
||||
{
|
||||
self::setDefaults();
|
||||
$m = [];
|
||||
$m['domain'] = 'core';
|
||||
foreach (self::$defaults as $key => $inner) {
|
||||
$m[] = _m($key);
|
||||
foreach (array_keys($inner) as $inner_key) {
|
||||
$m[] = _m($inner_key);
|
||||
}
|
||||
}
|
||||
return $m;
|
||||
}
|
||||
}
|
@ -43,14 +43,15 @@
|
||||
namespace App\Core;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\DB\DefaultSettings;
|
||||
use App\Core\I18n\I18n;
|
||||
use App\Core\Queue\Queue;
|
||||
use App\Core\Router\Router;
|
||||
use App\Util\Common;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use HtmlSanitizer\SanitizerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Event\ConsoleCommandEvent;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
@ -83,6 +84,7 @@ class GNUsocial implements EventSubscriberInterface
|
||||
protected ModuleManager $module_manager;
|
||||
protected HttpClientInterface $client;
|
||||
protected SanitizerInterface $sanitizer;
|
||||
protected ContainerBagInterface $config;
|
||||
|
||||
/**
|
||||
* Symfony dependency injection gives us access to these services
|
||||
@ -99,7 +101,8 @@ class GNUsocial implements EventSubscriberInterface
|
||||
SSecurity $sec,
|
||||
ModuleManager $mm,
|
||||
HttpClientInterface $cl,
|
||||
SanitizerInterface $san)
|
||||
SanitizerInterface $san,
|
||||
ContainerBagInterface $conf)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->translator = $trans;
|
||||
@ -114,6 +117,7 @@ class GNUsocial implements EventSubscriberInterface
|
||||
$this->module_manager = $mm;
|
||||
$this->client = $cl;
|
||||
$this->saniter = $san;
|
||||
$this->config = $conf;
|
||||
|
||||
$this->initialize();
|
||||
}
|
||||
@ -126,6 +130,7 @@ class GNUsocial implements EventSubscriberInterface
|
||||
public function initialize(): void
|
||||
{
|
||||
if (!$this->initialized) {
|
||||
Common::setConfigBag($this->config);
|
||||
Log::setLogger($this->logger);
|
||||
Event::setDispatcher($this->event_dispatcher);
|
||||
I18n::setTranslator($this->translator);
|
||||
@ -135,13 +140,6 @@ class GNUsocial implements EventSubscriberInterface
|
||||
Security::setHelper($this->security, $this->saniter);
|
||||
Router::setRouter($this->router, $this->url_generator);
|
||||
HTTPClient::setClient($this->client);
|
||||
|
||||
if (isset($_ENV['HTTPS']) || isset($_ENV['HTTP_HOST'])) {
|
||||
// TODO move to container definition, after removing
|
||||
// this way of doing configuration
|
||||
DefaultSettings::setDefaults();
|
||||
}
|
||||
|
||||
Cache::setupCache();
|
||||
|
||||
// Events are proloaded on compilation, but set at runtime
|
||||
|
@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Core\Entity;
|
||||
|
||||
/**
|
||||
* Entity for app configuration
|
||||
*
|
||||
* @category DB
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2010 StatusNet Inc.
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @author Hugo Sales <hugo@fc.up.pt>
|
||||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Config extends Entity
|
||||
{
|
||||
// {{{ Autocode
|
||||
|
||||
private string $section = '';
|
||||
private string $setting = '';
|
||||
private ?string $value;
|
||||
|
||||
public function setSection(string $section): self
|
||||
{
|
||||
$this->section = $section;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSection(): string
|
||||
{
|
||||
return $this->section;
|
||||
}
|
||||
|
||||
public function setSetting(string $setting): self
|
||||
{
|
||||
$this->setting = $setting;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSetting(): string
|
||||
{
|
||||
return $this->setting;
|
||||
}
|
||||
|
||||
public function setValue(?string $value): self
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue(): ?string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
// }}} Autocode
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'config',
|
||||
'fields' => [
|
||||
'section' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration section'],
|
||||
'setting' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration setting'],
|
||||
'value' => ['type' => 'text', 'description' => 'configuration value'],
|
||||
],
|
||||
'primary key' => ['section', 'setting'],
|
||||
];
|
||||
}
|
||||
}
|
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of GNU social - https://www.gnu.org/software/social
|
||||
*
|
||||
* GNU social is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNU social is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* Symfony Kernel, which is responsible for configuring the whole application
|
||||
@ -102,6 +102,14 @@ class Kernel extends BaseKernel
|
||||
$loader->load($confDir . '/{packages}/' . $this->environment . '/*' . self::CONFIG_EXTS, 'glob');
|
||||
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
|
||||
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
|
||||
|
||||
// Overriding doesn't work as we want, overrides the top-most key, do it manually
|
||||
$loader->load(INSTALLDIR . '/social.local' . self::CONFIG_EXTS, 'glob');
|
||||
$locals = $container->getParameter('gnusocial');
|
||||
$loader->load(INSTALLDIR . '/social' . self::CONFIG_EXTS, 'glob');
|
||||
$defaults = $container->getParameter('gnusocial');
|
||||
$configs = array_replace_recursive($defaults, $locals);
|
||||
$container->setParameter('gnusocial', $configs);
|
||||
}
|
||||
|
||||
protected function configureRoutes(RoutingConfigurator $routes): void
|
||||
|
@ -40,20 +40,22 @@ use App\Entity\LocalUser;
|
||||
use App\Util\Exception\NoLoggedInUser;
|
||||
use Exception;
|
||||
use Functional as F;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
|
||||
|
||||
abstract class Common
|
||||
{
|
||||
private static ?array $config = null;
|
||||
public static function setConfigBag(ContainerBagInterface $config)
|
||||
{
|
||||
self::$config = $config->get('gnusocial');
|
||||
}
|
||||
|
||||
/**
|
||||
* Access sysadmin's configuration preferences for GNU social
|
||||
*/
|
||||
public static function config(string $section, string $setting)
|
||||
{
|
||||
$c = DB::find('config', ['section' => $section, 'setting' => $setting]);
|
||||
if ($c === null) {
|
||||
throw new \Exception("The field section = {$section} and setting = {$setting} doesn't exist");
|
||||
}
|
||||
|
||||
return unserialize($c->getValue());
|
||||
return $config[$section][$setting];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,6 +65,7 @@ abstract class Common
|
||||
*/
|
||||
public static function setConfig(string $section, string $setting, $value): void
|
||||
{
|
||||
throw new Exception('Implement this, ya dingus');
|
||||
$c = DB::getPartialReference('config', ['section' => $section, 'setting' => $setting]);
|
||||
if ($c === null) {
|
||||
throw new \Exception("The field section = {$section} and setting = {$setting} doesn't exist");
|
||||
|
Loading…
Reference in New Issue
Block a user