nginx_ua_block_pleroma_rejects: Back to regular expressions.

String matching didn't work.

This reverts commit e62e2c52cb.
This commit is contained in:
tastytea 2019-08-18 20:10:16 +02:00
parent fdb57a87de
commit 75d5781764
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@
# Save the output to a file and include it in an nginx configuration file. Then
# add `if ($blockedagent) { return 403; }` to your server blocks.
# Version: 2019-08-18_2
# Version: 2019-08-18_3
function get_domains() # Output domains, separated by newline.
@ -21,10 +21,11 @@ function print_entry() # Output map entry.
{
local domain="${1}"
# Remove wildcards.
domain=$(sed 's/\*//g' <<<${domain})
# Transform strings to regular expressions.
domain=$(sed 's/\./\\./g' <<<${domain}) # . → \.
domain=$(sed 's/\*/.*/g' <<<${domain}) # * → .*
echo " ^~${domain} 1;"
echo " ~*${domain} 1;"
}
function main()