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