diff --git a/daemon.py b/daemon.py index 0f50cf71e..4a5f14d94 100644 --- a/daemon.py +++ b/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') diff --git a/epicyon-calendar.css b/epicyon-calendar.css index a1fb0f9be..ffed3df26 100644 --- a/epicyon-calendar.css +++ b/epicyon-calendar.css @@ -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); + } } diff --git a/epicyon-profile.css b/epicyon-profile.css index 192d648fd..5580786be 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -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); diff --git a/translations/ar.json b/translations/ar.json index 4b46432fb..f71b30e40 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -490,5 +490,6 @@ "Leave": "يترك", "System Monitor": "مراقب النظام", "Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية", - "Known Web Crawlers": "برامج زحف الويب المعروفة" + "Known Web Crawlers": "برامج زحف الويب المعروفة", + "Add to the calendar": "أضف إلى التقويم" } diff --git a/translations/ca.json b/translations/ca.json index 59fbdc8d1..07205607c 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -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" } diff --git a/translations/cy.json b/translations/cy.json index 79339634a..6a3715cb6 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -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" } diff --git a/translations/de.json b/translations/de.json index 9852d7703..da33ff00f 100644 --- a/translations/de.json +++ b/translations/de.json @@ -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" } diff --git a/translations/en.json b/translations/en.json index 1efb610ef..551749a49 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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" } diff --git a/translations/es.json b/translations/es.json index 0c88b4250..d89b835ec 100644 --- a/translations/es.json +++ b/translations/es.json @@ -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" } diff --git a/translations/fr.json b/translations/fr.json index 05f4284bd..73982bb9e 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -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" } diff --git a/translations/ga.json b/translations/ga.json index dc0e6f802..8af1069ed 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -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" } diff --git a/translations/hi.json b/translations/hi.json index bf52fae8b..e044eb261 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -490,5 +490,6 @@ "Leave": "छोड़ना", "System Monitor": "सिस्टम मॉनिटर", "Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें", - "Known Web Crawlers": "ज्ञात वेब क्रॉलर" + "Known Web Crawlers": "ज्ञात वेब क्रॉलर", + "Add to the calendar": "कैलेंडर में जोड़ें" } diff --git a/translations/it.json b/translations/it.json index 41341a01d..c847b5dc5 100644 --- a/translations/it.json +++ b/translations/it.json @@ -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" } diff --git a/translations/ja.json b/translations/ja.json index d96250ced..17f939fbe 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -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": "カレンダーに追加" } diff --git a/translations/ku.json b/translations/ku.json index 946d077be..36698735f 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -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" } diff --git a/translations/oc.json b/translations/oc.json index d8f72b430..dc898e1e4 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -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" } diff --git a/translations/pt.json b/translations/pt.json index b1056b4f4..936c7f095 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -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" } diff --git a/translations/ru.json b/translations/ru.json index eb71190d0..bb92161d9 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -490,5 +490,6 @@ "Leave": "Оставлять", "System Monitor": "Системный монитор", "Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов", - "Known Web Crawlers": "Известные веб-сканеры" + "Known Web Crawlers": "Известные веб-сканеры", + "Add to the calendar": "Добавить в календарь" } diff --git a/translations/sw.json b/translations/sw.json index a7e078946..aace5f87e 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -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" } diff --git a/translations/zh.json b/translations/zh.json index 3be4afa78..bde6635db 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -490,5 +490,6 @@ "Leave": "离开", "System Monitor": "系统监视器", "Add content warnings for the following sites": "为以下网站添加内容警告", - "Known Web Crawlers": "已知的网络爬虫" + "Known Web Crawlers": "已知的网络爬虫", + "Add to the calendar": "添加到日历" } diff --git a/utils.py b/utils.py index 5ec417ef2..e67a22a59 100644 --- a/utils.py +++ b/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' + ) diff --git a/webapp_calendar.py b/webapp_calendar.py index 161cd63b1..2fc19edfa 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -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 = \ + '
\n

\n' + \ + '➕ ' + \ + translate['Add to the calendar'] + '\n

\n
\n' + + calStr = \ + headerStr + screenReaderCal + calendarStr + newEventStr + htmlFooter() + + return calStr diff --git a/webapp_create_post.py b/webapp_create_post.py index 9128983ff..079f1d92c 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -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 = \ + '

\n' + # select a date and time for this post + dateAndTimeStr += '\n' + dateAndTimeStr += '\n' + dateAndTimeStr += '

\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 = '

' + \ translate['Write your post text below.'] + '

\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 = '
' + newPostImageSection = '
\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 = \ - '
\n' - if category != 'accommodation': - dateAndLocation += \ - '

\n' - else: - dateAndLocation += \ - '\n' - if endpoint == 'newpost': - dateAndLocation += \ - '

\n' + if not isNewReminder: + dateAndLocation = \ + '
\n' + if category != 'accommodation': + dateAndLocation += \ + '

\n' + else: + dateAndLocation += \ + '\n' - if not inReplyTo: - dateAndLocation += \ - '

\n' + if endpoint == 'newpost': + dateAndLocation += \ + '

\n' - dateAndLocation += \ - '

\n' - # select a date and time for this post - dateAndLocation += '\n' - dateAndLocation += '\n' - dateAndLocation += '

\n' + if not inReplyTo: + dateAndLocation += \ + '

\n' + + dateAndLocation += dateAndTimeStr + dateAndLocation += '
\n' - dateAndLocation += '
\n' dateAndLocation += '
\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 += '
\n' + newPostForm += dateAndTimeStr + newPostForm += '
\n' + newPostForm += \ editTextField(placeholderSubject, 'subject', shareDescription) newPostForm += ''