mirror of https://gitlab.com/bashrc2/epicyon
Use onion/i2p address for person qr code if it's available
parent
4d91f5f184
commit
88cea2c678
17
daemon.py
17
daemon.py
|
@ -13803,12 +13803,21 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _show_qrcode(self, calling_domain: str, path: str,
|
def _show_qrcode(self, calling_domain: str, path: str,
|
||||||
base_dir: str, domain: str, port: int,
|
base_dir: str, domain: str,
|
||||||
getreq_start_time) -> bool:
|
onion_domain: str, i2p_domain: str,
|
||||||
|
port: int, getreq_start_time) -> bool:
|
||||||
"""Shows a QR code for an account
|
"""Shows a QR code for an account
|
||||||
"""
|
"""
|
||||||
nickname = get_nickname_from_actor(path)
|
nickname = get_nickname_from_actor(path)
|
||||||
save_person_qrcode(base_dir, nickname, domain, port)
|
if onion_domain:
|
||||||
|
qrcode_domain = onion_domain
|
||||||
|
port = 80
|
||||||
|
elif i2p_domain:
|
||||||
|
qrcode_domain = i2p_domain
|
||||||
|
port = 80
|
||||||
|
else:
|
||||||
|
qrcode_domain = domain
|
||||||
|
save_person_qrcode(base_dir, nickname, domain, qrcode_domain, port)
|
||||||
qr_filename = \
|
qr_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||||
if os.path.isfile(qr_filename):
|
if os.path.isfile(qr_filename):
|
||||||
|
@ -16146,6 +16155,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if self._show_qrcode(calling_domain, self.path,
|
if self._show_qrcode(calling_domain, self.path,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
self.server.onion_domain,
|
||||||
|
self.server.i2p_domain,
|
||||||
self.server.port,
|
self.server.port,
|
||||||
getreq_start_time):
|
getreq_start_time):
|
||||||
return
|
return
|
||||||
|
|
|
@ -582,15 +582,15 @@ def create_group(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
|
|
||||||
def save_person_qrcode(base_dir: str,
|
def save_person_qrcode(base_dir: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, qrcode_domain: str,
|
||||||
scale=6) -> None:
|
port: int, scale=6) -> None:
|
||||||
"""Saves a qrcode image for the handle of the person
|
"""Saves a qrcode image for the handle of the person
|
||||||
This helps to transfer onion or i2p handles to a mobile device
|
This helps to transfer onion or i2p handles to a mobile device
|
||||||
"""
|
"""
|
||||||
qrcode_filename = acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
qrcode_filename = acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||||
if os.path.isfile(qrcode_filename):
|
if os.path.isfile(qrcode_filename):
|
||||||
return
|
return
|
||||||
handle = get_full_domain('@' + nickname + '@' + domain, port)
|
handle = get_full_domain('@' + nickname + '@' + qrcode_domain, port)
|
||||||
url = pyqrcode.create(handle)
|
url = pyqrcode.create(handle)
|
||||||
url.png(qrcode_filename, scale)
|
url.png(qrcode_filename, scale)
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
registrations_remaining -= 1
|
registrations_remaining -= 1
|
||||||
set_config_param(base_dir, 'registrationsRemaining',
|
set_config_param(base_dir, 'registrationsRemaining',
|
||||||
str(registrations_remaining))
|
str(registrations_remaining))
|
||||||
save_person_qrcode(base_dir, nickname, domain, port)
|
save_person_qrcode(base_dir, nickname, domain, domain, port)
|
||||||
return private_key_pem, public_key_pem, new_person, webfinger_endpoint
|
return private_key_pem, public_key_pem, new_person, webfinger_endpoint
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue