default user references now look towards AppriseAsset.app_id() (#132)

This commit is contained in:
Chris Caron 2019-06-26 21:35:18 -04:00 committed by GitHub
parent 1814dc9edf
commit 8fce99a006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

@ -55,9 +55,6 @@ FLOCK_HTTP_ERROR_MAP = {
401: 'Unauthorized - Invalid Token.', 401: 'Unauthorized - Invalid Token.',
} }
# Default User
FLOCK_DEFAULT_USER = 'apprise'
# Used to detect a channel/user # Used to detect a channel/user
IS_CHANNEL_RE = re.compile(r'^(#|g:)(?P<id>[A-Z0-9_]{12})$', re.I) IS_CHANNEL_RE = re.compile(r'^(#|g:)(?P<id>[A-Z0-9_]{12})$', re.I)
IS_USER_RE = re.compile(r'^(@|u:)?(?P<id>[A-Z0-9_]{12})$', re.I) IS_USER_RE = re.compile(r'^(@|u:)?(?P<id>[A-Z0-9_]{12})$', re.I)
@ -223,7 +220,7 @@ class NotifyFlock(NotifyBase):
'token': self.token, 'token': self.token,
'flockml': body, 'flockml': body,
'sendAs': { 'sendAs': {
'name': FLOCK_DEFAULT_USER if not self.user else self.user, 'name': self.app_id if not self.user else self.user,
# A Profile Image is only configured if we're configured to # A Profile Image is only configured if we're configured to
# allow it # allow it
'profileImage': None if not self.include_image 'profileImage': None if not self.include_image

View File

@ -62,9 +62,6 @@ IS_ROOM_ID = re.compile(
r'^\s*(!|&#33;|%21)(?P<room>[a-z0-9-]+)((:|%3A)' r'^\s*(!|&#33;|%21)(?P<room>[a-z0-9-]+)((:|%3A)'
r'(?P<home_server>[a-z0-9.-]+))?\s*$', re.I) r'(?P<home_server>[a-z0-9.-]+))?\s*$', re.I)
# Default User
SLACK_DEFAULT_USER = 'apprise'
class MatrixWebhookMode(object): class MatrixWebhookMode(object):
# Webhook Mode is disabled # Webhook Mode is disabled
@ -360,7 +357,7 @@ class NotifyMatrix(NotifyBase):
# prepare JSON Object # prepare JSON Object
payload = { payload = {
'username': self.user if self.user else SLACK_DEFAULT_USER, 'username': self.user if self.user else self.app_id,
# Use Markdown language # Use Markdown language
'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN), 'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN),
'attachments': [{ 'attachments': [{

View File

@ -60,9 +60,6 @@ VALIDATE_TOKEN_B = re.compile(r'[A-Z0-9]{9}')
# /........./........./CCCCCCCCCCCCCCCCCCCCCCCC # /........./........./CCCCCCCCCCCCCCCCCCCCCCCC
VALIDATE_TOKEN_C = re.compile(r'[A-Za-z0-9]{24}') VALIDATE_TOKEN_C = re.compile(r'[A-Za-z0-9]{24}')
# Default User
SLACK_DEFAULT_USER = 'apprise'
# Extend HTTP Error Messages # Extend HTTP Error Messages
SLACK_HTTP_ERROR_MAP = { SLACK_HTTP_ERROR_MAP = {
401: 'Unauthorized - Invalid Token.', 401: 'Unauthorized - Invalid Token.',
@ -228,7 +225,7 @@ class NotifySlack(NotifyBase):
if not self.user: if not self.user:
self.logger.warning( self.logger.warning(
'No user was specified; using %s.' % SLACK_DEFAULT_USER) 'No user was specified; using "%s".' % self.app_id)
# Build list of channels # Build list of channels
self.channels = parse_list(targets) self.channels = parse_list(targets)
@ -287,7 +284,7 @@ class NotifySlack(NotifyBase):
# prepare JSON Object # prepare JSON Object
payload = { payload = {
'username': self.user if self.user else SLACK_DEFAULT_USER, 'username': self.user if self.user else self.app_id,
# Use Markdown language # Use Markdown language
'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN), 'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN),
'attachments': [{ 'attachments': [{