mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
8f97b42fd4
commit
fc98441a40
|
@ -268,7 +268,7 @@ from utils import getOccupationName
|
||||||
from utils import setOccupationName
|
from utils import setOccupationName
|
||||||
from utils import loadTranslationsFromFile
|
from utils import loadTranslationsFromFile
|
||||||
from utils import getLocalNetworkAddresses
|
from utils import getLocalNetworkAddresses
|
||||||
from utils import decodedHost
|
from utils import decoded_host
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import get_locked_account
|
from utils import get_locked_account
|
||||||
from utils import has_users_path
|
from utils import has_users_path
|
||||||
|
@ -13312,7 +13312,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
callingDomain = self.server.domain_full
|
callingDomain = self.server.domain_full
|
||||||
|
|
||||||
if self.headers.get('Host'):
|
if self.headers.get('Host'):
|
||||||
callingDomain = decodedHost(self.headers['Host'])
|
callingDomain = decoded_host(self.headers['Host'])
|
||||||
if self.server.onion_domain:
|
if self.server.onion_domain:
|
||||||
if callingDomain != self.server.domain and \
|
if callingDomain != self.server.domain and \
|
||||||
callingDomain != self.server.domain_full and \
|
callingDomain != self.server.domain_full and \
|
||||||
|
@ -16369,7 +16369,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
def do_HEAD(self):
|
def do_HEAD(self):
|
||||||
callingDomain = self.server.domain_full
|
callingDomain = self.server.domain_full
|
||||||
if self.headers.get('Host'):
|
if self.headers.get('Host'):
|
||||||
callingDomain = decodedHost(self.headers['Host'])
|
callingDomain = decoded_host(self.headers['Host'])
|
||||||
if self.server.onion_domain:
|
if self.server.onion_domain:
|
||||||
if callingDomain != self.server.domain and \
|
if callingDomain != self.server.domain and \
|
||||||
callingDomain != self.server.domain_full and \
|
callingDomain != self.server.domain_full and \
|
||||||
|
@ -17483,7 +17483,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
callingDomain = self.server.domain_full
|
callingDomain = self.server.domain_full
|
||||||
if self.headers.get('Host'):
|
if self.headers.get('Host'):
|
||||||
callingDomain = decodedHost(self.headers['Host'])
|
callingDomain = decoded_host(self.headers['Host'])
|
||||||
if self.server.onion_domain:
|
if self.server.onion_domain:
|
||||||
if callingDomain != self.server.domain and \
|
if callingDomain != self.server.domain and \
|
||||||
callingDomain != self.server.domain_full and \
|
callingDomain != self.server.domain_full and \
|
||||||
|
|
10
tests.py
10
tests.py
|
@ -68,7 +68,7 @@ from utils import dateSecondsToString
|
||||||
from utils import validPassword
|
from utils import validPassword
|
||||||
from utils import userAgentDomain
|
from utils import userAgentDomain
|
||||||
from utils import camelCaseSplit
|
from utils import camelCaseSplit
|
||||||
from utils import decodedHost
|
from utils import decoded_host
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
from utils import firstParagraphFromString
|
from utils import firstParagraphFromString
|
||||||
|
@ -4865,13 +4865,13 @@ def _testMastoApi():
|
||||||
def _testDomainHandling():
|
def _testDomainHandling():
|
||||||
print('testDomainHandling')
|
print('testDomainHandling')
|
||||||
testDomain = 'localhost'
|
testDomain = 'localhost'
|
||||||
assert decodedHost(testDomain) == testDomain
|
assert decoded_host(testDomain) == testDomain
|
||||||
testDomain = '127.0.0.1:60'
|
testDomain = '127.0.0.1:60'
|
||||||
assert decodedHost(testDomain) == testDomain
|
assert decoded_host(testDomain) == testDomain
|
||||||
testDomain = '192.168.5.153'
|
testDomain = '192.168.5.153'
|
||||||
assert decodedHost(testDomain) == testDomain
|
assert decoded_host(testDomain) == testDomain
|
||||||
testDomain = 'xn--espaa-rta.icom.museum'
|
testDomain = 'xn--espaa-rta.icom.museum'
|
||||||
assert decodedHost(testDomain) == "españa.icom.museum"
|
assert decoded_host(testDomain) == "españa.icom.museum"
|
||||||
|
|
||||||
|
|
||||||
def _testPrepareHtmlPostNickname():
|
def _testPrepareHtmlPostNickname():
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -168,7 +168,7 @@ def _local_network_host(host: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def decodedHost(host: str) -> str:
|
def decoded_host(host: str) -> str:
|
||||||
"""Convert hostname to internationalized domain
|
"""Convert hostname to internationalized domain
|
||||||
https://en.wikipedia.org/wiki/Internationalized_domain_name
|
https://en.wikipedia.org/wiki/Internationalized_domain_name
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue