Search your posts

main
Bob Mottram 2020-04-11 13:37:20 +01:00
parent 4e9077547b
commit 0996e2ba5f
17 changed files with 165 additions and 32 deletions

View File

@ -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)

View File

@ -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": "منشوراتك"
}

View File

@ -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 lautor",
"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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "आपके पोस्ट"
}

View File

@ -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"
}

View File

@ -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": "あなたの投稿"
}

View File

@ -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 dun 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 dun 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"
}

View File

@ -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"
}

View File

@ -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": "Ваши сообщения"
}

View File

@ -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": "您的帖子"
}

View File

@ -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 += \
'<center><h1>' + translate['Your Posts'] + '</h1></center>'
if len(lines) == 0:
historySearchForm += \
'<center><h5>' + translate['No results'] + \
'</h5></center>'
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 += '<div class="follow">'
followStr += ' <div class="followAvatar">'
followStr += ' <center>'
idx = 'Enter an address, shared item, #hashtag, ' + \
idx = 'Enter an address, shared item, !history, #hashtag, ' + \
'*skill or :emoji: to search for'
followStr += \
' <p class="followText">' + translate[idx] + '</p>'