mirror of
https://github.com/Justuser3310/url-autoproxy-nginx.git
synced 2025-02-08 02:07:39 +00:00
24 lines
540 B
Python
24 lines
540 B
Python
from re import compile, sub
|
|
domains = ['jet', 'mirror', 'org', 'info', 'news', 'me']
|
|
|
|
def domain_ok(domain):
|
|
global domains
|
|
if domain.count('.') == 1:
|
|
if domain.split('.')[1] in domains:
|
|
# ../some => some
|
|
# Защита от проверки папок выше, чем нужно и др.
|
|
regex = compile('[^a-z0-9.-]')
|
|
c_domain = regex.sub('', domain)
|
|
if domain == c_domain:
|
|
return domain
|
|
|
|
return False
|
|
|
|
def domain_list():
|
|
global domains
|
|
out = ''
|
|
for i in domains:
|
|
out += f'{i}, '
|
|
out = out[:-2]
|
|
return out
|