diff --git a/daemon.py b/daemon.py index c0e3ba0e4..2c4b1446c 100644 --- a/daemon.py +++ b/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, \ diff --git a/img/icons/hacker/scope_blog.png b/img/icons/hacker/scope_blog.png new file mode 100644 index 000000000..b605e6786 Binary files /dev/null and b/img/icons/hacker/scope_blog.png differ diff --git a/img/icons/light/scope_blog.png b/img/icons/light/scope_blog.png new file mode 100644 index 000000000..59713257c Binary files /dev/null and b/img/icons/light/scope_blog.png differ diff --git a/img/icons/purple/scope_blog.png b/img/icons/purple/scope_blog.png new file mode 100644 index 000000000..1332dca9a Binary files /dev/null and b/img/icons/purple/scope_blog.png differ diff --git a/img/icons/scope_blog.png b/img/icons/scope_blog.png new file mode 100644 index 000000000..281fb795f Binary files /dev/null and b/img/icons/scope_blog.png differ diff --git a/posts.py b/posts.py index 6d9593ea9..d21d8e793 100644 --- a/posts.py +++ b/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, diff --git a/translations/ar.json b/translations/ar.json index dd708795b..bfecd81a2 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -212,5 +212,7 @@ "Sensitive": "حساس", "Word Replacements": "استبدال الكلمات", "Happening Today": "يحدث اليوم", - "Happening This Week": "يحدث هذا الاسبوع" + "Happening This Week": "يحدث هذا الاسبوع", + "Blog": "مدونة", + "Blogs": "المدونات" } diff --git a/translations/ca.json b/translations/ca.json index 7783bb47f..5dd7fac2a 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -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" } diff --git a/translations/cy.json b/translations/cy.json index 3a4df53b9..639982420 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -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" } diff --git a/translations/de.json b/translations/de.json index ae7ad88a0..59874d9d9 100644 --- a/translations/de.json +++ b/translations/de.json @@ -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" } diff --git a/translations/en.json b/translations/en.json index aa844d4c9..1ada455a5 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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" } diff --git a/translations/es.json b/translations/es.json index 3b2c235ca..ba5ffbc9c 100644 --- a/translations/es.json +++ b/translations/es.json @@ -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" } diff --git a/translations/fr.json b/translations/fr.json index 4816a0e0d..a3f60d14d 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -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" } diff --git a/translations/ga.json b/translations/ga.json index af41aa597..e5218602e 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -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" } diff --git a/translations/hi.json b/translations/hi.json index 442391159..035d10196 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -212,5 +212,7 @@ "Sensitive": "संवेदनशील", "Word Replacements": "शब्द प्रतिस्थापन", "Happening Today": "आज हो रहा है", - "Happening This Week": "इस सप्ताह हो रहा है" + "Happening This Week": "इस सप्ताह हो रहा है", + "Blog": "ब्लॉग", + "Blogs": "ब्लॉग" } diff --git a/translations/it.json b/translations/it.json index 6ca07a796..9ebe3bca2 100644 --- a/translations/it.json +++ b/translations/it.json @@ -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" } diff --git a/translations/ja.json b/translations/ja.json index 3cdea16cf..b3b43d1f4 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -212,5 +212,7 @@ "Sensitive": "敏感", "Word Replacements": "単語の置換", "Happening Today": "今日の出来事", - "Happening This Week": "今週の出来事" + "Happening This Week": "今週の出来事", + "Blog": "ブログ", + "Blogs": "ブログ" } diff --git a/translations/oc.json b/translations/oc.json index d0435fe07..4fce685d1 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -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" } diff --git a/translations/pt.json b/translations/pt.json index a4c0d38d8..d488d9301 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -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" } diff --git a/translations/ru.json b/translations/ru.json index 61f36518d..0413e0c1e 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -212,5 +212,7 @@ "Sensitive": "чувствительный", "Word Replacements": "Замены слов", "Happening Today": "Происходит сегодня", - "Happening This Week": "Происходит на этой неделе" + "Happening This Week": "Происходит на этой неделе", + "Blog": "Блог", + "Blogs": "Блоги" } diff --git a/translations/zh.json b/translations/zh.json index c75f94038..6aa79e616 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -212,5 +212,7 @@ "Sensitive": "敏感", "Word Replacements": "单词替换", "Happening Today": "今天发生", - "Happening This Week": "本周发生" + "Happening This Week": "本周发生", + "Blog": "博客", + "Blogs": "网志" } diff --git a/webinterface.py b/webinterface.py index 3db1a4224..ad033c302 100644 --- a/webinterface.py +++ b/webinterface.py @@ -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 ='
' newPostImageSection+=' ' @@ -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: {}, \ '
' extraFields+='
' - 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"/>'+ \ translate['Public']+'
'+ \ translate['Visible to anyone']+'' + dropDownContent+= \ + ' '+ \ + translate['Blog']+'
'+ \ + translate['Visible to anyone']+'
' dropDownContent+= \ '