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
followDMsFilename = \
baseDir + '/accounts/' + \
nickname + '@' + domain + \
'/.followDMs'
nickname + '@' + domain + '/.followDMs'
if onFinalWelcomeScreen:
# initial default setting created via
# the welcome screen

View File

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

View File

@ -266,7 +266,9 @@ def getSpeakerFromServer(baseDir: str, session,
def _speakerEndpointJson(displayName: str, summary: str,
content: str, imageDescription: 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
"""
speakerJson = {
@ -278,7 +280,9 @@ def _speakerEndpointJson(displayName: str, summary: str,
"id": postId,
"notify": {
"dm": postDM,
"reply": postReply
"reply": postReply,
"followRequests": followRequestsExist,
"likedBy": likedBy
}
}
if gender:
@ -441,11 +445,27 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
postDM = isDM(postJsonObject)
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,
content, imageDescription,
detectedLinks, gender, postId,
postDM, postReply)
postDM, postReply,
followRequestsExist,
likedBy)
def updateSpeaker(baseDir: str, httpPrefix: str,
nickname: str, domain: str, domainFull: str,