mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-18 06:11:49 -05:00
Merge pull request #99 from craigerl/remove-email-validation
Remove email validation
This commit is contained in:
commit
19f804bf68
15
.github/workflows/master-build.yml
vendored
15
.github/workflows/master-build.yml
vendored
@ -1,8 +1,16 @@
|
||||
name: Test and Build Latest Container Image
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 10 * * *"
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
jobs:
|
||||
tox:
|
||||
@ -43,8 +51,11 @@ jobs:
|
||||
- name: Build the Docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: ./docker
|
||||
context: "{{defaultContext}}:docker"
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
file: ./Dockerfile-dev
|
||||
build-args: |
|
||||
BRANCH=${{ steps.branch-name.outputs.current_branch }}
|
||||
push: true
|
||||
tags: |
|
||||
hemna6969/aprsd:${{ steps.branch-name.outputs.current_branch }}
|
||||
|
4
Makefile
4
Makefile
@ -80,5 +80,5 @@ update-requirements: dev ## Update the requirements.txt and dev-requirements.tx
|
||||
rm dev-requirements.txt
|
||||
touch requirements.txt
|
||||
touch dev-requirements.txt
|
||||
$(VENV)/pip-compile requirements.in
|
||||
$(VENV)/pip-compile dev-requirements.in
|
||||
$(VENV)/pip-compile --resolver backtracking --annotation-style line requirements.in
|
||||
$(VENV)/pip-compile --resolver backtracking --annotation-style line dev-requirements.in
|
||||
|
@ -9,7 +9,6 @@ import threading
|
||||
import time
|
||||
|
||||
import imapclient
|
||||
from validate_email import validate_email
|
||||
|
||||
from aprsd import messaging, plugin, stats, threads
|
||||
from aprsd.utils import trace
|
||||
@ -73,15 +72,8 @@ class EmailPlugin(plugin.APRSDRegexCommandPluginBase):
|
||||
"""Ensure that email is enabled and start the thread."""
|
||||
|
||||
email_enabled = self.config["aprsd"]["email"].get("enabled", False)
|
||||
validation = self.config["aprsd"]["email"].get("validate", False)
|
||||
|
||||
if email_enabled:
|
||||
valid = validate_email_config(self.config, validation)
|
||||
if not valid:
|
||||
LOG.error("Failed to validate email config options.")
|
||||
LOG.error("EmailPlugin DISABLED!!!!")
|
||||
else:
|
||||
self.enabled = True
|
||||
self.enabled = True
|
||||
else:
|
||||
LOG.info("Email services not enabled.")
|
||||
|
||||
@ -266,47 +258,6 @@ def _smtp_connect(config):
|
||||
return server
|
||||
|
||||
|
||||
def validate_shortcuts(config):
|
||||
shortcuts = config["aprsd"]["email"].get("shortcuts", None)
|
||||
if not shortcuts:
|
||||
return
|
||||
|
||||
LOG.info(
|
||||
"Validating {} Email shortcuts. This can take up to 10 seconds"
|
||||
" per shortcut".format(len(shortcuts)),
|
||||
)
|
||||
delete_keys = []
|
||||
for key in shortcuts:
|
||||
LOG.info(f"Validating {key}:{shortcuts[key]}")
|
||||
is_valid = validate_email(
|
||||
email_address=shortcuts[key],
|
||||
check_format=True,
|
||||
check_dns=True,
|
||||
check_smtp=True,
|
||||
smtp_from_address=config["aprsd"]["email"]["smtp"]["login"],
|
||||
smtp_helo_host=config["aprsd"]["email"]["smtp"]["host"],
|
||||
smtp_timeout=10,
|
||||
dns_timeout=10,
|
||||
smtp_debug=False,
|
||||
)
|
||||
if not is_valid:
|
||||
LOG.error(
|
||||
"'{}' is an invalid email address. Removing shortcut".format(
|
||||
shortcuts[key],
|
||||
),
|
||||
)
|
||||
delete_keys.append(key)
|
||||
|
||||
for key in delete_keys:
|
||||
del config["aprsd"]["email"]["shortcuts"][key]
|
||||
|
||||
LOG.info(
|
||||
"Available shortcuts: {}".format(
|
||||
config["aprsd"]["email"]["shortcuts"],
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def get_email_from_shortcut(config, addr):
|
||||
if config["aprsd"]["email"].get("shortcuts", False):
|
||||
return config["aprsd"]["email"]["shortcuts"].get(addr, addr)
|
||||
@ -324,12 +275,6 @@ def validate_email_config(config, disable_validation=False):
|
||||
LOG.info("Checking SMTP configuration")
|
||||
smtp_server = _smtp_connect(config)
|
||||
|
||||
# Now validate and flag any shortcuts as invalid
|
||||
if not disable_validation:
|
||||
validate_shortcuts(config)
|
||||
else:
|
||||
LOG.info("Shortcuts email validation is Disabled!!, you were warned.")
|
||||
|
||||
if imap_server and smtp_server:
|
||||
return True
|
||||
else:
|
||||
|
@ -6,9 +6,10 @@ Sphinx
|
||||
tox
|
||||
twine
|
||||
pre-commit
|
||||
pip-tools
|
||||
pytest
|
||||
pytest-cov
|
||||
gray
|
||||
pip==22.0.4
|
||||
pip-tools==5.4.0
|
||||
#pip==22.0.4
|
||||
pip
|
||||
#pip-tools==5.4.0
|
||||
pip-tools
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# This file is autogenerated by pip-compile with python 3.8
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile dev-requirements.in
|
||||
# pip-compile --annotation-style=line --resolver=backtracking dev-requirements.in
|
||||
#
|
||||
add-trailing-comma==2.3.0 # via gray
|
||||
alabaster==0.7.12 # via sphinx
|
||||
@ -11,7 +11,9 @@ autoflake==1.7.7 # via gray
|
||||
babel==2.11.0 # via sphinx
|
||||
black==22.10.0 # via gray
|
||||
bleach==5.0.1 # via readme-renderer
|
||||
build==0.9.0 # via pip-tools
|
||||
certifi==2022.9.24 # via requests
|
||||
cffi==1.15.1 # via cryptography
|
||||
cfgv==3.3.1 # via pre-commit
|
||||
charset-normalizer==2.1.1 # via requests
|
||||
click==8.1.3 # via black, pip-tools
|
||||
@ -19,36 +21,39 @@ colorlog==6.7.0 # via prettylog
|
||||
commonmark==0.9.1 # via rich
|
||||
configargparse==1.5.3 # via gray
|
||||
coverage[toml]==6.5.0 # via pytest-cov
|
||||
cryptography==38.0.3 # via secretstorage
|
||||
distlib==0.3.6 # via virtualenv
|
||||
docutils==0.19 # via readme-renderer, sphinx
|
||||
exceptiongroup==1.0.4 # via pytest
|
||||
fast-json==0.3.2 # via prettylog
|
||||
filelock==3.8.0 # via tox, virtualenv
|
||||
fixit==0.1.4 # via gray
|
||||
flake8==5.0.4 # via -r dev-requirements.in, fixit, pep8-naming
|
||||
flake8==6.0.0 # via -r dev-requirements.in, fixit, pep8-naming
|
||||
gray==0.12.0 # via -r dev-requirements.in
|
||||
identify==2.5.9 # via pre-commit
|
||||
idna==3.4 # via requests
|
||||
imagesize==1.4.1 # via sphinx
|
||||
importlib-metadata==5.0.0 # via keyring, sphinx, twine
|
||||
importlib-metadata==5.1.0 # via keyring, sphinx, twine
|
||||
importlib-resources==5.10.0 # via fixit, jsonschema
|
||||
iniconfig==1.1.1 # via pytest
|
||||
isort==5.10.1 # via -r dev-requirements.in, gray
|
||||
jaraco.classes==3.2.3 # via keyring
|
||||
jaraco-classes==3.2.3 # via keyring
|
||||
jeepney==0.8.0 # via keyring, secretstorage
|
||||
jinja2==3.1.2 # via sphinx
|
||||
jsonschema==4.17.1 # via fixit
|
||||
keyring==23.11.0 # via twine
|
||||
libcst==0.4.9 # via fixit
|
||||
markupsafe==2.1.1 # via jinja2
|
||||
mccabe==0.7.0 # via flake8
|
||||
more-itertools==9.0.0 # via jaraco.classes
|
||||
mypy-extensions==0.4.3 # via black, mypy, typing-inspect
|
||||
more-itertools==9.0.0 # via jaraco-classes
|
||||
mypy==0.991 # via -r dev-requirements.in
|
||||
mypy-extensions==0.4.3 # via black, mypy, typing-inspect
|
||||
nodeenv==1.7.0 # via pre-commit
|
||||
packaging==21.3 # via pytest, sphinx, tox
|
||||
packaging==21.3 # via build, pytest, sphinx, tox
|
||||
pathspec==0.10.2 # via black
|
||||
pep517==0.13.0 # via build
|
||||
pep8-naming==0.13.2 # via -r dev-requirements.in
|
||||
pip-tools==5.4.0 # via -r dev-requirements.in
|
||||
pip-tools==6.10.0 # via -r dev-requirements.in
|
||||
pkginfo==1.8.3 # via twine
|
||||
pkgutil-resolve-name==1.3.10 # via jsonschema
|
||||
platformdirs==2.5.4 # via black, virtualenv
|
||||
@ -56,22 +61,24 @@ pluggy==1.0.0 # via pytest, tox
|
||||
pre-commit==2.20.0 # via -r dev-requirements.in
|
||||
prettylog==0.3.0 # via gray
|
||||
py==1.11.0 # via tox
|
||||
pycodestyle==2.9.1 # via flake8
|
||||
pyflakes==2.5.0 # via autoflake, flake8
|
||||
pycodestyle==2.10.0 # via flake8
|
||||
pycparser==2.21 # via cffi
|
||||
pyflakes==3.0.1 # via autoflake, flake8
|
||||
pygments==2.13.0 # via readme-renderer, rich, sphinx
|
||||
pyparsing==3.0.9 # via packaging
|
||||
pyrsistent==0.19.2 # via jsonschema
|
||||
pytest-cov==4.0.0 # via -r dev-requirements.in
|
||||
pytest==7.2.0 # via -r dev-requirements.in, pytest-cov
|
||||
pytest-cov==4.0.0 # via -r dev-requirements.in
|
||||
pytz==2022.6 # via babel
|
||||
pyupgrade==3.2.2 # via gray
|
||||
pyyaml==6.0 # via fixit, libcst, pre-commit
|
||||
readme-renderer==37.3 # via twine
|
||||
requests-toolbelt==0.10.1 # via twine
|
||||
requests==2.28.1 # via requests-toolbelt, sphinx, twine
|
||||
requests-toolbelt==0.10.1 # via twine
|
||||
rfc3986==2.0.0 # via twine
|
||||
rich==12.6.0 # via twine
|
||||
six==1.16.0 # via bleach, pip-tools, tox
|
||||
secretstorage==3.3.3 # via keyring
|
||||
six==1.16.0 # via bleach, tox
|
||||
snowballstemmer==2.2.0 # via sphinx
|
||||
sphinx==5.3.0 # via -r dev-requirements.in
|
||||
sphinxcontrib-applehelp==1.0.2 # via sphinx
|
||||
@ -82,7 +89,7 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx
|
||||
sphinxcontrib-serializinghtml==1.1.5 # via sphinx
|
||||
tokenize-rt==5.0.0 # via add-trailing-comma, pyupgrade
|
||||
toml==0.10.2 # via pre-commit
|
||||
tomli==2.0.1 # via autoflake, black, coverage, mypy, pytest, tox
|
||||
tomli==2.0.1 # via autoflake, black, build, coverage, mypy, pep517, pytest, tox
|
||||
tox==3.27.1 # via -r dev-requirements.in
|
||||
twine==4.0.1 # via -r dev-requirements.in
|
||||
typing-extensions==4.4.0 # via black, libcst, mypy, rich, typing-inspect
|
||||
@ -90,9 +97,10 @@ typing-inspect==0.8.0 # via libcst
|
||||
ujson==5.5.0 # via fast-json
|
||||
unify==0.5 # via gray
|
||||
untokenize==0.1.1 # via unify
|
||||
urllib3==1.26.12 # via requests, twine
|
||||
urllib3==1.26.13 # via requests, twine
|
||||
virtualenv==20.16.7 # via pre-commit, tox
|
||||
webencodings==0.5.1 # via bleach
|
||||
wheel==0.38.4 # via pip-tools
|
||||
zipp==3.10.0 # via importlib-metadata, importlib-resources
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
|
@ -2,14 +2,14 @@
|
||||
FROM ubuntu:focal as aprsd
|
||||
|
||||
# Dockerfile for building a container during aprsd development.
|
||||
ARG branch
|
||||
ARG BRANCH=master
|
||||
ARG UID
|
||||
ARG GID
|
||||
|
||||
ENV APRS_USER=aprs
|
||||
ENV HOME=/home/aprs
|
||||
ENV APRSD=http://github.com/craigerl/aprsd.git
|
||||
ENV APRSD_BRANCH=${branch:-master}
|
||||
ENV APRSD_BRANCH=${BRANCH:-master}
|
||||
ENV VIRTUAL_ENV=$HOME/.venv3
|
||||
ENV UID=${UID:-1000}
|
||||
ENV GID=${GID:-1000}
|
||||
@ -40,7 +40,7 @@ RUN cat $HOME/.bashrc
|
||||
USER root
|
||||
WORKDIR $HOME
|
||||
RUN mkdir $INSTALL
|
||||
RUN git clone -b $APRSD_BRANCH $APRSD $INSTALL/aprsd
|
||||
RUN git clone -b $BRANCH $APRSD $INSTALL/aprsd
|
||||
RUN cd $INSTALL/aprsd && pip3 install -v .
|
||||
RUN ls -al /usr/local/bin
|
||||
RUN ls -al /usr/bin
|
||||
|
@ -11,8 +11,10 @@ cat << EOF
|
||||
usage: $0 options
|
||||
|
||||
OPTIONS:
|
||||
-h Show help
|
||||
-t The tag/version (${TAG}) (default = master)
|
||||
-d Use Dockerfile-dev for a git clone build
|
||||
-b Branch to use (default = master)
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -20,9 +22,9 @@ EOF
|
||||
ALL_PLATFORMS=0
|
||||
DEV=0
|
||||
TAG="latest"
|
||||
BRANCH="master"
|
||||
BRANCH=${BRANCH:-master}
|
||||
|
||||
while getopts “t:dab:” OPTION
|
||||
while getopts “hdat:b:” OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
t)
|
||||
@ -37,9 +39,13 @@ do
|
||||
d)
|
||||
DEV=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@ -51,7 +57,7 @@ then
|
||||
PLATFORMS="linux/arm/v7,linux/arm64,linux/amd64"
|
||||
#PLATFORMS="linux/arm/v7,linux/arm/v6,linux/amd64"
|
||||
else
|
||||
PLATFORMS="linux/amd64"
|
||||
PLATFORMS="linux/amd64,linux/arm/v7"
|
||||
fi
|
||||
|
||||
echo "Build with tag=${TAG} BRANCH=${BRANCH} dev?=${DEV} platforms?=${PLATFORMS}"
|
||||
|
@ -9,9 +9,6 @@ imapclient
|
||||
pluggy
|
||||
pbr
|
||||
pyyaml
|
||||
# Allowing a newer version can lead to a conflict with
|
||||
# requests.
|
||||
py3-validate-email
|
||||
requests
|
||||
pytz
|
||||
six
|
||||
|
@ -1,8 +1,8 @@
|
||||
#
|
||||
# This file is autogenerated by pip-compile
|
||||
# This file is autogenerated by pip-compile with python 3.8
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile requirements.in
|
||||
# pip-compile --annotation-style=line --resolver=backtracking requirements.in
|
||||
#
|
||||
aprslib==0.7.2 # via -r requirements.in
|
||||
attrs==22.1.0 # via -r requirements.in, ax253, kiss3
|
||||
@ -12,30 +12,28 @@ bidict==0.22.0 # via python-socketio
|
||||
bitarray==2.6.0 # via ax253, kiss3
|
||||
certifi==2022.9.24 # via requests
|
||||
charset-normalizer==2.1.1 # via requests
|
||||
click-completion==0.5.2 # via -r requirements.in
|
||||
click==8.1.3 # via -r requirements.in, click-completion, flask
|
||||
click-completion==0.5.2 # via -r requirements.in
|
||||
commonmark==0.9.1 # via rich
|
||||
dnspython==2.2.1 # via eventlet, py3-validate-email
|
||||
dnspython==2.2.1 # via eventlet
|
||||
eventlet==0.33.2 # via -r requirements.in
|
||||
filelock==3.8.0 # via py3-validate-email
|
||||
flask==2.1.2 # via -r requirements.in, flask-classful, flask-httpauth, flask-socketio
|
||||
flask-classful==0.14.2 # via -r requirements.in
|
||||
flask-httpauth==4.7.0 # via -r requirements.in
|
||||
flask-socketio==5.3.2 # via -r requirements.in
|
||||
flask==2.1.2 # via -r requirements.in, flask-classful, flask-httpauth, flask-socketio
|
||||
greenlet==2.0.1 # via eventlet
|
||||
idna==3.4 # via py3-validate-email, requests
|
||||
idna==3.4 # via requests
|
||||
imapclient==2.3.1 # via -r requirements.in
|
||||
importlib-metadata==5.0.0 # via ax253, flask, kiss3
|
||||
importlib-metadata==5.1.0 # via ax253, flask, kiss3
|
||||
itsdangerous==2.1.2 # via flask
|
||||
jinja2==3.1.2 # via click-completion, flask
|
||||
kiss3==8.0.0 # via -r requirements.in
|
||||
markupsafe==2.1.1 # via jinja2
|
||||
pbr==5.11.0 # via -r requirements.in
|
||||
pluggy==1.0.0 # via -r requirements.in
|
||||
py3-validate-email==1.0.5.post1 # via -r requirements.in
|
||||
pygments==2.13.0 # via rich
|
||||
pyserial-asyncio==0.6 # via kiss3
|
||||
pyserial==3.5 # via pyserial-asyncio
|
||||
pyserial-asyncio==0.6 # via kiss3
|
||||
python-engineio==4.3.4 # via python-socketio
|
||||
python-socketio==5.7.2 # via flask-socketio
|
||||
pytz==2022.6 # via -r requirements.in
|
||||
@ -48,8 +46,8 @@ soupsieve==2.3.2.post1 # via beautifulsoup4
|
||||
tabulate==0.9.0 # via -r requirements.in
|
||||
thesmuggler==1.0.1 # via -r requirements.in
|
||||
typing-extensions==4.4.0 # via rich
|
||||
update_checker==0.18.0 # via -r requirements.in
|
||||
urllib3==1.26.12 # via requests
|
||||
update-checker==0.18.0 # via -r requirements.in
|
||||
urllib3==1.26.13 # via requests
|
||||
werkzeug==2.1.2 # via -r requirements.in, flask
|
||||
wrapt==1.14.1 # via -r requirements.in
|
||||
zipp==3.10.0 # via importlib-metadata
|
||||
|
Loading…
Reference in New Issue
Block a user