From 40b651a9fd3cd48cbfafdc88e11d7fc80a3eb72d Mon Sep 17 00:00:00 2001 From: Domenikus Date: Tue, 29 Aug 2023 19:56:11 +0200 Subject: [PATCH] Development (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bugfix * Php Stan fix * Updated dependencies * * Added possibility to specify channels names by client * Updated dependencies * * Allow customizing created channel names via environment variable * * Allow customizing created channel names via environment variable --------- Co-authored-by: Dominik süßenbach --- README.md | 8 ++++++++ config/channel-names.php | 23 ++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b24b561..89d94ae 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,14 @@ LOG_CHANNEL=stack # Default is 'info' if you want to debug the application may you want to change this to 'debug' LOG_LEVEL=info + +# (Optional) Default is empty. Allow customizing the list of channel names by providing additonal ones. Variable need to be json encoded string. +# e.g. { "cities": [ "Munich", "London" ], "software": [ "Word", "Excel" ] } +CHANNEL_NAMES_CUSTOM_LISTS= + +# (Optional) Default is empty. Allow client specific channel names by providing the identity ID and a custom list. Variable need to be json encoded string. +# e.g. { "YzablyuJuYIE7ogxTorhImGdA01=": [ "Berhain", "Sisyphos" ], "YbablyuJuYIE7ogxTorhImGdA01=": [ "Foo", "Bar" ] } +CLIENT_SPECIFIC_CHANNEL_NAME_LISTS ``` ### Necessary bot permissions in ts3 server diff --git a/config/channel-names.php b/config/channel-names.php index df98cfb..7bcc30b 100644 --- a/config/channel-names.php +++ b/config/channel-names.php @@ -1,14 +1,27 @@ 'countries', +$config = [ + 'default' => env('CHANNEL_NAMES_DEFAULT_LIST', 'countries'), 'lists' => [ 'countries' => [ 'Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Brazil', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Côte d\'Ivoire', 'Cabo Verde', 'Cambodia', 'Cameroon', 'Canada', 'Central African Republic', 'Chad', 'Chile', 'China', 'Colombia', 'Comoros', 'Congo', 'Costa Rica', 'Croatia', 'Cuba', 'Cyprus', 'Czechia', 'Democratic Republic of the Congo', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Eswatini', 'Ethiopia', 'Fiji', 'Finland', 'France', 'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Greece', 'Grenada', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Holy See', 'Honduras', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Mauritania', 'Mauritius', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'North Korea', 'North Macedonia', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palestine State', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Qatar', 'Romania', 'Russia', 'Rwanda', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Korea', 'South Sudan', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Sweden', 'Switzerland', 'Syria', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States of America', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Venezuela', 'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe', 'Tashkent', 'Port Vila', 'Vatican City', 'Caracas', 'Hanoi', 'Sana\'a', 'Lusaka', 'Harare', ], ], - 'clients' => [ - - ], + 'clients' => [], ]; + +/** @var string $channelNamesCustomLists */ +$channelNamesCustomLists = env('CHANNEL_NAMES_CUSTOM_LISTS'); +/** @var string $clientSpecificChannelNameLists */ +$clientSpecificChannelNameLists = env('CLIENT_SPECIFIC_CHANNEL_NAME_LISTS'); + +if ($channelNamesCustomLists) { + $config['lists'] = array_merge($config['lists'], json_decode($channelNamesCustomLists, true)); +} + +if ($clientSpecificChannelNameLists) { + $config['clients'] = json_decode($clientSpecificChannelNameLists, true); +} + +return $config;