mirror of https://gitlab.com/bashrc2/epicyon
Clear account qrcodes at startup
parent
76fd7de76a
commit
f5a7cbad6e
|
@ -60,6 +60,7 @@ from donate import get_donation_url
|
|||
from donate import set_donation_url
|
||||
from donate import get_website
|
||||
from donate import set_website
|
||||
from person import clear_person_qrcodes
|
||||
from person import add_alternate_domains
|
||||
from person import add_actor_update_timestamp
|
||||
from person import set_person_notes
|
||||
|
@ -13821,6 +13822,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
qr_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||
if os.path.isfile(qr_filename):
|
||||
if self._etag_exists(qr_filename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
|
||||
tries = 0
|
||||
media_binary = None
|
||||
while tries < 5:
|
||||
|
@ -20645,6 +20651,7 @@ def run_daemon(crawlers_allowed: [],
|
|||
save_domain_qrcode(base_dir, 'http', i2p_domain)
|
||||
else:
|
||||
save_domain_qrcode(base_dir, http_prefix, httpd.domain_full)
|
||||
clear_person_qrcodes(base_dir)
|
||||
httpd.http_prefix = http_prefix
|
||||
httpd.debug = debug
|
||||
httpd.federation_list = fed_list.copy()
|
||||
|
|
24
person.py
24
person.py
|
@ -581,6 +581,30 @@ def create_group(base_dir: str, nickname: str, domain: str, port: int,
|
|||
return private_key_pem, public_key_pem, new_person, webfinger_endpoint
|
||||
|
||||
|
||||
def clear_person_qrcodes(base_dir: str) -> None:
|
||||
"""Clears qrcodes for all accounts
|
||||
"""
|
||||
for _, dirs, _ in os.walk(base_dir + '/accounts'):
|
||||
for handle in dirs:
|
||||
if '@' not in handle:
|
||||
continue
|
||||
nickname = handle.split('@')[0]
|
||||
domain = handle.split('@')[1]
|
||||
qrcode_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||
if os.path.isfile(qrcode_filename):
|
||||
try:
|
||||
os.remove(qrcode_filename)
|
||||
except OSError:
|
||||
pass
|
||||
if os.path.isfile(qrcode_filename + '.etag'):
|
||||
try:
|
||||
os.remove(qrcode_filename + '.etag')
|
||||
except OSError:
|
||||
pass
|
||||
break
|
||||
|
||||
|
||||
def save_person_qrcode(base_dir: str,
|
||||
nickname: str, domain: str, qrcode_domain: str,
|
||||
port: int, scale=6) -> None:
|
||||
|
|
Loading…
Reference in New Issue