merge-requests/23/head
Bob Mottram 2022-04-04 10:29:54 +01:00
parent 2317d3e0d8
commit 22461b73ef
2 changed files with 21 additions and 11 deletions

View File

@ -16,7 +16,6 @@ import datetime
from socket import error as SocketError
import errno
from functools import partial
import pyqrcode
# for saving images
from hashlib import sha256
from hashlib import md5
@ -389,6 +388,7 @@ from webapp_likers import html_likers_of_post
from crawlers import update_known_crawlers
from crawlers import blocked_user_agent
from crawlers import load_known_web_bots
from qrcode import save_domain_qrcode
import os
@ -416,16 +416,6 @@ FOLLOWS_PER_PAGE = 6
SHARES_PER_PAGE = 12
def save_domain_qrcode(base_dir: str, http_prefix: str,
domain_full: str, scale : int = 6) -> None:
"""Saves a qrcode image for the domain name
This helps to transfer onion or i2p domains to a mobile device
"""
qrcode_filename = base_dir + '/accounts/qrcode.png'
url = pyqrcode.create(http_prefix + '://' + domain_full)
url.png(qrcode_filename, scale)
class PubServer(BaseHTTPRequestHandler):
protocol_version = 'HTTP/1.1'

20
qrcode.py 100644
View File

@ -0,0 +1,20 @@
__filename__ = "qrcode.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.3.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@libreserver.org"
__status__ = "Production"
__module_group__ = "Core"
import pyqrcode
def save_domain_qrcode(base_dir: str, http_prefix: str,
domain_full: str, scale: int = 6) -> None:
"""Saves a qrcode image for the domain name
This helps to transfer onion or i2p domains to a mobile device
"""
qrcode_filename = base_dir + '/accounts/qrcode.png'
url = pyqrcode.create(http_prefix + '://' + domain_full)
url.png(qrcode_filename, scale)