Notification flags on speaker endpoint

merge-requests/21/head
Bob Mottram 2021-03-09 15:01:35 +00:00
parent 66056face5
commit 28a6174e96
3 changed files with 27 additions and 8 deletions

View File

@ -4853,8 +4853,7 @@ class PubServer(BaseHTTPRequestHandler):
# only receive DMs from accounts you follow # only receive DMs from accounts you follow
followDMsFilename = \ followDMsFilename = \
baseDir + '/accounts/' + \ baseDir + '/accounts/' + \
nickname + '@' + domain + \ nickname + '@' + domain + '/.followDMs'
'/.followDMs'
if onFinalWelcomeScreen: if onFinalWelcomeScreen:
# initial default setting created via # initial default setting created via
# the welcome screen # the welcome screen

View File

@ -209,9 +209,9 @@ function notifications {
if [[ "$epicyonLikeFileContent" == *':'* ]]; then if [[ "$epicyonLikeFileContent" == *':'* ]]; then
epicyonLikeMessage="Epicyon: $epicyonLikeFileContent" epicyonLikeMessage="Epicyon: $epicyonLikeFileContent"
fi fi
"${PROJECT_NAME}-notification" -u "$USERNAME" -s "Epicyon" -m "$epicyonLikeMessage" --sensitive yes sendNotification "$USERNAME" "Epicyon" "$epicyonLikeMessage"
echo "##sent##" > "$epicyonLikeFile" echo "##sent##" > "$epicyonLikeFile"
chown ${PROJECT_NAME}:${PROJECT_NAME} "$epicyonLkeFile" chown ${PROJECT_NAME}:${PROJECT_NAME} "$epicyonLikeFile"
fi fi
fi fi

View File

@ -266,7 +266,9 @@ def getSpeakerFromServer(baseDir: str, session,
def _speakerEndpointJson(displayName: str, summary: str, def _speakerEndpointJson(displayName: str, summary: str,
content: str, imageDescription: str, content: str, imageDescription: str,
links: [], gender: str, postId: str, links: [], gender: str, postId: str,
postDM: bool, postReply: bool) -> {}: postDM: bool, postReply: bool,
followRequestsExist: bool,
likedBy: str) -> {}:
"""Returns a json endpoint for the TTS speaker """Returns a json endpoint for the TTS speaker
""" """
speakerJson = { speakerJson = {
@ -278,7 +280,9 @@ def _speakerEndpointJson(displayName: str, summary: str,
"id": postId, "id": postId,
"notify": { "notify": {
"dm": postDM, "dm": postDM,
"reply": postReply "reply": postReply,
"followRequests": followRequestsExist,
"likedBy": likedBy
} }
} }
if gender: if gender:
@ -441,11 +445,27 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
actor = httpPrefix + '://' + domainFull + '/users/' + nickname actor = httpPrefix + '://' + domainFull + '/users/' + nickname
postDM = isDM(postJsonObject) postDM = isDM(postJsonObject)
postReply = isReply(postJsonObject, actor) postReply = isReply(postJsonObject, actor)
followRequestsExist = False
accountsDir = baseDir + '/accounts/' + nickname + '@' + domainFull
approveFollowsFilename = accountsDir + '/followrequests.txt'
if os.path.isfile(approveFollowsFilename):
with open(approveFollowsFilename, 'r') as fp:
follows = fp.readlines()
if len(follows) > 0:
followRequestsExist = True
likedBy = ''
likeFilename = accountsDir + '/.newLike'
if os.path.isfile(likeFilename):
with open(likeFilename, 'r') as fp:
likedBy = fp.read()
return _speakerEndpointJson(speakerName, summary, return _speakerEndpointJson(speakerName, summary,
content, imageDescription, content, imageDescription,
detectedLinks, gender, postId, detectedLinks, gender, postId,
postDM, postReply) postDM, postReply,
followRequestsExist,
likedBy)
def updateSpeaker(baseDir: str, httpPrefix: str, def updateSpeaker(baseDir: str, httpPrefix: str,
nickname: str, domain: str, domainFull: str, nickname: str, domain: str, domainFull: str,