mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Migrate from public suffix to public suffix list
This commit is contained in:
parent
91a4dc4992
commit
97bdedd723
2 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from publicsuffix import PublicSuffixList
|
from publicsuffixlist import PublicSuffixList
|
||||||
|
|
||||||
from moulinette.utils.process import check_output
|
from moulinette.utils.process import check_output
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class DNSRecordsDiagnoser(Diagnoser):
|
||||||
# Check if a domain buy by the user will expire soon
|
# Check if a domain buy by the user will expire soon
|
||||||
psl = PublicSuffixList()
|
psl = PublicSuffixList()
|
||||||
domains_from_registrar = [
|
domains_from_registrar = [
|
||||||
psl.get_public_suffix(domain) for domain in all_domains
|
psl.publicsuffix(domain) for domain in all_domains
|
||||||
]
|
]
|
||||||
domains_from_registrar = [
|
domains_from_registrar = [
|
||||||
domain for domain in domains_from_registrar if "." in domain
|
domain for domain in domains_from_registrar if "." in domain
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
along with this program; if not, see http://www.gnu.org/licenses
|
along with this program; if not, see http://www.gnu.org/licenses
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from publicsuffix import PublicSuffixList
|
from publicsuffixlist import PublicSuffixList
|
||||||
from yunohost.utils.network import dig
|
from yunohost.utils.network import dig
|
||||||
|
|
||||||
YNH_DYNDNS_DOMAINS = ["nohost.me", "noho.st", "ynh.fr"]
|
YNH_DYNDNS_DOMAINS = ["nohost.me", "noho.st", "ynh.fr"]
|
||||||
|
@ -31,7 +31,7 @@ def get_public_suffix(domain):
|
||||||
# Load domain public suffixes
|
# Load domain public suffixes
|
||||||
psl = PublicSuffixList()
|
psl = PublicSuffixList()
|
||||||
|
|
||||||
public_suffix = psl.get_public_suffix(domain)
|
public_suffix = psl.publicsuffix(domain)
|
||||||
if public_suffix in YNH_DYNDNS_DOMAINS:
|
if public_suffix in YNH_DYNDNS_DOMAINS:
|
||||||
domain_prefix = domain_name[0:-(1 + len(public_suffix))]
|
domain_prefix = domain_name[0:-(1 + len(public_suffix))]
|
||||||
public_suffix = domain_prefix.plit(".")[-1] + "." + public_suffix
|
public_suffix = domain_prefix.plit(".")[-1] + "." + public_suffix
|
||||||
|
|
Loading…
Add table
Reference in a new issue