mirror of https://gitlab.com/bashrc2/epicyon
Blog post type
parent
052023c7c0
commit
756119d904
29
daemon.py
29
daemon.py
|
@ -60,6 +60,7 @@ from posts import sendToFollowersThread
|
|||
from posts import postIsAddressedToPublic
|
||||
from posts import sendToNamedAddresses
|
||||
from posts import createPublicPost
|
||||
from posts import createBlogPost
|
||||
from posts import createReportPost
|
||||
from posts import createUnlistedPost
|
||||
from posts import createFollowersOnlyPost
|
||||
|
@ -2221,6 +2222,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# Various types of new post in the web interface
|
||||
if '/users/' in self.path and \
|
||||
(self.path.endswith('/newpost') or \
|
||||
self.path.endswith('/newblog') or \
|
||||
self.path.endswith('/newunlisted') or \
|
||||
self.path.endswith('/newfollowers') or \
|
||||
self.path.endswith('/newdm') or \
|
||||
|
@ -3616,6 +3618,33 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
return 1
|
||||
else:
|
||||
return -1
|
||||
elif postType=='newblog':
|
||||
messageJson= \
|
||||
createBlogPost(self.server.baseDir, \
|
||||
nickname, \
|
||||
self.server.domain,self.server.port, \
|
||||
self.server.httpPrefix, \
|
||||
fields['message'],False,False,False, \
|
||||
filename,attachmentMediaType, \
|
||||
fields['imageDescription'], \
|
||||
self.server.useBlurHash, \
|
||||
fields['replyTo'],fields['replyTo'], \
|
||||
fields['subject'],fields['schedulePost'], \
|
||||
fields['eventDate'],fields['eventTime'], \
|
||||
fields['location'])
|
||||
if messageJson:
|
||||
if fields['schedulePost']:
|
||||
return 1
|
||||
if self._postToOutbox(messageJson,__version__,nickname):
|
||||
populateReplies(self.server.baseDir, \
|
||||
self.server.httpPrefix, \
|
||||
self.server.domainFull, \
|
||||
messageJson, \
|
||||
self.server.maxReplies, \
|
||||
self.server.debug)
|
||||
return 1
|
||||
else:
|
||||
return -1
|
||||
elif postType=='newunlisted':
|
||||
messageJson= \
|
||||
createUnlistedPost(self.server.baseDir, \
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
24
posts.py
24
posts.py
|
@ -892,6 +892,29 @@ def createPublicPost(baseDir: str, \
|
|||
False,inReplyTo,inReplyToAtomUri,subject, \
|
||||
schedulePost,eventDate,eventTime,location)
|
||||
|
||||
def createBlogPost(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, \
|
||||
schedulePost=False, \
|
||||
eventDate=None,eventTime=None,location=None) -> {}:
|
||||
blog= \
|
||||
createPublicPost(baseDir, \
|
||||
nickname,domain,port,httpPrefix, \
|
||||
content,followersOnly,saveToFile,
|
||||
clientToServer,\
|
||||
attachImageFilename,mediaType, \
|
||||
imageDescription,useBlurhash, \
|
||||
inReplyTo,inReplyToAtomUri,subject, \
|
||||
schedulePost, \
|
||||
eventDate,eventTime,location)
|
||||
blog['object']['type']='Article'
|
||||
return blog
|
||||
|
||||
|
||||
def createQuestionPost(baseDir: str,
|
||||
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||
content: str,qOptions: [], \
|
||||
|
@ -935,6 +958,7 @@ def createQuestionPost(baseDir: str,
|
|||
})
|
||||
return messageJson
|
||||
|
||||
|
||||
def createUnlistedPost(baseDir: str,
|
||||
nickname: str,domain: str,port: int,httpPrefix: str, \
|
||||
content: str,followersOnly: bool,saveToFile: bool,
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "حساس",
|
||||
"Word Replacements": "استبدال الكلمات",
|
||||
"Happening Today": "يحدث اليوم",
|
||||
"Happening This Week": "يحدث هذا الاسبوع"
|
||||
"Happening This Week": "يحدث هذا الاسبوع",
|
||||
"Blog": "مدونة",
|
||||
"Blogs": "المدونات"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensible",
|
||||
"Word Replacements": "Substitucions de paraula",
|
||||
"Happening Today": "Passant avui",
|
||||
"Happening This Week": "Passa aquesta setmana"
|
||||
"Happening This Week": "Passa aquesta setmana",
|
||||
"Blog": "Bloc",
|
||||
"Blogs": "Blocs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensitif",
|
||||
"Word Replacements": "Amnewidiadau Geiriau",
|
||||
"Happening Today": "Digwydd Heddiw",
|
||||
"Happening This Week": "Yn Digwydd Yr Wythnos Hon"
|
||||
"Happening This Week": "Yn Digwydd Yr Wythnos Hon",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Empfindlich",
|
||||
"Word Replacements": "Wortersetzungen",
|
||||
"Happening Today": "Heute passiert",
|
||||
"Happening This Week": "Diese Woche passiert"
|
||||
"Happening This Week": "Diese Woche passiert",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensitive",
|
||||
"Word Replacements": "Word Replacements",
|
||||
"Happening Today": "Happening Today",
|
||||
"Happening This Week": "Happening This Week"
|
||||
"Happening This Week": "Happening This Week",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensible",
|
||||
"Word Replacements": "Reemplazos de palabras",
|
||||
"Happening Today": "Sucediendo hoy",
|
||||
"Happening This Week": "Sucediendo esta semana"
|
||||
"Happening This Week": "Sucediendo esta semana",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensible",
|
||||
"Word Replacements": "Remplacements de mots",
|
||||
"Happening Today": "Se passe aujourd'hui",
|
||||
"Happening This Week": "Se passe cette semaine"
|
||||
"Happening This Week": "Se passe cette semaine",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Íogair",
|
||||
"Word Replacements": "Athchur Focal",
|
||||
"Happening Today": "Ag tarlú inniu",
|
||||
"Happening This Week": "Ag tarlú an tseachtain seo"
|
||||
"Happening This Week": "Ag tarlú an tseachtain seo",
|
||||
"Blog": "Blag",
|
||||
"Blogs": "Blaganna"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "संवेदनशील",
|
||||
"Word Replacements": "शब्द प्रतिस्थापन",
|
||||
"Happening Today": "आज हो रहा है",
|
||||
"Happening This Week": "इस सप्ताह हो रहा है"
|
||||
"Happening This Week": "इस सप्ताह हो रहा है",
|
||||
"Blog": "ब्लॉग",
|
||||
"Blogs": "ब्लॉग"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensibile",
|
||||
"Word Replacements": "Sostituzioni di parole",
|
||||
"Happening Today": "Succede oggi",
|
||||
"Happening This Week": "Succede questa settimana"
|
||||
"Happening This Week": "Succede questa settimana",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blog"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "敏感",
|
||||
"Word Replacements": "単語の置換",
|
||||
"Happening Today": "今日の出来事",
|
||||
"Happening This Week": "今週の出来事"
|
||||
"Happening This Week": "今週の出来事",
|
||||
"Blog": "ブログ",
|
||||
"Blogs": "ブログ"
|
||||
}
|
||||
|
|
|
@ -208,5 +208,7 @@
|
|||
"Sensitive": "Sensitive",
|
||||
"Word Replacements": "Word Replacements",
|
||||
"Happening Today": "Happening Today",
|
||||
"Happening This Week": "Happening This Week"
|
||||
"Happening This Week": "Happening This Week",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "Sensível",
|
||||
"Word Replacements": "Substituições do Word",
|
||||
"Happening Today": "Acontecendo hoje",
|
||||
"Happening This Week": "Acontecendo Esta Semana"
|
||||
"Happening This Week": "Acontecendo Esta Semana",
|
||||
"Blog": "Blog",
|
||||
"Blogs": "Blogs"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "чувствительный",
|
||||
"Word Replacements": "Замены слов",
|
||||
"Happening Today": "Происходит сегодня",
|
||||
"Happening This Week": "Происходит на этой неделе"
|
||||
"Happening This Week": "Происходит на этой неделе",
|
||||
"Blog": "Блог",
|
||||
"Blogs": "Блоги"
|
||||
}
|
||||
|
|
|
@ -212,5 +212,7 @@
|
|||
"Sensitive": "敏感",
|
||||
"Word Replacements": "单词替换",
|
||||
"Happening Today": "今天发生",
|
||||
"Happening This Week": "本周发生"
|
||||
"Happening This Week": "本周发生",
|
||||
"Blog": "博客",
|
||||
"Blogs": "网志"
|
||||
}
|
||||
|
|
|
@ -1233,7 +1233,7 @@ def htmlNewPost(mediaInstance: bool,translate: {}, \
|
|||
if '?' in path:
|
||||
path=path.split('?')[0]
|
||||
pathBase= \
|
||||
path.replace('/newreport','').replace('/newpost','').replace('/newshare','').replace('/newunlisted','').replace('/newfollowers','').replace('/newdm','')
|
||||
path.replace('/newreport','').replace('/newpost','').replace('/newblog','').replace('/newshare','').replace('/newunlisted','').replace('/newfollowers','').replace('/newdm','')
|
||||
|
||||
newPostImageSection =' <div class="container">'
|
||||
newPostImageSection+=' <label class="labels">'+translate['Image description']+'</label>'
|
||||
|
@ -1248,23 +1248,27 @@ def htmlNewPost(mediaInstance: bool,translate: {}, \
|
|||
placeholderMessage=translate['Write something']+'...'
|
||||
extraFields=''
|
||||
endpoint='newpost'
|
||||
if path.endswith('/newunlisted'):
|
||||
if path.endswith('/newblog'):
|
||||
scopeIcon='scope_blog.png'
|
||||
scopeDescription=translate['Blog']
|
||||
endpoint='newblog'
|
||||
elif path.endswith('/newunlisted'):
|
||||
scopeIcon='scope_unlisted.png'
|
||||
scopeDescription=translate['Unlisted']
|
||||
endpoint='newunlisted'
|
||||
if path.endswith('/newfollowers'):
|
||||
elif path.endswith('/newfollowers'):
|
||||
scopeIcon='scope_followers.png'
|
||||
scopeDescription=translate['Followers']
|
||||
endpoint='newfollowers'
|
||||
if path.endswith('/newdm'):
|
||||
elif path.endswith('/newdm'):
|
||||
scopeIcon='scope_dm.png'
|
||||
scopeDescription=translate['DM']
|
||||
endpoint='newdm'
|
||||
if path.endswith('/newreport'):
|
||||
elif path.endswith('/newreport'):
|
||||
scopeIcon='scope_report.png'
|
||||
scopeDescription=translate['Report']
|
||||
endpoint='newreport'
|
||||
if path.endswith('/newquestion'):
|
||||
elif path.endswith('/newquestion'):
|
||||
scopeIcon='scope_question.png'
|
||||
scopeDescription=translate['Question']
|
||||
placeholderMessage=translate['Enter your question']+'...'
|
||||
|
@ -1279,7 +1283,7 @@ def htmlNewPost(mediaInstance: bool,translate: {}, \
|
|||
' <label class="labels">'+translate['Duration of listing in days']+ \
|
||||
':</label> <input type="number" name="duration" min="1" max="365" step="1" value="14"><br>'
|
||||
extraFields+='</div>'
|
||||
if path.endswith('/newshare'):
|
||||
elif path.endswith('/newshare'):
|
||||
scopeIcon='scope_share.png'
|
||||
scopeDescription=translate['Shared Item']
|
||||
placeholderSubject=translate['Name of the shared item']+'...'
|
||||
|
@ -1364,23 +1368,27 @@ def htmlNewPost(mediaInstance: bool,translate: {}, \
|
|||
# build suffixes so that any replies or mentions are
|
||||
# preserved when switching between scopes
|
||||
dropdownNewPostSuffix='/newpost'
|
||||
dropdownNewBlogSuffix='/newblog'
|
||||
dropdownUnlistedSuffix='/newunlisted'
|
||||
dropdownFollowersSuffix='/newfollowers'
|
||||
dropdownDMSuffix='/newdm'
|
||||
dropdownReportSuffix='/newreport'
|
||||
if inReplyTo or mentions:
|
||||
dropdownNewPostSuffix=''
|
||||
dropdownNewBlogSuffix=''
|
||||
dropdownUnlistedSuffix=''
|
||||
dropdownFollowersSuffix=''
|
||||
dropdownDMSuffix=''
|
||||
dropdownReportSuffix=''
|
||||
if inReplyTo:
|
||||
dropdownNewPostSuffix+='?replyto='+inReplyTo
|
||||
dropdownNewBlogSuffix+='?replyto='+inReplyTo
|
||||
dropdownUnlistedSuffix+='?replyto='+inReplyTo
|
||||
dropdownFollowersSuffix+='?replyfollowers='+inReplyTo
|
||||
dropdownDMSuffix+='?replydm='+inReplyTo
|
||||
for mentionedActor in mentions:
|
||||
dropdownNewPostSuffix+='?mention='+mentionedActor
|
||||
dropdownNewBlogSuffix+='?mention='+mentionedActor
|
||||
dropdownUnlistedSuffix+='?mention='+mentionedActor
|
||||
dropdownFollowersSuffix+='?mention='+mentionedActor
|
||||
dropdownDMSuffix+='?mention='+mentionedActor
|
||||
|
@ -1396,6 +1404,12 @@ def htmlNewPost(mediaInstance: bool,translate: {}, \
|
|||
iconsDir+'/scope_public.png"/><b>'+ \
|
||||
translate['Public']+'</b><br>'+ \
|
||||
translate['Visible to anyone']+'</a>'
|
||||
dropDownContent+= \
|
||||
' <a href="'+pathBase+dropdownNewBlogSuffix+ \
|
||||
'"><img loading="lazy" alt="" title="" src="/'+ \
|
||||
iconsDir+'/scope_blog.png"/><b>'+ \
|
||||
translate['Blog']+'</b><br>'+ \
|
||||
translate['Visible to anyone']+'</a>'
|
||||
dropDownContent+= \
|
||||
' <a href="'+pathBase+dropdownUnlistedSuffix+ \
|
||||
'"><img loading="lazy" alt="" title="" src="/'+ \
|
||||
|
|
Loading…
Reference in New Issue