forked from indymedia/epicyon
Replies timeline
parent
7ed6728594
commit
8ea1e3306b
71
daemon.py
71
daemon.py
|
@ -83,6 +83,7 @@ from webinterface import htmlDeletePost
|
||||||
from webinterface import htmlAbout
|
from webinterface import htmlAbout
|
||||||
from webinterface import htmlRemoveSharedItem
|
from webinterface import htmlRemoveSharedItem
|
||||||
from webinterface import htmlInboxDMs
|
from webinterface import htmlInboxDMs
|
||||||
|
from webinterface import htmlInboxReplies
|
||||||
from webinterface import htmlUnblockConfirm
|
from webinterface import htmlUnblockConfirm
|
||||||
from webinterface import htmlPersonOptions
|
from webinterface import htmlPersonOptions
|
||||||
from webinterface import htmlIndividualPost
|
from webinterface import htmlIndividualPost
|
||||||
|
@ -1704,7 +1705,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
# get the inbox for a given person
|
# get the direct messages for a given person
|
||||||
if self.path.endswith('/dm') or '/dm?page=' in self.path:
|
if self.path.endswith('/dm') or '/dm?page=' in self.path:
|
||||||
if '/users/' in self.path:
|
if '/users/' in self.path:
|
||||||
if authorized:
|
if authorized:
|
||||||
|
@ -1770,6 +1771,74 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.GETbusy=False
|
self.server.GETbusy=False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# get the replies for a given person
|
||||||
|
if self.path.endswith('/replies') or '/replies?page=' in self.path:
|
||||||
|
if '/users/' in self.path:
|
||||||
|
if authorized:
|
||||||
|
inboxRepliesFeed= \
|
||||||
|
personBoxJson(self.server.baseDir, \
|
||||||
|
self.server.domain, \
|
||||||
|
self.server.port, \
|
||||||
|
self.path, \
|
||||||
|
self.server.httpPrefix, \
|
||||||
|
maxPostsInFeed, 'replies', \
|
||||||
|
True,self.server.ocapAlways)
|
||||||
|
if inboxRepliesFeed:
|
||||||
|
if self._requestHTTP():
|
||||||
|
nickname=self.path.replace('/users/','').replace('/replies','')
|
||||||
|
pageNumber=1
|
||||||
|
if '?page=' in nickname:
|
||||||
|
pageNumber=nickname.split('?page=')[1]
|
||||||
|
nickname=nickname.split('?page=')[0]
|
||||||
|
if pageNumber.isdigit():
|
||||||
|
pageNumber=int(pageNumber)
|
||||||
|
else:
|
||||||
|
pageNumber=1
|
||||||
|
if 'page=' not in self.path:
|
||||||
|
# if no page was specified then show the first
|
||||||
|
inboxRepliesFeed= \
|
||||||
|
personBoxJson(self.server.baseDir, \
|
||||||
|
self.server.domain, \
|
||||||
|
self.server.port, \
|
||||||
|
self.path+'?page=1', \
|
||||||
|
self.server.httpPrefix, \
|
||||||
|
maxPostsInFeed, 'replies', \
|
||||||
|
True,self.server.ocapAlways)
|
||||||
|
msg=htmlInboxReplies(self.server.translate, \
|
||||||
|
pageNumber,maxPostsInFeed, \
|
||||||
|
self.server.session, \
|
||||||
|
self.server.baseDir, \
|
||||||
|
self.server.cachedWebfingers, \
|
||||||
|
self.server.personCache, \
|
||||||
|
nickname, \
|
||||||
|
self.server.domain, \
|
||||||
|
self.server.port, \
|
||||||
|
inboxRepliesFeed, \
|
||||||
|
self.server.allowDeletion, \
|
||||||
|
self.server.httpPrefix, \
|
||||||
|
self.server.projectVersion).encode('utf-8')
|
||||||
|
self._set_headers('text/html',len(msg),cookie)
|
||||||
|
self.wfile.write(msg)
|
||||||
|
else:
|
||||||
|
msg=json.dumps(inboxDMFeed).encode('utf-8')
|
||||||
|
self._set_headers('application/json',len(msg),None)
|
||||||
|
self.wfile.write(msg)
|
||||||
|
self.server.GETbusy=False
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if self.server.debug:
|
||||||
|
nickname=self.path.replace('/users/','').replace('/replies','')
|
||||||
|
print('DEBUG: '+nickname+ \
|
||||||
|
' was not authorized to access '+self.path)
|
||||||
|
if self.path!='/replies':
|
||||||
|
# not the replies inbox
|
||||||
|
if self.server.debug:
|
||||||
|
print('DEBUG: GET access to inbox is unauthorized')
|
||||||
|
self.send_response(405)
|
||||||
|
self.end_headers()
|
||||||
|
self.server.GETbusy=False
|
||||||
|
return
|
||||||
|
|
||||||
# get outbox feed for a person
|
# get outbox feed for a person
|
||||||
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
|
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
|
||||||
self.server.port,self.path, \
|
self.server.port,self.path, \
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Cymeradwyo dilyn ceisiadau",
|
"Approve follow requests": "Cymeradwyo dilyn ceisiadau",
|
||||||
"Page down": "Tudalen lawr",
|
"Page down": "Tudalen lawr",
|
||||||
"Page up": "Tudalen i fyny",
|
"Page up": "Tudalen i fyny",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Follow-Anfragen genehmigen",
|
"Approve follow requests": "Follow-Anfragen genehmigen",
|
||||||
"Page down": "Bild runter",
|
"Page down": "Bild runter",
|
||||||
"Page up": "Bild auf",
|
"Page up": "Bild auf",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Approve follow requests",
|
"Approve follow requests": "Approve follow requests",
|
||||||
"Page down": "Page down",
|
"Page down": "Page down",
|
||||||
"Page up": "Page up",
|
"Page up": "Page up",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Aprobar seguir solicitudes",
|
"Approve follow requests": "Aprobar seguir solicitudes",
|
||||||
"Page down": "Página abajo",
|
"Page down": "Página abajo",
|
||||||
"Page up": "Página arriba",
|
"Page up": "Página arriba",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Approuver les demandes de suivi",
|
"Approve follow requests": "Approuver les demandes de suivi",
|
||||||
"Page down": "Bas de page",
|
"Page down": "Bas de page",
|
||||||
"Page up": "Haut de page",
|
"Page up": "Haut de page",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Iarratais a leanúint a cheadú",
|
"Approve follow requests": "Iarratais a leanúint a cheadú",
|
||||||
"Page down": "Leathanach Síos",
|
"Page down": "Leathanach Síos",
|
||||||
"Page up": "Leathanach suas",
|
"Page up": "Leathanach suas",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,5 +137,6 @@
|
||||||
"Approve follow requests": "Approvare seguire le richieste",
|
"Approve follow requests": "Approvare seguire le richieste",
|
||||||
"Page down": "Pagina giù",
|
"Page down": "Pagina giù",
|
||||||
"Page up": "Pagina su",
|
"Page up": "Pagina su",
|
||||||
"Vote": "Vote"
|
"Vote": "Vote",
|
||||||
|
"Replies": "Replies"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2076,12 +2076,15 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
|
|
||||||
inboxButton='button'
|
inboxButton='button'
|
||||||
dmButton='button'
|
dmButton='button'
|
||||||
|
repliesButton='button'
|
||||||
sentButton='button'
|
sentButton='button'
|
||||||
moderationButton='button'
|
moderationButton='button'
|
||||||
if boxName=='inbox':
|
if boxName=='inbox':
|
||||||
inboxButton='buttonselected'
|
inboxButton='buttonselected'
|
||||||
elif boxName=='dm':
|
elif boxName=='dm':
|
||||||
dmButton='buttonselected'
|
dmButton='buttonselected'
|
||||||
|
elif boxName=='replies':
|
||||||
|
repliesButton='buttonselected'
|
||||||
elif boxName=='outbox':
|
elif boxName=='outbox':
|
||||||
sentButton='buttonselected'
|
sentButton='buttonselected'
|
||||||
elif boxName=='moderation':
|
elif boxName=='moderation':
|
||||||
|
@ -2127,6 +2130,7 @@ def htmlTimeline(translate: {},pageNumber: int, \
|
||||||
'<div class="container">\n'+ \
|
'<div class="container">\n'+ \
|
||||||
' <a href="'+actor+'/inbox"><button class="'+inboxButton+'"><span>'+translate['Inbox']+'</span></button></a>' \
|
' <a href="'+actor+'/inbox"><button class="'+inboxButton+'"><span>'+translate['Inbox']+'</span></button></a>' \
|
||||||
' <a href="'+actor+'/dm"><button class="'+dmButton+'"><span>'+translate['DM']+'</span></button></a>' \
|
' <a href="'+actor+'/dm"><button class="'+dmButton+'"><span>'+translate['DM']+'</span></button></a>' \
|
||||||
|
' <a href="'+actor+'/replies"><button class="'+repliesButton+'"><span>'+translate['Replies']+'</span></button></a>' \
|
||||||
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>'+translate['Outbox']+'</span></button></a>'+ \
|
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>'+translate['Outbox']+'</span></button></a>'+ \
|
||||||
moderationButtonStr+newPostButtonStr+ \
|
moderationButtonStr+newPostButtonStr+ \
|
||||||
' <a href="'+actor+'/search"><img src="/'+iconsDir+'/search.png" title="'+translate['Search and follow']+'" alt="'+translate['Search and follow']+'" class="right"/></a>'+ \
|
' <a href="'+actor+'/search"><img src="/'+iconsDir+'/search.png" title="'+translate['Search and follow']+'" alt="'+translate['Search and follow']+'" class="right"/></a>'+ \
|
||||||
|
@ -2204,6 +2208,18 @@ def htmlInboxDMs(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||||
nickname,domain,port,inboxJson,'dm',allowDeletion, \
|
nickname,domain,port,inboxJson,'dm',allowDeletion, \
|
||||||
httpPrefix,projectVersion,False)
|
httpPrefix,projectVersion,False)
|
||||||
|
|
||||||
|
def htmlInboxReplies(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||||
|
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
|
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||||
|
allowDeletion: bool, \
|
||||||
|
httpPrefix: str,projectVersion: str) -> str:
|
||||||
|
"""Show the replies timeline as html
|
||||||
|
"""
|
||||||
|
return htmlTimeline(translate,pageNumber, \
|
||||||
|
itemsPerPage,session,baseDir,wfRequest,personCache, \
|
||||||
|
nickname,domain,port,inboxJson,'replies',allowDeletion, \
|
||||||
|
httpPrefix,projectVersion,False)
|
||||||
|
|
||||||
def htmlModeration(translate: {},pageNumber: int,itemsPerPage: int, \
|
def htmlModeration(translate: {},pageNumber: int,itemsPerPage: int, \
|
||||||
session,baseDir: str,wfRequest: {},personCache: {}, \
|
session,baseDir: str,wfRequest: {},personCache: {}, \
|
||||||
nickname: str,domain: str,port: int,inboxJson: {}, \
|
nickname: str,domain: str,port: int,inboxJson: {}, \
|
||||||
|
|
Loading…
Reference in New Issue