diff --git a/daemon.py b/daemon.py index 436423b7..8fdc74cb 100644 --- a/daemon.py +++ b/daemon.py @@ -127,6 +127,7 @@ from webinterface import htmlProfileAfterSearch from webinterface import htmlEditProfile from webinterface import htmlTermsOfService from webinterface import htmlSkillsSearch +from webinterface import htmlHistorySearch from webinterface import htmlHashtagSearch from webinterface import htmlModerationInfo from webinterface import htmlSearchSharedItems @@ -5968,6 +5969,33 @@ class PubServer(BaseHTTPRequestHandler): self._write(msg) self.server.POSTbusy = False return + elif searchStr.startswith('!'): + # your post history search + nickname = getNicknameFromActor(actorStr) + searchStr = searchStr.replace('!', '').strip() + historyStr = \ + htmlHistorySearch(self.server.translate, + self.server.baseDir, + self.server.httpPrefix, + nickname, + self.server.domain, + searchStr, + maxPostsInFeed, + pageNumber, + self.server.projectVersion, + self.server.recentPostsCache, + self.server.maxRecentPosts, + self.server.session, + self.server.cachedWebfingers, + self.server.personCache, + self.server.port) + if historyStr: + msg = historyStr.encode('utf-8') + self._login_headers('text/html', + len(msg), callingDomain) + self._write(msg) + self.server.POSTbusy = False + return elif '@' in searchStr: # profile search nickname = getNicknameFromActor(actorStr) diff --git a/translations/ar.json b/translations/ar.json index 008c5b8c..f275389c 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -90,7 +90,7 @@ "View": "رأي", "Stop blocking": "وقف الحظر", "Enter an emoji name to search for": "أدخل اسم رمز تعبيري للبحث عنه", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "أدخل عنوانًا أو عنصرًا مشتركًا أو #hashtag أو * skill أو: emoji: للبحث عنه", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "أدخل عنوانًا أو عنصرًا مشتركًا أو! history أو #hashtag أو * مهارة أو: emoji: للبحث عنه", "Go Back": "عد", "Moderation Information": "معلومات الاعتدال", "Suspended accounts": "الحسابات المعلقه", @@ -218,5 +218,6 @@ "Title": "عنوان", "About the author": "عن المؤلف", "Edit blog post": "تحرير بلوق وظيفة", - "Publicly visible post": "مشاركة مرئية بشكل عام" + "Publicly visible post": "مشاركة مرئية بشكل عام", + "Your Posts": "منشوراتك" } diff --git a/translations/ca.json b/translations/ca.json index 7a539244..4bbc2af2 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -90,7 +90,7 @@ "View": "Veure", "Stop blocking": "Deixeu de bloquejar", "Enter an emoji name to search for": "Introduïu un nom emoji per cercar", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Introduïu una adreça, un element compartit, #hashtag, *skill o: emoji: per cercar", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Introduïu una adreça, un element compartit, un historial!, #Hashtag, * skill o: emoji: per cercar", "Go Back": "Torna", "Moderation Information": "Informació de moderació", "Suspended accounts": "Comptes suspesos", @@ -218,5 +218,6 @@ "Title": "Títol", "About the author": "Sobre l’autor", "Edit blog post": "Edita la publicació del bloc", - "Publicly visible post": "Publicació visible públicament" + "Publicly visible post": "Publicació visible públicament", + "Your Posts": "Les teves publicacions" } diff --git a/translations/cy.json b/translations/cy.json index 82cef374..2fd7499d 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -90,7 +90,7 @@ "View": "Gweld", "Stop blocking": "Stopiwch rwystro", "Enter an emoji name to search for": "Rhowch enw emoji i chwilio amdano", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Rhowch gyfeiriad, eitem a rennir, #hashtag, * sgil neu: emoji: i chwilio amdano", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Rhowch gyfeiriad, eitem a rennir ,! Hanes, #hashtag, * sgil neu: emoji: i chwilio amdano", "Go Back": "Go Back", "Moderation Information": "Gwybodaeth Cymedroli", "Suspended accounts": "Cyfrifon gohiriedig", @@ -218,5 +218,6 @@ "Title": "Teitl", "About the author": "Am yr awdur", "Edit blog post": "Golygu post blog", - "Publicly visible post": "Post sy'n weladwy i'r cyhoedd" + "Publicly visible post": "Post sy'n weladwy i'r cyhoedd", + "Your Posts": "Eich Swyddi" } diff --git a/translations/de.json b/translations/de.json index bd5d0223..50b5fe19 100644 --- a/translations/de.json +++ b/translations/de.json @@ -90,7 +90,7 @@ "View": "Zeigen", "Stop blocking": "Sperre aufheben", "Enter an emoji name to search for": "Geben Sie einen Emojinamen ein, nach dem gesucht werden soll", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Geben Sie eine Adresse, eine freigegebene Sache, einen #hashtag, eine *Fertigkeit oder ein :Emoji: ein, nach dem gesucht werden soll", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Geben Sie eine Adresse, ein freigegebenes Element ,! History, #hashtag, * Skill oder: emoji: ein, nach der gesucht werden soll", "Go Back": "Zurück", "Moderation Information": "Moderationsinformationen", "Suspended accounts": "Temporäre gesperrte Benutzer", @@ -218,5 +218,6 @@ "Title": "Titel", "About the author": "Über den Autor", "Edit blog post": "Blog-Beitrag bearbeiten", - "Publicly visible post": "Öffentlich sichtbarer Beitrag" + "Publicly visible post": "Öffentlich sichtbarer Beitrag", + "Your Posts": "Deine Posts" } diff --git a/translations/en.json b/translations/en.json index bfe76f07..8cdaf7b1 100644 --- a/translations/en.json +++ b/translations/en.json @@ -90,7 +90,7 @@ "View": "View", "Stop blocking": "Stop blocking", "Enter an emoji name to search for": "Enter an emoji name to search for", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Enter an address, shared item, #hashtag, *skill or :emoji: to search for", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for", "Go Back": "Go Back", "Moderation Information": "Moderation Information", "Suspended accounts": "Suspended accounts", @@ -218,5 +218,6 @@ "Title": "Title", "About the author": "About the author", "Edit blog post": "Edit blog post", - "Publicly visible post": "Publicly visible post" + "Publicly visible post": "Publicly visible post", + "Your Posts": "Your Posts" } diff --git a/translations/es.json b/translations/es.json index 8b3afb5d..d90e466b 100644 --- a/translations/es.json +++ b/translations/es.json @@ -90,7 +90,7 @@ "View": "Ver", "Stop blocking": "Dejar de bloquear", "Enter an emoji name to search for": "Ingrese un nombre de emoji para buscar", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Ingrese una dirección, elemento compartido, #hashtag, * skill o: emoji: para buscar", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Ingrese una dirección, elemento compartido,! Historial, #hashtag, * skill o: emoji: para buscar", "Go Back": "Regresa", "Moderation Information": "Información de moderación", "Suspended accounts": "Cuentas suspendidas", @@ -218,5 +218,6 @@ "Title": "Título", "About the author": "Sobre la autora", "Edit blog post": "Editar publicación de blog", - "Publicly visible post": "Publicación públicamente visible" + "Publicly visible post": "Publicación públicamente visible", + "Your Posts": "Tus publicaciones" } diff --git a/translations/fr.json b/translations/fr.json index e39a4069..b3a143bf 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -90,7 +90,7 @@ "View": "Vue", "Stop blocking": "Arrêtez le blocage", "Enter an emoji name to search for": "Entrez un nom emoji à rechercher", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Entrez une adresse, un objet partagé, #hashtag, * skill ou: emoji: à rechercher", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Entrez une adresse, un élément partagé,! History, #hashtag, * skill ou: emoji: pour rechercher", "Go Back": "Retourner", "Moderation Information": "Informations de modération", "Suspended accounts": "Comptes suspendus", @@ -218,5 +218,6 @@ "Title": "Titre", "About the author": "A propos de l'auteur", "Edit blog post": "Modifier le billet de blog", - "Publicly visible post": "Message publiquement visible" + "Publicly visible post": "Message publiquement visible", + "Your Posts": "Vos publications" } diff --git a/translations/ga.json b/translations/ga.json index 6a6d1500..9f2c40d3 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -90,7 +90,7 @@ "View": "Amharc", "Stop blocking": "Stop blocáil", "Enter an emoji name to search for": "Cuir isteach ainm emoji chun cuardach a dhéanamh", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Cuir isteach seoladh, mír roinnte, #hashtag, * scil nó: emoji: chun cuardach a dhéanamh", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Iontráil seoladh, mír roinnte ,! Stair, #hashtag, * scil nó: emoji: chun cuardach a dhéanamh", "Go Back": "Dul ar ais", "Moderation Information": "Faisnéis Modhnóireachta", "Suspended accounts": "Cuntais ar fionraí", @@ -218,5 +218,6 @@ "Title": "Teideal", "About the author": "Faoin tÚdar", "Edit blog post": "Cuir post an bhlag in eagar", - "Publicly visible post": "Post atá infheicthe go poiblí" + "Publicly visible post": "Post atá infheicthe go poiblí", + "Your Posts": "Do Phoist" } diff --git a/translations/hi.json b/translations/hi.json index f2e6d2a6..472a1ac8 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -90,7 +90,7 @@ "View": "राय", "Stop blocking": "रोकना बंद करो", "Enter an emoji name to search for": "खोजने के लिए एक इमोजी नाम दर्ज करें", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "साझा करने के लिए एक पता, साझा आइटम, #hshtag, *कौशल या: इमोजी: दर्ज करें", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "एक पता, साझा किया गया आइटम दर्ज करें; इतिहास, # अंश, * कौशल या: इमोजी: खोजने के लिए", "Go Back": "वापस जाओ", "Moderation Information": "मॉडरेशन जानकारी", "Suspended accounts": "निलंबित खाते", @@ -218,5 +218,6 @@ "Title": "शीर्षक", "About the author": "लेखक के बारे में", "Edit blog post": "ब्लॉग पोस्ट संपादित करें", - "Publicly visible post": "सार्वजनिक रूप से दिखाई देने वाली पोस्ट" + "Publicly visible post": "सार्वजनिक रूप से दिखाई देने वाली पोस्ट", + "Your Posts": "आपके पोस्ट" } diff --git a/translations/it.json b/translations/it.json index 4e0b759a..fb61019c 100644 --- a/translations/it.json +++ b/translations/it.json @@ -90,7 +90,7 @@ "View": "Vista", "Stop blocking": "Smetti di bloccare", "Enter an emoji name to search for": "Inserisci un nome emoji da cercare", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Inserisci un indirizzo, un oggetto condiviso, #hashtag, * abilità o: emoji: per cercare", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Inserisci un indirizzo, un oggetto condiviso,! Storia, #hashtag, * abilità o: emoji: per cercare", "Go Back": "Torna indietro", "Moderation Information": "Informazioni sulla moderazione", "Suspended accounts": "Conti sospesi", @@ -218,5 +218,6 @@ "Title": "Titolo", "About the author": "Circa l'autore", "Edit blog post": "Modifica post del blog", - "Publicly visible post": "Post pubblicamente visibile" + "Publicly visible post": "Post pubblicamente visibile", + "Your Posts": "I tuoi post" } diff --git a/translations/ja.json b/translations/ja.json index a317e0b3..67f185e6 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -90,7 +90,7 @@ "View": "見る", "Stop blocking": "ブロックを停止", "Enter an emoji name to search for": "検索する絵文字名を入力してください", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "検索するアドレス、共有アイテム、#hashtag、* skillまたは:emoji:を入力します", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "検索するアドレス、共有アイテム、!history、#ハッシュタグ、* skillまたは:emoji:を入力してください", "Go Back": "戻る", "Moderation Information": "モデレーション情報", "Suspended accounts": "一時停止されたアカウント", @@ -218,5 +218,6 @@ "Title": "題名", "About the author": "著者について", "Edit blog post": "ブログ投稿を編集", - "Publicly visible post": "一般公開の投稿" + "Publicly visible post": "一般公開の投稿", + "Your Posts": "あなたの投稿" } diff --git a/translations/oc.json b/translations/oc.json index e621c9f4..233774f1 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -5,7 +5,7 @@ "These are currently suspended": "Son actualament suspenduts", "Suspended accounts": "Comptes suspenduts", "Moderation Information": "Informacions de moderacion", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Picatz una adreça, un element partejat, una #etiqueta, *abilitat o :emoji: a cercar", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Picatz una adreça, un element partejat, una #etiqueta, *abilitat o :emoji: a cercar", "Enter an emoji name to search for": "Picatz lo nom d’un emoji per lo cercar", "Information about current blocks/suspensions": "Informacion suls blocatges/suspensions en cors", "Remove a suspension for an account nickname": "Levar la suspension d’un compte", @@ -214,5 +214,6 @@ "Title": "Title", "About the author": "About the author", "Edit blog post": "Edit blog post", - "Publicly visible post": "Publicly visible post" + "Publicly visible post": "Publicly visible post", + "Your Posts": "Your Posts" } diff --git a/translations/pt.json b/translations/pt.json index fdaac57f..5833bf92 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -90,7 +90,7 @@ "View": "Visão", "Stop blocking": "Pare de bloquear", "Enter an emoji name to search for": "Digite um nome emoji para procurar", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Digite um endereço, item compartilhado, #hashtag, * skill ou: emoji: para procurar", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Digite um endereço, item compartilhado,! History, #hashtag, * skill ou: emoji: para procurar", "Go Back": "Volte", "Moderation Information": "Informações sobre moderação", "Suspended accounts": "Contas suspensas", @@ -218,5 +218,6 @@ "Title": "Título", "About the author": "Sobre o autor", "Edit blog post": "Editar postagem do blog", - "Publicly visible post": "Postagem publicamente visível" + "Publicly visible post": "Postagem publicamente visível", + "Your Posts": "Seus posts" } diff --git a/translations/ru.json b/translations/ru.json index b356eb3d..f4a9fa59 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -90,7 +90,7 @@ "View": "Посмотреть", "Stop blocking": "Прекратить блокировку", "Enter an emoji name to search for": "Введите имя смайлика для поиска", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "Введите адрес, общий элемент, #hashtag, *skill или: emoji: для поиска", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "Введите адрес, общий элемент,! History, #hashtag, * skill или: emoji: для поиска", "Go Back": "Вернитесь назад", "Moderation Information": "Модерация Информация", "Suspended accounts": "Приостановленные аккаунты", @@ -218,5 +218,6 @@ "Title": "заглавие", "About the author": "Об авторе", "Edit blog post": "Редактировать сообщение в блоге", - "Publicly visible post": "Публично видимый пост" + "Publicly visible post": "Публично видимый пост", + "Your Posts": "Ваши сообщения" } diff --git a/translations/zh.json b/translations/zh.json index 34d2345d..f1eb8f1b 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -90,8 +90,7 @@ "View": "视图", "Stop blocking": "停止封锁", "Enter an emoji name to search for": "输入表情符号名称以进行搜索", - "Enter an address, shared item, #hashtag, *skill or :emoji: to search for": "输入地址,共享项,#标签,*技能或:emoji:搜索", - "Go Back": "回去", + "Enter an address, shared item, !history, #hashtag, *skill or :emoji: to search for": "输入地址,共享项,!历史,##标签,*技能或:emoji:进行搜索", "Moderation Information": "审核信息", "Suspended accounts": "暂停的帐户", "These are currently suspended": "这些目前已暂停", @@ -218,5 +217,6 @@ "Title": "标题", "About the author": "关于作者", "Edit blog post": "编辑博客文章", - "Publicly visible post": "公开可见的帖子" + "Publicly visible post": "公开可见的帖子", + "Your Posts": "您的帖子" } diff --git a/webinterface.py b/webinterface.py index 95ce0389..d0c3bce9 100644 --- a/webinterface.py +++ b/webinterface.py @@ -23,6 +23,7 @@ from ssb import getSSBAddress from tox import getToxAddress from matrix import getMatrixAddress from donate import getDonationUrl +from utils import searchBoxPosts from utils import isBlogPost from utils import updateRecentPostsCache from utils import getNicknameFromActor @@ -737,6 +738,96 @@ def htmlSkillsSearch(translate: {}, baseDir: str, return skillSearchForm +def htmlHistorySearch(translate: {}, baseDir: str, + httpPrefix: str, + nickname: str, domain: str, + historysearch: str, + postsPerPage: int, pageNumber: int, + projectVersion: str, + recentPostsCache: {}, + maxRecentPosts: int, + session, + wfRequest, + personCache: {}, + port: int) -> str: + """Show a page containing search results for your post history + """ + if historysearch.startswith('!'): + historysearch = historysearch[1:].strip() + + historysearch = historysearch.lower().strip('\n') + + lines = \ + searchBoxPosts(baseDir, nickname, domain, + historysearch, postsPerPage) + + cssFilename = baseDir + '/epicyon-profile.css' + if os.path.isfile(baseDir + '/epicyon.css'): + cssFilename = baseDir + '/epicyon.css' + with open(cssFilename, 'r') as cssFile: + historySearchCSS = cssFile.read() + if httpPrefix != 'https': + historySearchCSS = \ + historySearchCSS.replace('https://', + httpPrefix + '://') + historySearchForm = htmlHeader(cssFilename, historySearchCSS) + + # add the page title + historySearchForm += \ + '

' + translate['Your Posts'] + '

' + + if len(lines) == 0: + historySearchForm += \ + '
' + translate['No results'] + \ + '
' + return historySearchForm + + iconsDir = getIconsDir(baseDir) + + # ensure that the page number is in bounds + if not pageNumber: + pageNumber = 1 + elif pageNumber < 1: + pageNumber = 1 + + # get the start end end within the index file + startIndex = int((pageNumber - 1) * postsPerPage) + endIndex = startIndex + postsPerPage + noOfLines = len(lines) + if endIndex >= noOfLines and noOfLines > 0: + endIndex = noOfLines - 1 + + index = startIndex + while index <= endIndex: + postFilename = lines[index] + if not postFilename: + index += 1 + continue + postJsonObject = loadJson(postFilename) + if not postJsonObject: + continue + showIndividualPostIcons = True + allowDeletion = False + historySearchForm += \ + individualPostAsHtml(recentPostsCache, + maxRecentPosts, + iconsDir, translate, None, + baseDir, session, wfRequest, + personCache, + nickname, domain, port, + postJsonObject, + None, True, allowDeletion, + httpPrefix, projectVersion, + 'search', + showIndividualPostIcons, + showIndividualPostIcons, + False, False, False) + index += 1 + + historySearchForm += htmlFooter() + return historySearchForm + + def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool: """Returns true if there are posts scheduled to be delivered """ @@ -5507,7 +5598,7 @@ def htmlSearch(translate: {}, followStr += '
' followStr += '
' followStr += '
' - idx = 'Enter an address, shared item, #hashtag, ' + \ + idx = 'Enter an address, shared item, !history, #hashtag, ' + \ '*skill or :emoji: to search for' followStr += \ '

' + translate[idx] + '

'