2024-02-23 15:39:54 +00:00
|
|
|
from re import compile, sub
|
2024-08-19 11:08:23 +00:00
|
|
|
domains = ['jet', 'mirror', 'me']
|
2024-02-23 15:39:54 +00:00
|
|
|
|
2024-02-19 16:13:39 +00:00
|
|
|
def domain_ok(domain):
|
2024-06-21 16:56:55 +00:00
|
|
|
global domains
|
|
|
|
if domain.count('.') == 1:
|
|
|
|
if domain.split('.')[1] in domains:
|
2024-02-23 15:39:54 +00:00
|
|
|
# ../some => some
|
|
|
|
# Защита от проверки папок выше, чем нужно и др.
|
2024-06-21 16:56:55 +00:00
|
|
|
regex = compile('[^a-z0-9.-]')
|
2024-02-23 15:39:54 +00:00
|
|
|
c_domain = regex.sub('', domain)
|
|
|
|
if domain == c_domain:
|
|
|
|
return domain
|
2024-02-19 16:13:39 +00:00
|
|
|
|
|
|
|
return False
|
2024-06-21 16:56:55 +00:00
|
|
|
|
|
|
|
def domain_list():
|
|
|
|
global domains
|
|
|
|
out = ''
|
|
|
|
for i in domains:
|
|
|
|
out += f'{i}, '
|
|
|
|
out = out[:-2]
|
|
|
|
return out
|