Notification client stores all direct messages

merge-requests/21/head
Bob Mottram 2021-03-12 14:34:56 +00:00
parent 77818c99ce
commit ed05285ace
2 changed files with 11 additions and 2 deletions

View File

@ -569,6 +569,9 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
speakerJson['say'] = messageStr speakerJson['say'] = messageStr
speakerJson['decrypted'] = True speakerJson['decrypted'] = True
_storeMessage(speakerJson) _storeMessage(speakerJson)
elif speakerJson.get('direct'):
speakerJson['decrypted'] = False
_storeMessage(speakerJson)
print('') print('')

View File

@ -12,6 +12,7 @@ import random
import urllib.parse import urllib.parse
from auth import createBasicAuthHeader from auth import createBasicAuthHeader
from session import getJson from session import getJson
from utils import isDM
from utils import camelCaseSplit from utils import camelCaseSplit
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getNicknameFromActor from utils import getNicknameFromActor
@ -284,7 +285,8 @@ def _speakerEndpointJson(displayName: str, summary: str,
postDM: bool, postReply: bool, postDM: bool, postReply: bool,
followRequestsExist: bool, followRequestsExist: bool,
likedBy: str, published: str, postCal: bool, likedBy: str, published: str, postCal: bool,
postShare: bool, themeName: str) -> {}: postShare: bool, themeName: str,
isDirect: bool) -> {}:
"""Returns a json endpoint for the TTS speaker """Returns a json endpoint for the TTS speaker
""" """
speakerJson = { speakerJson = {
@ -296,6 +298,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
"imageDescription": imageDescription, "imageDescription": imageDescription,
"detectedLinks": links, "detectedLinks": links,
"id": postId, "id": postId,
"direct": isDirect,
"notify": { "notify": {
"theme": themeName, "theme": themeName,
"dm": postDM, "dm": postDM,
@ -445,6 +448,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
imageDescription += \ imageDescription += \
img['name'] + '. ' img['name'] + '. '
isDirect = isDM(postJsonObject)
published = '' published = ''
if postJsonObject['object'].get('published'): if postJsonObject['object'].get('published'):
published = postJsonObject['object']['published'] published = postJsonObject['object']['published']
@ -512,7 +517,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
postDM, postReply, postDM, postReply,
followRequestsExist, followRequestsExist,
likedBy, published, likedBy, published,
postCal, postShare, themeName) postCal, postShare, themeName,
isDirect)
def updateSpeaker(baseDir: str, httpPrefix: str, def updateSpeaker(baseDir: str, httpPrefix: str,