mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
8ef8ff33c7
16
daemon.py
16
daemon.py
|
@ -238,6 +238,7 @@ from categories import updateHashtagCategories
|
|||
from languages import getActorLanguages
|
||||
from languages import setActorLanguages
|
||||
from like import updateLikesCollection
|
||||
from utils import getNewPostEndpoints
|
||||
from utils import malformedCiphertext
|
||||
from utils import hasActor
|
||||
from utils import setReplyIntervalHours
|
||||
|
@ -11893,12 +11894,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
isNewPostEndpoint = False
|
||||
if '/users/' in path and '/new' in path:
|
||||
# Various types of new post in the web interface
|
||||
newPostEnd = ('newpost', 'newblog', 'newunlisted',
|
||||
'newfollowers', 'newdm', 'newreminder',
|
||||
'newreport', 'newquestion',
|
||||
'newshare', 'newwanted')
|
||||
for postType in newPostEnd:
|
||||
if path.endswith('/' + postType):
|
||||
newPostEndpoints = getNewPostEndpoints()
|
||||
for currPostType in newPostEndpoints:
|
||||
if path.endswith('/' + currPostType):
|
||||
isNewPostEndpoint = True
|
||||
break
|
||||
if isNewPostEndpoint:
|
||||
|
@ -16699,10 +16697,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.debug)
|
||||
|
||||
# receive different types of post created by htmlNewPost
|
||||
postTypes = ("newpost", "newblog", "newunlisted", "newfollowers",
|
||||
"newdm", "newreport", "newshare", "newwanted",
|
||||
"newquestion", "editblogpost", "newreminder")
|
||||
for currPostType in postTypes:
|
||||
newPostEndpoints = getNewPostEndpoints()
|
||||
for currPostType in newPostEndpoints:
|
||||
if not authorized:
|
||||
if self.server.debug:
|
||||
print('POST was not authorized')
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
--calendar-horizontal-padding: 0;
|
||||
--calendar-cell-size: 1.5vw;
|
||||
--calendar-cell-size-mobile: 1.5vw;
|
||||
--font-size-calendar: 20px;
|
||||
--font-size-calendar-mobile: 30px;
|
||||
--font-size-calendar-header: 3rem;
|
||||
--font-size-calendar-day: 1rem;
|
||||
--font-size-calendar-cell: 2rem;
|
||||
|
@ -248,6 +250,9 @@ tr:nth-child(even) > .calendar__day__cell:nth-child(even) {
|
|||
.calendar__day__cell {
|
||||
padding: var(--calendar-cell-size) 0 var(--calendar-cell-size);
|
||||
}
|
||||
body {
|
||||
font-size: var(--font-size-calendar);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1000px) {
|
||||
|
@ -265,4 +270,7 @@ tr:nth-child(even) > .calendar__day__cell:nth-child(even) {
|
|||
.calendar__day__cell {
|
||||
padding: var(--calendar-cell-size-mobile) 0 var(--calendar-cell-size-mobile);
|
||||
}
|
||||
body {
|
||||
font-size: var(--font-size-calendar-mobile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,13 +513,6 @@ a:focus {
|
|||
color: var(--button-text-hover);
|
||||
}
|
||||
|
||||
.containerNewPost {
|
||||
border: var(--border-width) solid var(--border-color);
|
||||
border-radius: var(--timeline-border-radius);
|
||||
background-color: var(--main-bg-color);
|
||||
margin: var(--vertical-between-posts);
|
||||
}
|
||||
|
||||
.containerSubmitNewPost {
|
||||
border: 0;
|
||||
background-color: var(--main-bg-color);
|
||||
|
@ -1058,6 +1051,16 @@ div.container {
|
|||
padding-bottom: var(--container-padding-bottom);
|
||||
margin: var(--vertical-between-posts);
|
||||
}
|
||||
.containerNewPost {
|
||||
border: var(--border-width) solid var(--border-color);
|
||||
background-color: var(--main-bg-color);
|
||||
border-radius: var(--timeline-border-radius);
|
||||
padding-left: var(--container-padding);
|
||||
padding-right: var(--container-padding);
|
||||
padding-top: var(--container-padding);
|
||||
padding-bottom: var(--container-padding-bottom);
|
||||
margin: var(--vertical-between-posts);
|
||||
}
|
||||
h3.linksHeader {
|
||||
background-color: var(--column-left-header-background);
|
||||
color: var(--column-left-header-color);
|
||||
|
@ -1754,6 +1757,16 @@ div.container {
|
|||
padding-bottom: var(--container-padding-bottom-mobile);
|
||||
margin: var(--vertical-between-posts);
|
||||
}
|
||||
.containerNewPost {
|
||||
border: var(--border-width) solid var(--border-color);
|
||||
background-color: var(--main-bg-color);
|
||||
border-radius: var(--timeline-border-radius);
|
||||
padding-left: var(--container-padding);
|
||||
padding-right: var(--container-padding);
|
||||
padding-top: var(--container-padding);
|
||||
padding-bottom: var(--container-padding-bottom-mobile);
|
||||
margin: var(--vertical-between-posts);
|
||||
}
|
||||
h3.linksHeader {
|
||||
background-color: var(--column-left-header-background);
|
||||
color: var(--column-left-header-color);
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "يترك",
|
||||
"System Monitor": "مراقب النظام",
|
||||
"Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية",
|
||||
"Known Web Crawlers": "برامج زحف الويب المعروفة"
|
||||
"Known Web Crawlers": "برامج زحف الويب المعروفة",
|
||||
"Add to the calendar": "أضف إلى التقويم"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Marxa",
|
||||
"System Monitor": "Monitor del sistema",
|
||||
"Add content warnings for the following sites": "Afegiu advertiments de contingut per als llocs següents",
|
||||
"Known Web Crawlers": "Exploradors web coneguts"
|
||||
"Known Web Crawlers": "Exploradors web coneguts",
|
||||
"Add to the calendar": "Afegeix al calendari"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Gadewch",
|
||||
"System Monitor": "Monitor System",
|
||||
"Add content warnings for the following sites": "Ychwanegwch rybuddion cynnwys ar gyfer y gwefannau canlynol",
|
||||
"Known Web Crawlers": "Crawlers Gwe Hysbys"
|
||||
"Known Web Crawlers": "Crawlers Gwe Hysbys",
|
||||
"Add to the calendar": "Ychwanegwch at y calendr"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Verlassen",
|
||||
"System Monitor": "Systemmonitor",
|
||||
"Add content warnings for the following sites": "Inhaltswarnungen für die folgenden Websites hinzufügen",
|
||||
"Known Web Crawlers": "Bekannte Web-Crawler"
|
||||
"Known Web Crawlers": "Bekannte Web-Crawler",
|
||||
"Add to the calendar": "Zum Kalender hinzufügen"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Leave",
|
||||
"System Monitor": "System Monitor",
|
||||
"Add content warnings for the following sites": "Add content warnings for the following sites",
|
||||
"Known Web Crawlers": "Known Web Crawlers"
|
||||
"Known Web Crawlers": "Known Web Crawlers",
|
||||
"Add to the calendar": "Add to the calendar"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Dejar",
|
||||
"System Monitor": "Monitor del sistema",
|
||||
"Add content warnings for the following sites": "Agregue advertencias de contenido para los siguientes sitios",
|
||||
"Known Web Crawlers": "Rastreadores web conocidos"
|
||||
"Known Web Crawlers": "Rastreadores web conocidos",
|
||||
"Add to the calendar": "Agregar al calendario"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Laisser",
|
||||
"System Monitor": "Moniteur système",
|
||||
"Add content warnings for the following sites": "Ajouter des avertissements de contenu pour les sites suivants",
|
||||
"Known Web Crawlers": "Crawlers Web connus"
|
||||
"Known Web Crawlers": "Crawlers Web connus",
|
||||
"Add to the calendar": "Ajouter au calendrier"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Fág",
|
||||
"System Monitor": "Monatóir Córais",
|
||||
"Add content warnings for the following sites": "Cuir rabhaidh ábhair leis na suíomhanna seo a leanas",
|
||||
"Known Web Crawlers": "Crawlers Gréasáin Aitheanta"
|
||||
"Known Web Crawlers": "Crawlers Gréasáin Aitheanta",
|
||||
"Add to the calendar": "Cuir leis an bhféilire"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "छोड़ना",
|
||||
"System Monitor": "सिस्टम मॉनिटर",
|
||||
"Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें",
|
||||
"Known Web Crawlers": "ज्ञात वेब क्रॉलर"
|
||||
"Known Web Crawlers": "ज्ञात वेब क्रॉलर",
|
||||
"Add to the calendar": "कैलेंडर में जोड़ें"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Lasciare",
|
||||
"System Monitor": "Monitor di sistema",
|
||||
"Add content warnings for the following sites": "Aggiungi avvisi sui contenuti per i seguenti siti",
|
||||
"Known Web Crawlers": "Crawler Web conosciuti"
|
||||
"Known Web Crawlers": "Crawler Web conosciuti",
|
||||
"Add to the calendar": "Aggiungi al calendario"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "離れる",
|
||||
"System Monitor": "システムモニター",
|
||||
"Add content warnings for the following sites": "次のサイトのコンテンツ警告を追加します",
|
||||
"Known Web Crawlers": "既知のWebクローラー"
|
||||
"Known Web Crawlers": "既知のWebクローラー",
|
||||
"Add to the calendar": "カレンダーに追加"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Terikandin",
|
||||
"System Monitor": "System Monitor",
|
||||
"Add content warnings for the following sites": "Ji bo malperên jêrîn hişyariyên naverokê zêde bikin",
|
||||
"Known Web Crawlers": "Crawlerên Webê yên naskirî"
|
||||
"Known Web Crawlers": "Crawlerên Webê yên naskirî",
|
||||
"Add to the calendar": "Di salnameyê de zêde bike"
|
||||
}
|
||||
|
|
|
@ -486,5 +486,6 @@
|
|||
"Leave": "Leave",
|
||||
"System Monitor": "System Monitor",
|
||||
"Add content warnings for the following sites": "Add content warnings for the following sites",
|
||||
"Known Web Crawlers": "Known Web Crawlers"
|
||||
"Known Web Crawlers": "Known Web Crawlers",
|
||||
"Add to the calendar": "Add to the calendar"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Sair",
|
||||
"System Monitor": "Monitor de Sistema",
|
||||
"Add content warnings for the following sites": "Adicione avisos de conteúdo para os seguintes sites",
|
||||
"Known Web Crawlers": "Rastreadores da Web conhecidos"
|
||||
"Known Web Crawlers": "Rastreadores da Web conhecidos",
|
||||
"Add to the calendar": "Adicionar ao calendário"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Оставлять",
|
||||
"System Monitor": "Системный монитор",
|
||||
"Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов",
|
||||
"Known Web Crawlers": "Известные веб-сканеры"
|
||||
"Known Web Crawlers": "Известные веб-сканеры",
|
||||
"Add to the calendar": "Добавить в календарь"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "Ondoka",
|
||||
"System Monitor": "Ufuatiliaji wa Mfumo",
|
||||
"Add content warnings for the following sites": "Ongeza maonyo ya yaliyomo kwa wavuti zifuatazo",
|
||||
"Known Web Crawlers": "Watambaji Wavuti Wanaojulikana"
|
||||
"Known Web Crawlers": "Watambaji Wavuti Wanaojulikana",
|
||||
"Add to the calendar": "Ongeza kwenye kalenda"
|
||||
}
|
||||
|
|
|
@ -490,5 +490,6 @@
|
|||
"Leave": "离开",
|
||||
"System Monitor": "系统监视器",
|
||||
"Add content warnings for the following sites": "为以下网站添加内容警告",
|
||||
"Known Web Crawlers": "已知的网络爬虫"
|
||||
"Known Web Crawlers": "已知的网络爬虫",
|
||||
"Add to the calendar": "添加到日历"
|
||||
}
|
||||
|
|
10
utils.py
10
utils.py
|
@ -3145,3 +3145,13 @@ def hasObjectString(postJsonObject: {}, debug: bool) -> bool:
|
|||
if debug:
|
||||
print('No object field within post ' + postJsonObject['id'])
|
||||
return False
|
||||
|
||||
|
||||
def getNewPostEndpoints() -> []:
|
||||
"""Returns a list of endpoints for new posts
|
||||
"""
|
||||
return (
|
||||
'newpost', 'newblog', 'newunlisted', 'newfollowers', 'newdm',
|
||||
'newreminder', 'newreport', 'newquestion', 'newshare', 'newwanted',
|
||||
'editblogpost'
|
||||
)
|
||||
|
|
|
@ -284,9 +284,10 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
|||
|
||||
setCustomBackground(baseDir, 'calendar-background', 'calendar-background')
|
||||
|
||||
months = ('January', 'February', 'March', 'April',
|
||||
'May', 'June', 'July', 'August', 'September',
|
||||
'October', 'November', 'December')
|
||||
months = (
|
||||
'January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December'
|
||||
)
|
||||
monthName = translate[months[monthNumber - 1]]
|
||||
|
||||
if dayNumber:
|
||||
|
@ -453,4 +454,12 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
|||
htmlKeyboardNavigation(textModeBanner, navLinks, navAccessKeys,
|
||||
monthName)
|
||||
|
||||
return headerStr + screenReaderCal + calendarStr + htmlFooter()
|
||||
newEventStr = \
|
||||
'<br><center>\n<p>\n' + \
|
||||
'<a href="' + calActor + '/newreminder">➕ ' + \
|
||||
translate['Add to the calendar'] + '</a>\n</p>\n</center>\n'
|
||||
|
||||
calStr = \
|
||||
headerStr + screenReaderCal + calendarStr + newEventStr + htmlFooter()
|
||||
|
||||
return calStr
|
||||
|
|
|
@ -8,6 +8,7 @@ __status__ = "Production"
|
|||
__module_group__ = "Web Interface"
|
||||
|
||||
import os
|
||||
from utils import getNewPostEndpoints
|
||||
from utils import isPublicPostFromUrl
|
||||
from utils import getNicknameFromActor
|
||||
from utils import getDomainFromActor
|
||||
|
@ -199,6 +200,24 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
"""
|
||||
replyStr = ''
|
||||
|
||||
isNewReminder = False
|
||||
if path.endswith('/newreminder'):
|
||||
isNewReminder = True
|
||||
|
||||
# the date and time
|
||||
dateAndTimeStr = \
|
||||
'<p><img loading="lazy" alt="" title="" ' + \
|
||||
'class="emojicalendar" src="/' + \
|
||||
'icons/calendar.png"/>\n'
|
||||
# select a date and time for this post
|
||||
dateAndTimeStr += '<label class="labels">' + \
|
||||
translate['Date'] + ': </label>\n'
|
||||
dateAndTimeStr += '<input type="date" name="eventDate">\n'
|
||||
dateAndTimeStr += '<label class="labelsright">' + \
|
||||
translate['Time'] + ': '
|
||||
dateAndTimeStr += \
|
||||
'<input type="time" name="eventTime"></label></p>\n'
|
||||
|
||||
showPublicOnDropdown = True
|
||||
messageBoxHeight = 400
|
||||
|
||||
|
@ -208,7 +227,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
|
||||
if not path.endswith('/newshare') and not path.endswith('/newwanted'):
|
||||
if not path.endswith('/newreport'):
|
||||
if not inReplyTo or path.endswith('/newreminder'):
|
||||
if not inReplyTo or isNewReminder:
|
||||
newPostText = '<h1>' + \
|
||||
translate['Write your post text below.'] + '</h1>\n'
|
||||
else:
|
||||
|
@ -289,13 +308,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
|
||||
if '?' in path:
|
||||
path = path.split('?')[0]
|
||||
pathBase = path.replace('/newreport', '').replace('/newpost', '')
|
||||
pathBase = pathBase.replace('/newblog', '').replace('/newshare', '')
|
||||
pathBase = pathBase.replace('/newunlisted', '').replace('/newwanted', '')
|
||||
pathBase = pathBase.replace('/newreminder', '')
|
||||
pathBase = pathBase.replace('/newfollowers', '').replace('/newdm', '')
|
||||
newPostEndpoints = getNewPostEndpoints()
|
||||
pathBase = path
|
||||
for currPostType in newPostEndpoints:
|
||||
pathBase = pathBase.replace('/' + currPostType, '')
|
||||
|
||||
newPostImageSection = ' <div class="container">'
|
||||
newPostImageSection = ' <div class="container">\n'
|
||||
newPostImageSection += \
|
||||
editTextField(translate['Image description'], 'imageDescription', '')
|
||||
|
||||
|
@ -351,7 +369,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
scopeIcon = 'scope_dm.png'
|
||||
scopeDescription = translate['DM']
|
||||
endpoint = 'newdm'
|
||||
elif path.endswith('/newreminder'):
|
||||
elif isNewReminder:
|
||||
scopeIcon = 'scope_reminder.png'
|
||||
scopeDescription = translate['Reminder']
|
||||
endpoint = 'newreminder'
|
||||
|
@ -540,43 +558,37 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
endpoint != 'newwanted' and \
|
||||
endpoint != 'newreport' and \
|
||||
endpoint != 'newquestion':
|
||||
dateAndLocation = \
|
||||
'<div class="container">\n'
|
||||
if category != 'accommodation':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="commentsEnabled" checked><label class="labels"> ' + \
|
||||
translate['Allow replies.'] + '</label></p>\n'
|
||||
else:
|
||||
dateAndLocation += \
|
||||
'<input type="hidden" name="commentsEnabled" value="true">\n'
|
||||
|
||||
if endpoint == 'newpost':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="pinToProfile"><label class="labels"> ' + \
|
||||
translate['Pin this post to your profile.'] + '</label></p>\n'
|
||||
if not isNewReminder:
|
||||
dateAndLocation = \
|
||||
'<div class="container">\n'
|
||||
if category != 'accommodation':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="commentsEnabled" ' + \
|
||||
'checked><label class="labels"> ' + \
|
||||
translate['Allow replies.'] + '</label></p>\n'
|
||||
else:
|
||||
dateAndLocation += \
|
||||
'<input type="hidden" name="commentsEnabled" ' + \
|
||||
'value="true">\n'
|
||||
|
||||
if not inReplyTo:
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="schedulePost"><label class="labels"> ' + \
|
||||
translate['This is a scheduled post.'] + '</label></p>\n'
|
||||
if endpoint == 'newpost':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="pinToProfile"><label class="labels"> ' + \
|
||||
translate['Pin this post to your profile.'] + \
|
||||
'</label></p>\n'
|
||||
|
||||
dateAndLocation += \
|
||||
'<p><img loading="lazy" alt="" title="" ' + \
|
||||
'class="emojicalendar" src="/' + \
|
||||
'icons/calendar.png"/>\n'
|
||||
# select a date and time for this post
|
||||
dateAndLocation += '<label class="labels">' + \
|
||||
translate['Date'] + ': </label>\n'
|
||||
dateAndLocation += '<input type="date" name="eventDate">\n'
|
||||
dateAndLocation += '<label class="labelsright">' + \
|
||||
translate['Time'] + ':'
|
||||
dateAndLocation += \
|
||||
'<input type="time" name="eventTime"></label></p>\n'
|
||||
if not inReplyTo:
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="schedulePost"><label class="labels"> ' + \
|
||||
translate['This is a scheduled post.'] + '</label></p>\n'
|
||||
|
||||
dateAndLocation += dateAndTimeStr
|
||||
dateAndLocation += '</div>\n'
|
||||
|
||||
dateAndLocation += '</div>\n'
|
||||
dateAndLocation += '<div class="container">\n'
|
||||
dateAndLocation += \
|
||||
editTextField(translate['Location'], 'location', '')
|
||||
|
@ -730,6 +742,13 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
|
||||
if not shareDescription:
|
||||
shareDescription = ''
|
||||
|
||||
# for reminders show the date and time at the top
|
||||
if isNewReminder:
|
||||
newPostForm += '<div class="container">\n'
|
||||
newPostForm += dateAndTimeStr
|
||||
newPostForm += '</div>\n'
|
||||
|
||||
newPostForm += \
|
||||
editTextField(placeholderSubject, 'subject', shareDescription)
|
||||
newPostForm += ''
|
||||
|
|
Loading…
Reference in New Issue