mirror of https://gitlab.com/bashrc2/epicyon
Reminder post type, for posting to yourself
parent
d392e0a15d
commit
a7b8f7453a
42
daemon.py
42
daemon.py
|
@ -66,6 +66,7 @@ from posts import createReportPost
|
||||||
from posts import createUnlistedPost
|
from posts import createUnlistedPost
|
||||||
from posts import createFollowersOnlyPost
|
from posts import createFollowersOnlyPost
|
||||||
from posts import createDirectMessagePost
|
from posts import createDirectMessagePost
|
||||||
|
from posts import createReminderPost
|
||||||
from posts import populateRepliesJson
|
from posts import populateRepliesJson
|
||||||
from posts import addToField
|
from posts import addToField
|
||||||
from posts import expireCache
|
from posts import expireCache
|
||||||
|
@ -3360,6 +3361,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if ('/users/' in self.path and
|
if ('/users/' in self.path and
|
||||||
(self.path.endswith('/newpost') or
|
(self.path.endswith('/newpost') or
|
||||||
self.path.endswith('/newblog') or
|
self.path.endswith('/newblog') or
|
||||||
|
self.path.endswith('/newreminder') or
|
||||||
self.path.endswith('/newunlisted') or
|
self.path.endswith('/newunlisted') or
|
||||||
self.path.endswith('/newfollowers') or
|
self.path.endswith('/newfollowers') or
|
||||||
self.path.endswith('/newdm') or
|
self.path.endswith('/newdm') or
|
||||||
|
@ -5435,6 +5437,44 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
|
elif postType == 'newreminder':
|
||||||
|
messageJson = None
|
||||||
|
print('A reminder was posted for ' +
|
||||||
|
nickname + '@' + self.server.domainFull)
|
||||||
|
messageJson = \
|
||||||
|
createReminderPost(self.server.baseDir,
|
||||||
|
nickname,
|
||||||
|
self.server.domain,
|
||||||
|
self.server.port,
|
||||||
|
self.server.httpPrefix,
|
||||||
|
fields['message'],
|
||||||
|
True, False, False,
|
||||||
|
filename, attachmentMediaType,
|
||||||
|
fields['imageDescription'],
|
||||||
|
self.server.useBlurHash,
|
||||||
|
None, None,
|
||||||
|
fields['subject'],
|
||||||
|
True, fields['schedulePost'],
|
||||||
|
fields['eventDate'],
|
||||||
|
fields['eventTime'],
|
||||||
|
fields['location'])
|
||||||
|
if messageJson:
|
||||||
|
# ensure that this is only being sent to the author
|
||||||
|
messageJson['object']['cc'] = []
|
||||||
|
messageJson['cc'] = []
|
||||||
|
messageJson['object']['to'] = [
|
||||||
|
self.server.httpPrefix + ':\\' +
|
||||||
|
self.server.domainFull + '/users/' + nickname
|
||||||
|
]
|
||||||
|
messageJson['to'] = messageJson['object']['to']
|
||||||
|
if fields['schedulePost']:
|
||||||
|
return 1
|
||||||
|
print('DEBUG: new reminder to ' +
|
||||||
|
str(messageJson['object']['to']))
|
||||||
|
if self._postToOutbox(messageJson, __version__, nickname):
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return -1
|
||||||
elif postType == 'newreport':
|
elif postType == 'newreport':
|
||||||
if attachmentMediaType:
|
if attachmentMediaType:
|
||||||
if attachmentMediaType != 'image':
|
if attachmentMediaType != 'image':
|
||||||
|
@ -7732,7 +7772,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# receive different types of post created by htmlNewPost
|
# receive different types of post created by htmlNewPost
|
||||||
postTypes = ("newpost", "newblog", "newunlisted", "newfollowers",
|
postTypes = ("newpost", "newblog", "newunlisted", "newfollowers",
|
||||||
"newdm", "newreport", "newshare", "newquestion",
|
"newdm", "newreport", "newshare", "newquestion",
|
||||||
"editblogpost")
|
"editblogpost", "newreminder")
|
||||||
for currPostType in postTypes:
|
for currPostType in postTypes:
|
||||||
if not authorized:
|
if not authorized:
|
||||||
break
|
break
|
||||||
|
|
32
posts.py
32
posts.py
|
@ -1177,6 +1177,38 @@ def createDirectMessagePost(baseDir: str,
|
||||||
return messageJson
|
return messageJson
|
||||||
|
|
||||||
|
|
||||||
|
def createReminderPost(baseDir: str,
|
||||||
|
nickname: str, domain: str, port: int,
|
||||||
|
httpPrefix: str,
|
||||||
|
content: str, followersOnly: bool,
|
||||||
|
saveToFile: bool, clientToServer: bool,
|
||||||
|
attachImageFilename: str, mediaType: str,
|
||||||
|
imageDescription: str, useBlurhash: bool,
|
||||||
|
inReplyTo=None, inReplyToAtomUri=None,
|
||||||
|
subject=None, debug=False,
|
||||||
|
schedulePost=False,
|
||||||
|
eventDate=None, eventTime=None,
|
||||||
|
location=None) -> {}:
|
||||||
|
"""Reminder post to self
|
||||||
|
For example, adding something to your calendar to remind you of an event
|
||||||
|
"""
|
||||||
|
postTo = None
|
||||||
|
postCc = None
|
||||||
|
messageJson = \
|
||||||
|
createPostBase(baseDir, nickname, domain, port,
|
||||||
|
postTo, postCc,
|
||||||
|
httpPrefix, content, followersOnly, saveToFile,
|
||||||
|
clientToServer,
|
||||||
|
attachImageFilename, mediaType,
|
||||||
|
imageDescription, useBlurhash,
|
||||||
|
False, False, inReplyTo, inReplyToAtomUri, subject,
|
||||||
|
schedulePost, eventDate, eventTime, location)
|
||||||
|
if schedulePost:
|
||||||
|
savePostToBox(baseDir, httpPrefix, messageJson['object']['id'],
|
||||||
|
nickname, domain, messageJson, 'scheduled')
|
||||||
|
return messageJson
|
||||||
|
|
||||||
|
|
||||||
def createReportPost(baseDir: str,
|
def createReportPost(baseDir: str,
|
||||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||||
content: str, followersOnly: bool, saveToFile: bool,
|
content: str, followersOnly: bool, saveToFile: bool,
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "ضوء النجوم",
|
"Starlight": "ضوء النجوم",
|
||||||
"Search banner image": "البحث عن صورة بانر",
|
"Search banner image": "البحث عن صورة بانر",
|
||||||
"Henge": "هنج",
|
"Henge": "هنج",
|
||||||
"QR Code": "رمز الاستجابة السريعة"
|
"QR Code": "رمز الاستجابة السريعة",
|
||||||
|
"Reminder": "تذكير",
|
||||||
|
"Scheduled note to yourself": "ملاحظة مجدولة لنفسك"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Starlight",
|
"Starlight": "Starlight",
|
||||||
"Search banner image": "Cerca imatge del banner",
|
"Search banner image": "Cerca imatge del banner",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "Codi QR"
|
"QR Code": "Codi QR",
|
||||||
|
"Reminder": "Recordatori",
|
||||||
|
"Scheduled note to yourself": "Nota programada a tu mateix"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Starlight",
|
"Starlight": "Starlight",
|
||||||
"Search banner image": "Chwilio delwedd baner",
|
"Search banner image": "Chwilio delwedd baner",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "Cod QR"
|
"QR Code": "Cod QR",
|
||||||
|
"Reminder": "Nodyn atgoffa",
|
||||||
|
"Scheduled note to yourself": "Nodyn wedi'i drefnu i chi'ch hun"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Sternenlicht",
|
"Starlight": "Sternenlicht",
|
||||||
"Search banner image": "Suche Banner Bild",
|
"Search banner image": "Suche Banner Bild",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "QR-Code"
|
"QR Code": "QR-Code",
|
||||||
|
"Reminder": "Erinnerung",
|
||||||
|
"Scheduled note to yourself": "Geplante Notiz an dich"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Starlight",
|
"Starlight": "Starlight",
|
||||||
"Search banner image": "Search banner image",
|
"Search banner image": "Search banner image",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "QR Code"
|
"QR Code": "QR Code",
|
||||||
|
"Reminder": "Reminder",
|
||||||
|
"Scheduled note to yourself": "Scheduled note to yourself"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Luz de las estrellas",
|
"Starlight": "Luz de las estrellas",
|
||||||
"Search banner image": "Buscar imagen de banner",
|
"Search banner image": "Buscar imagen de banner",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "Código QR"
|
"QR Code": "Código QR",
|
||||||
|
"Reminder": "Recordatorio",
|
||||||
|
"Scheduled note to yourself": "Nota programada para ti"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Lumière des étoiles",
|
"Starlight": "Lumière des étoiles",
|
||||||
"Search banner image": "Image de bannière de recherche",
|
"Search banner image": "Image de bannière de recherche",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "QR Code"
|
"QR Code": "QR Code",
|
||||||
|
"Reminder": "Rappel",
|
||||||
|
"Scheduled note to yourself": "Note programmée pour vous"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Starlight",
|
"Starlight": "Starlight",
|
||||||
"Search banner image": "Cuardaigh íomhá meirge",
|
"Search banner image": "Cuardaigh íomhá meirge",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "Cód QR"
|
"QR Code": "Cód QR",
|
||||||
|
"Reminder": "Meabhrúchán",
|
||||||
|
"Scheduled note to yourself": "Nóta sceidealta duit féin"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "तारों का",
|
"Starlight": "तारों का",
|
||||||
"Search banner image": "बैनर छवि खोजें",
|
"Search banner image": "बैनर छवि खोजें",
|
||||||
"Henge": "हेंगे",
|
"Henge": "हेंगे",
|
||||||
"QR Code": "क्यूआर कोड"
|
"QR Code": "क्यूआर कोड",
|
||||||
|
"Reminder": "अनुस्मारक",
|
||||||
|
"Scheduled note to yourself": "खुद को निर्धारित नोट"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "luce stellare",
|
"Starlight": "luce stellare",
|
||||||
"Search banner image": "Cerca immagine banner",
|
"Search banner image": "Cerca immagine banner",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "QR Code"
|
"QR Code": "QR Code",
|
||||||
|
"Reminder": "Promemoria",
|
||||||
|
"Scheduled note to yourself": "Nota programmata per te"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "スターライト",
|
"Starlight": "スターライト",
|
||||||
"Search banner image": "バナー画像を検索",
|
"Search banner image": "バナー画像を検索",
|
||||||
"Henge": "ヘンゲ",
|
"Henge": "ヘンゲ",
|
||||||
"QR Code": "QRコード"
|
"QR Code": "QRコード",
|
||||||
|
"Reminder": "リマインダー",
|
||||||
|
"Scheduled note to yourself": "自分への予定されたメモ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,5 +228,7 @@
|
||||||
"Starlight": "Starlight",
|
"Starlight": "Starlight",
|
||||||
"Search banner image": "Search banner image",
|
"Search banner image": "Search banner image",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "QR Code"
|
"QR Code": "QR Code",
|
||||||
|
"Reminder": "Reminder",
|
||||||
|
"Scheduled note to yourself": "Scheduled note to yourself"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Luz das estrelas",
|
"Starlight": "Luz das estrelas",
|
||||||
"Search banner image": "Pesquisar imagem do banner",
|
"Search banner image": "Pesquisar imagem do banner",
|
||||||
"Henge": "Henge",
|
"Henge": "Henge",
|
||||||
"QR Code": "Código QR"
|
"QR Code": "Código QR",
|
||||||
|
"Reminder": "Lembrete",
|
||||||
|
"Scheduled note to yourself": "Nota agendada para si mesmo"
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,5 +232,7 @@
|
||||||
"Starlight": "Звездный свет",
|
"Starlight": "Звездный свет",
|
||||||
"Search banner image": "Поиск изображения баннера",
|
"Search banner image": "Поиск изображения баннера",
|
||||||
"Henge": "Хендж",
|
"Henge": "Хендж",
|
||||||
"QR Code": "QR код"
|
"QR Code": "QR код",
|
||||||
|
"Reminder": "напоминание",
|
||||||
|
"Scheduled note to yourself": "Запланированная заметка для себя"
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,5 +231,7 @@
|
||||||
"Starlight": "星光",
|
"Starlight": "星光",
|
||||||
"Search banner image": "搜索横幅图像",
|
"Search banner image": "搜索横幅图像",
|
||||||
"Henge": "亨格",
|
"Henge": "亨格",
|
||||||
"QR Code": "二维码"
|
"QR Code": "二维码",
|
||||||
|
"Reminder": "提醒",
|
||||||
|
"Scheduled note to yourself": "预定给自己的笔记"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1703,7 +1703,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
|
|
||||||
if not path.endswith('/newshare'):
|
if not path.endswith('/newshare'):
|
||||||
if not path.endswith('/newreport'):
|
if not path.endswith('/newreport'):
|
||||||
if not inReplyTo:
|
if not inReplyTo or path.endswith('/newreminder'):
|
||||||
newPostText = '<p class="new-post-text">' + \
|
newPostText = '<p class="new-post-text">' + \
|
||||||
translate['Write your post text below.'] + '</p>'
|
translate['Write your post text below.'] + '</p>'
|
||||||
else:
|
else:
|
||||||
|
@ -1781,6 +1781,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
pathBase = path.replace('/newreport', '').replace('/newpost', '')
|
pathBase = path.replace('/newreport', '').replace('/newpost', '')
|
||||||
pathBase = pathBase.replace('/newblog', '').replace('/newshare', '')
|
pathBase = pathBase.replace('/newblog', '').replace('/newshare', '')
|
||||||
pathBase = pathBase.replace('/newunlisted', '')
|
pathBase = pathBase.replace('/newunlisted', '')
|
||||||
|
pathBase = pathBase.replace('/newreminder', '')
|
||||||
pathBase = pathBase.replace('/newfollowers', '').replace('/newdm', '')
|
pathBase = pathBase.replace('/newfollowers', '').replace('/newdm', '')
|
||||||
|
|
||||||
newPostImageSection = ' <div class="container">'
|
newPostImageSection = ' <div class="container">'
|
||||||
|
@ -1819,6 +1820,10 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
scopeIcon = 'scope_dm.png'
|
scopeIcon = 'scope_dm.png'
|
||||||
scopeDescription = translate['DM']
|
scopeDescription = translate['DM']
|
||||||
endpoint = 'newdm'
|
endpoint = 'newdm'
|
||||||
|
elif path.endswith('/newreminder'):
|
||||||
|
scopeIcon = 'scope_reminder.png'
|
||||||
|
scopeDescription = translate['Reminder']
|
||||||
|
endpoint = 'newreminder'
|
||||||
elif path.endswith('/newreport'):
|
elif path.endswith('/newreport'):
|
||||||
scopeIcon = 'scope_report.png'
|
scopeIcon = 'scope_report.png'
|
||||||
scopeDescription = translate['Report']
|
scopeDescription = translate['Report']
|
||||||
|
@ -1941,6 +1946,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
dropdownUnlistedSuffix = '/newunlisted'
|
dropdownUnlistedSuffix = '/newunlisted'
|
||||||
dropdownFollowersSuffix = '/newfollowers'
|
dropdownFollowersSuffix = '/newfollowers'
|
||||||
dropdownDMSuffix = '/newdm'
|
dropdownDMSuffix = '/newdm'
|
||||||
|
dropdownReminderSuffix = '/newreminder'
|
||||||
dropdownReportSuffix = '/newreport'
|
dropdownReportSuffix = '/newreport'
|
||||||
if inReplyTo or mentions:
|
if inReplyTo or mentions:
|
||||||
dropdownNewPostSuffix = ''
|
dropdownNewPostSuffix = ''
|
||||||
|
@ -1948,6 +1954,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
dropdownUnlistedSuffix = ''
|
dropdownUnlistedSuffix = ''
|
||||||
dropdownFollowersSuffix = ''
|
dropdownFollowersSuffix = ''
|
||||||
dropdownDMSuffix = ''
|
dropdownDMSuffix = ''
|
||||||
|
dropdownReminderSuffix = ''
|
||||||
dropdownReportSuffix = ''
|
dropdownReportSuffix = ''
|
||||||
if inReplyTo:
|
if inReplyTo:
|
||||||
dropdownNewPostSuffix += '?replyto=' + inReplyTo
|
dropdownNewPostSuffix += '?replyto=' + inReplyTo
|
||||||
|
@ -1998,6 +2005,12 @@ def htmlNewPost(mediaInstance: bool, translate: {},
|
||||||
'"><img loading="lazy" alt="" title="" src="/' + \
|
'"><img loading="lazy" alt="" title="" src="/' + \
|
||||||
iconsDir + '/scope_dm.png"/><b>' + translate['DM'] + \
|
iconsDir + '/scope_dm.png"/><b>' + translate['DM'] + \
|
||||||
'</b><br>' + translate['Only to mentioned people'] + '</a>'
|
'</b><br>' + translate['Only to mentioned people'] + '</a>'
|
||||||
|
dropDownContent += \
|
||||||
|
' <a href="' + \
|
||||||
|
pathBase + dropdownReminderSuffix + \
|
||||||
|
'"><img loading="lazy" alt="" title="" src="/' + \
|
||||||
|
iconsDir + '/scope_reminder.png"/><b>' + translate['Reminder'] + \
|
||||||
|
'</b><br>' + translate['Scheduled note to yourself'] + '</a>'
|
||||||
dropDownContent += \
|
dropDownContent += \
|
||||||
' <a href="' + pathBase + dropdownReportSuffix + \
|
' <a href="' + pathBase + dropdownReportSuffix + \
|
||||||
'"><img loading="lazy" alt="" title="" src="/' + iconsDir + \
|
'"><img loading="lazy" alt="" title="" src="/' + iconsDir + \
|
||||||
|
|
Loading…
Reference in New Issue