Refactored apprise mailto:// and utils module (#1255)

pull/1257/head
Chris Caron 2024-12-15 13:02:18 -05:00 committed by GitHub
parent 4d21759f60
commit 551fa0d708
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
136 changed files with 2699 additions and 2176 deletions

View File

@ -32,11 +32,10 @@ import os
from itertools import chain
from . import common
from .conversion import convert_between
from .utils import is_exclusive_match
from .utils.logic import is_exclusive_match
from .utils.parse import parse_list, parse_urls
from .utils.cwe312 import cwe312_url
from .manager_plugins import NotificationManager
from .utils import parse_list
from .utils import parse_urls
from .utils import cwe312_url
from .emojis import apply_emojis
from .logger import logger
from .asset import AppriseAsset

View File

@ -33,7 +33,7 @@ from .manager_attachment import AttachmentManager
from .logger import logger
from .common import ContentLocation
from .common import CONTENT_LOCATIONS
from .utils import GET_SCHEMA_RE
from .utils.parse import GET_SCHEMA_RE
# Grant access to our Notification Manager Singleton
A_MGR = AttachmentManager()

View File

@ -32,9 +32,8 @@ from .manager_config import ConfigurationManager
from . import URLBase
from .asset import AppriseAsset
from . import common
from .utils import GET_SCHEMA_RE
from .utils import parse_list
from .utils import is_exclusive_match
from .utils.parse import GET_SCHEMA_RE, parse_list
from .utils.logic import is_exclusive_match
from .logger import logger
# Grant access to our Configuration Manager Singleton

View File

@ -143,6 +143,12 @@ class AppriseAsset:
# Defines the encoding of the content passed into Apprise
encoding = 'utf-8'
# Automatically generate our Pretty Good Privacy (PGP) keys if one isn't
# present and our environment configuration allows for it.
# For example, a case where the environment wouldn't allow for it would be
# if Persistent Storage was set to `memory`
pgp_autogen = True
# For more detail see CWE-312 @
# https://cwe.mitre.org/data/definitions/312.html
#

View File

@ -32,7 +32,7 @@ import mimetypes
import base64
from .. import exception
from ..url import URLBase
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..common import ContentLocation
from ..locale import gettext_lazy as _

View File

@ -29,7 +29,7 @@
import re
import os
from .base import AttachBase
from ..utils import path_decode
from ..utils.disk import path_decode
from ..common import ContentLocation
from ..locale import gettext_lazy as _

View File

@ -43,7 +43,8 @@ from . import AppriseAsset
from . import AppriseConfig
from . import PersistentStore
from .utils import dir_size, bytes_to_str, parse_list, path_decode
from .utils.parse import parse_list
from .utils.disk import dir_size, bytes_to_str, path_decode
from .common import NOTIFY_TYPES
from .common import NOTIFY_FORMATS
from .common import PERSISTENT_STORE_MODES

View File

@ -35,11 +35,8 @@ from .. import plugins
from .. import common
from ..asset import AppriseAsset
from ..url import URLBase
from ..utils import GET_SCHEMA_RE
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import parse_urls
from ..utils import cwe312_url
from ..utils.parse import GET_SCHEMA_RE, parse_list, parse_bool, parse_urls
from ..utils.cwe312 import cwe312_url
from ..manager_config import ConfigurationManager
from ..manager_plugins import NotificationManager

View File

@ -29,7 +29,7 @@
import re
import os
from .base import ConfigBase
from ..utils import path_decode
from ..utils.disk import path_decode
from ..common import ConfigFormat
from ..common import ContentIncludeMode
from ..locale import gettext_lazy as _

View File

@ -29,10 +29,8 @@
from ..plugins.base import NotifyBase
from ..manager_plugins import NotificationManager
from ..utils import URL_DETAILS_RE
from ..utils import parse_url
from ..utils import url_assembly
from ..utils import dict_full_update
from ..utils.parse import URL_DETAILS_RE, parse_url, url_assembly
from ..utils.logic import dict_full_update
from .. import common
from ..logger import logger
import inspect

View File

@ -37,6 +37,14 @@ class AppriseException(Exception):
self.error_code = error_code
class ApprisePluginException(AppriseException):
"""
Class object for handling exceptions raised from within a plugin
"""
def __init__(self, message, error_code=600):
super().__init__(message, error_code=error_code)
class AppriseDiskIOError(AppriseException):
"""
Thrown when an disk i/o error occurs

View File

@ -33,10 +33,10 @@ import time
import hashlib
import inspect
import threading
from .utils import import_module
from .utils import Singleton
from .utils import parse_list
from .utils import path_decode
from .utils.module import import_module
from .utils.singleton import Singleton
from .utils.parse import parse_list
from .utils.disk import path_decode
from os.path import dirname
from os.path import abspath
from os.path import join
@ -244,8 +244,10 @@ class PluginManager(metaclass=Singleton):
for schema in schemas:
if schema in self._schema_map:
logger.error(
"{} schema ({}) mismatch detected - {} to {}"
.format(self.name, schema, self._schema_map,
"{} schema ({}) mismatch detected -"
' {} already maps to {}'
.format(self.name, schema,
self._schema_map[schema],
plugin))
continue

View File

@ -37,7 +37,7 @@ from datetime import datetime, timezone, timedelta
import time
import hashlib
from .common import PersistentStoreMode, PERSISTENT_STORE_MODES
from .utils import path_decode
from .utils.disk import path_decode
from .logger import logger
# Used for writing/reading time stored in cache file

View File

@ -36,9 +36,8 @@ from ..common import NotifyImageSize
from ..common import NOTIFY_IMAGE_SIZES
from ..common import NotifyType
from ..common import NOTIFY_TYPES
from ..utils import parse_list
from ..utils import cwe312_url
from ..utils import GET_SCHEMA_RE
from ..utils.cwe312 import cwe312_url
from ..utils.parse import parse_list, GET_SCHEMA_RE
from ..logger import logger
from ..locale import gettext_lazy as _
from ..locale import LazyTranslation

View File

@ -35,10 +35,8 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_bool
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import (
is_phone_no, parse_bool, parse_phone_no, validate_regex)
from ..locale import gettext_lazy as _

View File

@ -34,8 +34,7 @@ from .. import exception
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _

View File

@ -74,8 +74,7 @@ from .base import NotifyBase
from ..locale import gettext_lazy as _
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_call_sign
from ..utils import parse_call_sign
from ..utils.parse import is_call_sign, parse_call_sign
from .. import __version__
import re

View File

@ -36,8 +36,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import parse_list, parse_bool
from ..locale import gettext_lazy as _

View File

@ -32,7 +32,7 @@ from functools import partial
from ..url import URLBase
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..common import NOTIFY_TYPES
from ..common import NotifyFormat
from ..common import NOTIFY_FORMATS

View File

@ -39,9 +39,7 @@ from itertools import chain
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils.parse import is_phone_no, parse_phone_no, parse_bool
from ..locale import gettext_lazy as _

View File

@ -38,9 +38,7 @@ import json
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils.parse import is_phone_no, parse_phone_no, parse_bool
from ..locale import gettext_lazy as _

View File

@ -36,10 +36,8 @@ import requests
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import (
is_phone_no, parse_phone_no, parse_bool, validate_regex)
from ..locale import gettext_lazy as _

View File

@ -37,7 +37,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -45,9 +45,7 @@ from json import dumps
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils.parse import is_phone_no, parse_phone_no, parse_bool
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -41,10 +41,8 @@ from json import loads
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils import parse_bool
from ..utils.parse import (
is_phone_no, parse_phone_no, validate_regex, parse_bool)
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -55,10 +55,8 @@ from .base import NotifyBase
from ..locale import gettext_lazy as _
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_call_sign
from ..utils import parse_call_sign
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import (
is_call_sign, parse_call_sign, parse_list, parse_bool)
class DapnetPriority:

View File

@ -30,7 +30,7 @@ import sys
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..locale import gettext_lazy as _
# Default our global support flag

View File

@ -38,8 +38,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _
# Register at https://dingtalk.com

View File

@ -54,8 +54,7 @@ from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_bool, validate_regex
from ..locale import gettext_lazy as _
from ..attachment.base import AttachBase

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# BSD 2-Clause License
#
# Apprise - Push Notification Library.
# Copyright (c) 2024, Chris Caron <lead2gold@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from email import charset
from .base import NotifyEmail
from .common import (
AppriseEmailException, EmailMessage, SecureMailMode, SECURE_MODES,
WebBaseLogin)
from .templates import EMAIL_TEMPLATES
# Globally Default encoding mode set to Quoted Printable.
charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
__all__ = [
# Reference
'NotifyEmail',
# Pretty Good Privacy
'ApprisePGPController', 'ApprisePGPException',
# Other
'AppriseEmailException', 'EmailMessage', 'SecureMailMode', 'SECURE_MODES',
'WebBaseLogin',
# Additional entries that may be useful to some developers
'EMAIL_TEMPLATES', 'PGP_SUPPORT',
]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
# BSD 2-Clause License
#
# Apprise - Push Notification Library.
# Copyright (c) 2024, Chris Caron <lead2gold@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import dataclasses
import typing as t
from ...exception import ApprisePluginException
class AppriseEmailException(ApprisePluginException):
"""
Thrown when there is an error with the Email Attachment
"""
def __init__(self, message, error_code=601):
super().__init__(message, error_code=error_code)
class WebBaseLogin:
"""
This class is just used in conjunction of the default emailers
to best formulate a login to it using the data detected
"""
# User Login must be Email Based
EMAIL = 'Email'
# User Login must UserID Based
USERID = 'UserID'
# Secure Email Modes
class SecureMailMode:
INSECURE = "insecure"
SSL = "ssl"
STARTTLS = "starttls"
# Define all of the secure modes (used during validation)
SECURE_MODES = {
SecureMailMode.STARTTLS: {
'default_port': 587,
},
SecureMailMode.SSL: {
'default_port': 465,
},
SecureMailMode.INSECURE: {
'default_port': 25,
},
}
@dataclasses.dataclass
class EmailMessage:
"""
Our message structure
"""
recipient: str
to_addrs: t.List[str]
body: str

View File

@ -0,0 +1,272 @@
# -*- coding: utf-8 -*-
# BSD 2-Clause License
#
# Apprise - Push Notification Library.
# Copyright (c) 2024, Chris Caron <lead2gold@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import re
from .common import (SecureMailMode, WebBaseLogin)
# To attempt to make this script stupid proof, if we detect an email address
# that is part of the this table, we can pre-use a lot more defaults if they
# aren't otherwise specified on the users input.
EMAIL_TEMPLATES = (
# Google GMail
(
'Google Mail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>gmail\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.gmail.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Yandex
(
'Yandex',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>yandex\.(com|ru|ua|by|kz|uz|tr|fr))$', re.I),
{
'port': 465,
'smtp_host': 'smtp.yandex.ru',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.USERID, )
},
),
# Microsoft Hotmail
(
'Microsoft Hotmail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(hotmail|live)\.com(\.au)?)$', re.I),
{
'port': 587,
'smtp_host': 'smtp-mail.outlook.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Microsoft Outlook
(
'Microsoft Outlook',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(smtp\.)?outlook\.com(\.au)?)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.outlook.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Microsoft Office 365 (Email Server)
# You must specify an authenticated sender address in the from= settings
# and a valid email in the to= to deliver your emails to
(
'Microsoft Office 365',
re.compile(
r'^[^@]+@(?P<domain>(smtp\.)?office365\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.office365.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
},
),
# Yahoo Mail
(
'Yahoo Mail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>yahoo\.(ca|com))$', re.I),
{
'port': 465,
'smtp_host': 'smtp.mail.yahoo.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Fast Mail (Series 1)
(
'Fast Mail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>fastmail\.(com|cn|co\.uk|com\.au|de|es|fm|fr|im|'
r'in|jp|mx|net|nl|org|se|to|tw|uk|us))$', re.I),
{
'port': 465,
'smtp_host': 'smtp.fastmail.com',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Fast Mail (Series 2)
(
'Fast Mail Extended Addresses',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>123mail\.org|airpost\.net|eml\.cc|fmail\.co\.uk|'
r'fmgirl\.com|fmguy\.com|mailbolt\.com|mailcan\.com|'
r'mailhaven\.com|mailmight\.com|ml1\.net|mm\.st|myfastmail\.com|'
r'proinbox\.com|promessage\.com|rushpost\.com|sent\.(as|at|com)|'
r'speedymail\.org|warpmail\.net|xsmail\.com|150mail\.com|'
r'150ml\.com|16mail\.com|2-mail\.com|4email\.net|50mail\.com|'
r'allmail\.net|bestmail\.us|cluemail\.com|elitemail\.org|'
r'emailcorner\.net|emailengine\.(net|org)|emailgroups\.net|'
r'emailplus\.org|emailuser\.net|f-m\.fm|fast-email\.com|'
r'fast-mail\.org|fastem\.com|fastemail\.us|fastemailer\.com|'
r'fastest\.cc|fastimap\.com|fastmailbox\.net|fastmessaging\.com|'
r'fea\.st|fmailbox\.com|ftml\.net|h-mail\.us|hailmail\.net|'
r'imap-mail\.com|imap\.cc|imapmail\.org|inoutbox\.com|'
r'internet-e-mail\.com|internet-mail\.org|internetemails\.net|'
r'internetmailing\.net|jetemail\.net|justemail\.net|'
r'letterboxes\.org|mail-central\.com|mail-page\.com|'
r'mailandftp\.com|mailas\.com|mailc\.net|mailforce\.net|'
r'mailftp\.com|mailingaddress\.org|mailite\.com|mailnew\.com|'
r'mailsent\.net|mailservice\.ms|mailup\.net|mailworks\.org|'
r'mymacmail\.com|nospammail\.net|ownmail\.net|petml\.com|'
r'postinbox\.com|postpro\.net|realemail\.net|reallyfast\.biz|'
r'reallyfast\.info|speedpost\.net|ssl-mail\.com|swift-mail\.com|'
r'the-fastest\.net|the-quickest\.com|theinternetemail\.com|'
r'veryfast\.biz|veryspeedy\.net|yepmail\.net)$', re.I),
{
'port': 465,
'smtp_host': 'smtp.fastmail.com',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Zoho Mail (Free)
(
'Zoho Mail',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>zoho(mail)?\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.zoho.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# SendGrid (Email Server)
# You must specify an authenticated sender address in the from= settings
# and a valid email in the to= to deliver your emails to
(
'SendGrid',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(\.smtp)?sendgrid\.(com|net))$', re.I),
{
'port': 465,
'smtp_host': 'smtp.sendgrid.net',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.USERID, )
},
),
# 163.com
(
'163.com',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>163\.com)$', re.I),
{
'port': 465,
'smtp_host': 'smtp.163.com',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Foxmail.com
(
'Foxmail.com',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(foxmail|qq)\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.qq.com',
'secure': True,
'secure_mode': SecureMailMode.STARTTLS,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Comcast.net
(
'Comcast.net',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>(comcast)\.net)$', re.I),
{
'port': 465,
'smtp_host': 'smtp.comcast.net',
'secure': True,
'secure_mode': SecureMailMode.SSL,
'login_type': (WebBaseLogin.EMAIL, )
},
),
# Catch All
(
'Custom',
re.compile(
r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@'
r'(?P<domain>.+)$', re.I),
{
# Setting smtp_host to None is a way of
# auto-detecting it based on other parameters
# specified. There is no reason to ever modify
# this Catch All
'smtp_host': None,
},
),
)

View File

@ -36,7 +36,7 @@ from json import loads
from .base import NotifyBase
from ..url import PrivacyMode
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..common import NotifyType
from .. import __version__ as VERSION
from ..locale import gettext_lazy as _

View File

@ -52,10 +52,8 @@ import requests
from json import dumps
from ..base import NotifyBase
from ...common import NotifyType
from ...utils import validate_regex
from ...utils import parse_list
from ...utils import parse_bool
from ...utils import dict_full_update
from ...utils.parse import validate_regex, parse_list, parse_bool
from ...utils.logic import dict_full_update
from ...common import NotifyImageSize
from ...apprise_attachment import AppriseAttachment
from ...locale import gettext_lazy as _

View File

@ -34,7 +34,7 @@
# https://firebase.google.com/docs/reference/fcm/rest/v1/\
# projects.messages#androidnotification
import re
from ...utils import parse_bool
from ...utils.parse import parse_bool
from ...common import NotifyType
from ...asset import AppriseAsset

View File

@ -38,7 +38,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -48,9 +48,7 @@ from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyFormat
from ..common import NotifyImageSize
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_list, parse_bool, validate_regex
from ..locale import gettext_lazy as _

View File

@ -29,7 +29,7 @@
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..locale import gettext_lazy as _
# Default our global support flag

View File

@ -61,7 +61,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -36,7 +36,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType, NotifyFormat
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -30,7 +30,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..locale import gettext_lazy as _
# Default our global support flag

View File

@ -37,7 +37,7 @@ from uuid import uuid4
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -33,9 +33,7 @@ import requests
import json
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import is_phone_no, parse_phone_no, validate_regex
from ..locale import gettext_lazy as _

View File

@ -46,8 +46,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _

View File

@ -42,9 +42,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_list, parse_bool, validate_regex
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -40,9 +40,7 @@ from json import loads
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import is_phone_no, parse_phone_no, validate_regex
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -41,7 +41,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -92,10 +92,8 @@ import requests
from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..locale import gettext_lazy as _
from ..utils import is_hostname
from ..utils import is_ipaddr
from ..utils.parse import validate_regex, is_hostname, is_ipaddr
# A URL Parser to detect App ID
LAMETRIC_APP_ID_DETECTOR_RE = re.compile(

View File

@ -37,9 +37,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..common import NotifyImageSize
from ..utils import validate_regex
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import validate_regex, parse_list, parse_bool
from ..locale import gettext_lazy as _

View File

@ -36,10 +36,8 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyImageSize
from ..utils import parse_list
from ..utils import is_hostname
from ..utils import is_ipaddr
from ..utils import parse_bool
from ..utils.parse import (
parse_list, is_hostname, is_ipaddr, parse_bool)
from ..locale import gettext_lazy as _
from ..url import PrivacyMode

View File

@ -33,7 +33,7 @@ import os
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..locale import gettext_lazy as _
# Default our global support flag

View File

@ -59,10 +59,8 @@ from email.utils import formataddr
from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyFormat
from ..utils import parse_emails
from ..utils import parse_bool
from ..utils import is_email
from ..utils import validate_regex
from ..utils.parse import (
parse_emails, parse_bool, is_email, validate_regex)
from ..logger import logger
from ..locale import gettext_lazy as _

View File

@ -38,9 +38,7 @@ from ..url import PrivacyMode
from ..common import NotifyImageSize
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_list, parse_bool, validate_regex
from ..locale import gettext_lazy as _
from ..attachment.base import AttachBase

View File

@ -45,10 +45,8 @@ from ..common import NotifyType
from ..common import NotifyImageSize
from ..common import NotifyFormat
from ..common import PersistentStoreMode
from ..utils import parse_bool
from ..utils import parse_list
from ..utils import is_hostname
from ..utils import validate_regex
from ..utils.parse import (
parse_bool, parse_list, is_hostname, validate_regex)
from ..locale import gettext_lazy as _
# Define default path

View File

@ -42,9 +42,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_bool, parse_list, validate_regex
from ..locale import gettext_lazy as _
# Some Reference Locations:

View File

@ -36,9 +36,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import is_phone_no, parse_phone_no, validate_regex
from ..locale import gettext_lazy as _

View File

@ -49,7 +49,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -41,8 +41,7 @@ from os.path import isfile
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import parse_list, parse_bool
from ..locale import gettext_lazy as _
# Default our global support flag

View File

@ -40,9 +40,8 @@ import requests
from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no, parse_bool
from ..utils import validate_regex
from ..utils.parse import (
is_phone_no, parse_phone_no, parse_bool, validate_regex)
from ..locale import gettext_lazy as _

View File

@ -85,10 +85,8 @@ from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..common import NotifyFormat
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils import apply_template
from ..utils import TemplateType
from ..utils.parse import parse_bool, validate_regex
from ..utils.templates import apply_template, TemplateType
from ..apprise_attachment import AppriseAttachment
from ..locale import gettext_lazy as _

View File

@ -31,7 +31,7 @@ import requests
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import parse_list
from ..utils.parse import parse_list
from ..locale import gettext_lazy as _

View File

@ -32,7 +32,7 @@ from json import dumps
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import parse_list
from ..utils.parse import parse_list
from ..locale import gettext_lazy as _

View File

@ -46,7 +46,7 @@ import requests
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -35,8 +35,7 @@ from .base import NotifyBase
from ..common import NotifyType
from ..locale import gettext_lazy as _
from ..common import NotifyImageSize
from ..utils import parse_list, parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_list, parse_bool, validate_regex
from .discord import USER_ROLE_DETECTION_RE
# Used to break path apart into list of channels

View File

@ -46,8 +46,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_bool, validate_regex
from ..locale import gettext_lazy as _

View File

@ -46,11 +46,8 @@ from ..common import NotifyFormat
from ..common import NotifyType
from ..common import NotifyImageSize
from ..locale import gettext_lazy as _
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import is_hostname
from ..utils import is_ipaddr
from ..utils import validate_regex
from ..utils.parse import (
parse_list, parse_bool, is_hostname, is_ipaddr, validate_regex)
from ..url import PrivacyMode
from ..attachment.base import AttachBase
from ..attachment.memory import AttachMemory

View File

@ -49,9 +49,7 @@ from .. import exception
from ..url import PrivacyMode
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import is_email
from ..utils import parse_emails
from ..utils import validate_regex
from ..utils.parse import is_email, parse_emails, validate_regex
from ..locale import gettext_lazy as _
from ..common import PersistentStoreMode

View File

@ -40,12 +40,8 @@ from itertools import chain
from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyImageSize
from ..utils import decode_b64_dict
from ..utils import encode_b64_dict
from ..utils import validate_regex
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import is_email
from ..utils.base64 import decode_b64_dict, encode_b64_dict
from ..utils.parse import validate_regex, parse_list, parse_bool, is_email
from ..locale import gettext_lazy as _

View File

@ -53,10 +53,7 @@ import hashlib
from .base import NotifyBase
from ..common import NotifyType, NOTIFY_TYPES
from ..common import PersistentStoreMode
from ..utils import validate_regex
from ..utils import is_uuid
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import validate_regex, is_uuid, parse_list, parse_bool
from ..locale import gettext_lazy as _

View File

@ -38,8 +38,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..common import NotifyImageSize
from ..utils import validate_regex
from ..utils import parse_bool
from ..utils.parse import validate_regex, parse_bool
from ..locale import gettext_lazy as _

View File

@ -33,8 +33,7 @@ from uuid import uuid4
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _

View File

@ -32,7 +32,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _
# Used to break path apart into list of targets

View File

@ -41,10 +41,8 @@ import requests
from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_bool
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import (
parse_bool, is_phone_no, parse_phone_no, validate_regex)
from ..locale import gettext_lazy as _

View File

@ -30,11 +30,8 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_email
from ..utils import is_phone_no
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import (
is_email, is_phone_no, parse_list, parse_bool, validate_regex)
from ..locale import gettext_lazy as _

View File

@ -30,7 +30,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -31,10 +31,8 @@ from json import dumps
from json import loads
from .base import NotifyBase
from ..utils import is_email
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import is_email, parse_list, validate_regex
from ..locale import gettext_lazy as _
from ..attachment.base import AttachBase

View File

@ -30,7 +30,7 @@ import requests
from ..common import NotifyType
from .base import NotifyBase
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _
# Syntax:

View File

@ -34,8 +34,7 @@ from itertools import chain
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _
# Used to detect and parse channels

View File

@ -32,7 +32,7 @@ from json import dumps
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -31,8 +31,7 @@ import requests
from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyFormat
from ..utils import validate_regex
from ..utils import parse_bool
from ..utils.parse import validate_regex, parse_bool
from ..locale import gettext_lazy as _

View File

@ -34,8 +34,7 @@ from .base import NotifyBase
from ..common import NotifyType
from ..common import NotifyFormat
from ..conversion import convert_between
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _
from ..attachment.base import AttachBase

View File

@ -32,8 +32,7 @@ from json import loads
from .base import NotifyBase
from .. import exception
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _

View File

@ -34,8 +34,7 @@ from itertools import chain
from json import dumps, loads
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import parse_list, validate_regex
from ..locale import gettext_lazy as _
# Used to detect a Device and Topic

View File

@ -57,9 +57,7 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_list, parse_bool, validate_regex
from ..locale import gettext_lazy as _
from .. import __title__, __version__

View File

@ -46,8 +46,7 @@ from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import validate_regex
from ..utils import parse_list
from ..utils.parse import validate_regex, parse_list
from ..locale import gettext_lazy as _

View File

@ -37,8 +37,7 @@ from ..url import PrivacyMode
from ..common import NotifyImageSize
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_list
from ..utils import parse_bool
from ..utils.parse import parse_list, parse_bool
from ..locale import gettext_lazy as _
IS_CHANNEL = re.compile(r'^#(?P<name>[A-Za-z0-9_-]+)$')

View File

@ -31,7 +31,7 @@ import socket
from .base import NotifyBase
from ..common import NotifyType
from ..utils import parse_bool
from ..utils.parse import parse_bool
from ..locale import gettext_lazy as _

View File

@ -41,8 +41,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import parse_bool, validate_regex
from ..locale import gettext_lazy as _

View File

@ -53,9 +53,7 @@ from .base import NotifyBase
from .. import exception
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_list
from ..utils import is_email
from ..utils import validate_regex
from ..utils.parse import parse_list, is_email, validate_regex
from ..locale import gettext_lazy as _

View File

@ -31,7 +31,7 @@ import requests
from ..common import NotifyType
from .base import NotifyBase
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _

View File

@ -99,10 +99,8 @@ from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyFormat
from ..common import NotifyType
from ..utils import parse_emails
from ..utils import validate_regex
from ..utils.parse import parse_emails, validate_regex, is_email
from ..locale import gettext_lazy as _
from ..utils import is_email
# Our Regin Identifier
# support us-gov-west-1 syntax as well

View File

@ -34,8 +34,7 @@ import requests
import json
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils.parse import is_phone_no, parse_phone_no
from ..locale import gettext_lazy as _

View File

@ -47,8 +47,7 @@ import json
from .base import NotifyBase
from ..common import NotifyType
from ..locale import gettext_lazy as _
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils.parse import is_phone_no, parse_phone_no
from ..url import PrivacyMode

View File

@ -33,9 +33,7 @@ from json import dumps
from .base import NotifyBase
from ..common import NotifyType
from .. import exception
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils.parse import is_phone_no, parse_phone_no, parse_bool
from ..url import PrivacyMode
from ..locale import gettext_lazy as _

View File

@ -33,7 +33,7 @@ import requests
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import validate_regex
from ..utils.parse import validate_regex
from ..locale import gettext_lazy as _
from base64 import urlsafe_b64encode

View File

@ -42,9 +42,7 @@ import json
from .base import NotifyBase
from ..url import PrivacyMode
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import validate_regex
from ..utils.parse import is_phone_no, parse_phone_no, validate_regex
from ..locale import gettext_lazy as _

View File

@ -82,10 +82,8 @@ from .base import NotifyBase
from ..common import NotifyImageSize
from ..common import NotifyType
from ..common import NotifyFormat
from ..utils import is_email
from ..utils import parse_bool
from ..utils import parse_list
from ..utils import validate_regex
from ..utils.parse import (
is_email, parse_bool, parse_list, validate_regex)
from ..locale import gettext_lazy as _
# Extend HTTP Error Messages

View File

@ -34,10 +34,8 @@ from itertools import chain
from .base import NotifyBase
from ..common import NotifyType
from .. import exception
from ..utils import validate_regex
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils.parse import (
validate_regex, is_phone_no, parse_phone_no, parse_bool)
from ..url import PrivacyMode
from ..locale import gettext_lazy as _

View File

@ -37,10 +37,8 @@
import requests
from .base import NotifyBase
from ..common import NotifyType
from ..utils import is_phone_no
from ..utils import parse_phone_no
from ..utils import parse_bool
from ..utils import validate_regex
from ..utils.parse import (
is_phone_no, parse_phone_no, parse_bool, validate_regex)
from ..locale import gettext_lazy as _

Some files were not shown because too many files have changed in this diff Show More