Create a qrcode for the domain name

main
Bob Mottram 2020-06-20 19:37:44 +00:00
parent c948cd300f
commit 46808e3932
6 changed files with 25 additions and 10 deletions

View File

@ -22,7 +22,7 @@ On Arch/Parabola:
sudo pacman -S tor python-pip python-pysocks python-pycryptodome \ sudo pacman -S tor python-pip python-pysocks python-pycryptodome \
imagemagick python-pillow python-requests \ imagemagick python-pillow python-requests \
perl-image-exiftool python-numpy python-dateutil \ perl-image-exiftool python-numpy python-dateutil \
certbot flake8 python-qrcode python-png certbot flake8
suso pip3 install pyLD suso pip3 install pyLD
``` ```
@ -37,7 +37,7 @@ sudo apt install -y \
python3-idna python3-requests \ python3-idna python3-requests \
python3-pyld python3-django-timezone-field \ python3-pyld python3-django-timezone-field \
libimage-exiftool-perl python3-flake8 \ libimage-exiftool-perl python3-flake8 \
certbot nginx python3-pyqrcode python3-png certbot nginx
``` ```
## Installation ## Installation

View File

@ -13,6 +13,7 @@ import time
import locale import locale
import urllib.parse import urllib.parse
from functools import partial from functools import partial
import pyqrcode
# for saving images # for saving images
from hashlib import sha256 from hashlib import sha256
from hashlib import sha1 from hashlib import sha1
@ -201,6 +202,16 @@ followsPerPage = 12
sharesPerPage = 12 sharesPerPage = 12
def saveDomainQrcode(baseDir: str, httpPrefix: str,
domainFull: str, scale=6) -> None:
"""Saves a qrcode image for the domain name
This helps to transfer onion or i2p domains to a mobile device
"""
qrcodeFilename = baseDir + '/accounts/qrcode.png'
url = pyqrcode.create(httpPrefix + '://' + domainFull)
url.png(qrcodeFilename, scale)
def readFollowList(filename: str) -> None: def readFollowList(filename: str) -> None:
"""Returns a list of ActivityPub addresses to follow """Returns a list of ActivityPub addresses to follow
""" """
@ -1708,12 +1719,13 @@ class PubServer(BaseHTTPRequestHandler):
self._benchmarkGETtimings(GETstartTime, GETtimings, 15) self._benchmarkGETtimings(GETstartTime, GETtimings, 15)
# image on login screen # image on login screen or qrcode
if self.path == '/login.png' or \ if self.path == '/login.png' or \
self.path == '/login.gif' or \ self.path == '/login.gif' or \
self.path == '/login.webp' or \ self.path == '/login.webp' or \
self.path == '/login.jpeg' or \ self.path == '/login.jpeg' or \
self.path == '/login.jpg': self.path == '/login.jpg' or \
self.path == '/qrcode.png':
mediaFilename = \ mediaFilename = \
self.server.baseDir + '/accounts' + self.path self.server.baseDir + '/accounts' + self.path
if os.path.isfile(mediaFilename): if os.path.isfile(mediaFilename):
@ -7981,6 +7993,7 @@ def runDaemon(blogsInstance: bool, mediaInstance: bool,
if port != 80 and port != 443: if port != 80 and port != 443:
if ':' not in domain: if ':' not in domain:
httpd.domainFull = domain + ':' + str(port) httpd.domainFull = domain + ':' + str(port)
saveDomainQrcode(baseDir, httpPrefix, httpd.domainFull)
httpd.httpPrefix = httpPrefix httpd.httpPrefix = httpPrefix
httpd.debug = debug httpd.debug = debug
httpd.federationList = fedList.copy() httpd.federationList = fedList.copy()

View File

@ -57,7 +57,7 @@ if [ -f /usr/bin/pacman ]; then
pacman -S --noconfirm python-pip python-pysocks python-pycryptodome \ pacman -S --noconfirm python-pip python-pysocks python-pycryptodome \
imagemagick python-pillow python-requests \ imagemagick python-pillow python-requests \
perl-image-exiftool python-numpy python-dateutil \ perl-image-exiftool python-numpy python-dateutil \
certbot flake8 git i2pd wget qrencode python-qrcode certbot flake8 git i2pd wget qrencode
pip3 install pyLD pip3 install pyLD
else else
apt-get update apt-get update
@ -66,7 +66,8 @@ else
python3-numpy python3-pil.imagetk python3-pip \ python3-numpy python3-pil.imagetk python3-pip \
python3-setuptools python3-socks python3-idna \ python3-setuptools python3-socks python3-idna \
libimage-exiftool-perl python3-flake8 python3-pyld \ libimage-exiftool-perl python3-flake8 python3-pyld \
python3-django-timezone-field nginx git i2pd wget qrencode python3-django-timezone-field nginx git i2pd wget \
python3-pyqrcode qrencode python3-png
fi fi
if [ ! -d /etc/i2pd ]; then if [ ! -d /etc/i2pd ]; then

View File

@ -38,7 +38,7 @@ if [ -f /usr/bin/pacman ]; then
pacman -S --noconfirm tor python-pip python-pysocks python-pycryptodome \ pacman -S --noconfirm tor python-pip python-pysocks python-pycryptodome \
imagemagick python-pillow python-requests \ imagemagick python-pillow python-requests \
perl-image-exiftool python-numpy python-dateutil \ perl-image-exiftool python-numpy python-dateutil \
certbot flake8 git qrencode python-qrcode certbot flake8 git qrencode
pip3 install pyLD pip3 install pyLD
else else
apt-get update apt-get update
@ -47,7 +47,8 @@ else
python3-numpy python3-pil.imagetk python3-pip \ python3-numpy python3-pil.imagetk python3-pip \
python3-setuptools python3-socks python3-idna \ python3-setuptools python3-socks python3-idna \
libimage-exiftool-perl python3-flake8 python3-pyld \ libimage-exiftool-perl python3-flake8 python3-pyld \
python3-django-timezone-field tor nginx git qrencode python3-django-timezone-field tor nginx git qrencode \
python3-pyqrcode python3-png
fi fi
echo 'Cloning the epicyon repo' echo 'Cloning the epicyon repo'

View File

@ -4,7 +4,7 @@ You will need python version 3.7 or later.
On a Debian based system: On a Debian based system:
sudo apt install -y tor python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-pycryptodome python3-dateutil python3-pil.imagetk python3-idna python3-requests python3-flake8 python3-pyld python3-django-timezone-field libimage-exiftool-perl certbot nginx sudo apt install -y tor python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-pycryptodome python3-dateutil python3-pil.imagetk python3-idna python3-requests python3-flake8 python3-pyld python3-django-timezone-field python3-pyqrcode python3-png libimage-exiftool-perl certbot nginx
The following instructions install Epicyon to the /opt directory. It's not essential that it be installed there, and it could be in any other preferred directory. The following instructions install Epicyon to the /opt directory. It's not essential that it be installed there, and it could be in any other preferred directory.

View File

@ -1264,7 +1264,7 @@
<p class="intro">You will need python version 3.7 or later.</p> <p class="intro">You will need python version 3.7 or later.</p>
<p class="intro">On a Debian based system:</p> <p class="intro">On a Debian based system:</p>
<div class="shell"> <div class="shell">
<p>sudo apt install -y tor python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-pycryptodome python3-dateutil python3-pil.imagetk python3-idna python3-requests python3-flake8 python3-pyld python3-django-timezone-field libimage-exiftool-perl certbot nginx</p> <p>sudo apt install -y tor python3-socks imagemagick python3-numpy python3-setuptools python3-crypto python3-pycryptodome python3-dateutil python3-pil.imagetk python3-idna python3-requests python3-flake8 python3-pyld python3-django-timezone-field python3-pyqrcode python3-png libimage-exiftool-perl certbot nginx</p>
</div> </div>
<p class="intro"> <p class="intro">