diff --git a/daemon.py b/daemon.py
index 9c10b9da..abe2dd6f 100644
--- a/daemon.py
+++ b/daemon.py
@@ -3053,13 +3053,15 @@ class PubServer(BaseHTTPRequestHandler):
baseDir: str, httpPrefix: str,
domain: str, domainFull: str,
onionDomain: str, i2pDomain: str, debug: bool,
- defaultTimeline: str) -> None:
+ defaultTimeline: str,
+ newswire: {}) -> None:
"""Updates the citations for a blog post after hitting
update button on the citations screen
"""
usersPath = path.replace('/citationsdata', '')
actorStr = httpPrefix + '://' + domainFull + usersPath
- if ' boundary=' in self.headers['Content-type']:
+ if newswire and \
+ ' boundary=' in self.headers['Content-type']:
boundary = self.headers['Content-type'].split('boundary=')[1]
if ';' in boundary:
boundary = boundary.split(';')[0]
@@ -3111,14 +3113,20 @@ class PubServer(BaseHTTPRequestHandler):
# extract all of the text fields into a dict
fields = \
extractTextFieldsInPOST(postBytes, boundary, debug)
- print('citationstest: ' + str(fields))
- if fields.get('citations'):
+ citations = []
+ for dateStr, item in newswire.items():
+ if fields.get(dateStr):
+ if fields[dateStr] == 'on':
+ citations.append(dateStr)
+
+ if citations:
citationsFilename = \
baseDir + '/accounts/' + \
nickname + '@' + domain + '/.citations.txt'
- citationsStr = fields['citations']
- print('DEBUG: citationsStr = ' + citationsStr)
- # save citations, so that they can be added when
+ citationsStr = ''
+ for citationDate in citations:
+ citationsStr += citationDate + '\n'
+ # save citations dates, so that they can be added when
# reloading the newblog screen
citationsFile = open(citationsFilename, "w+")
if citationsFile:
@@ -11773,7 +11781,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domainFull,
self.server.onionDomain,
self.server.i2pDomain, self.server.debug,
- self.server.defaultTimeline)
+ self.server.defaultTimeline,
+ self.server.newswire)
return
if authorized and self.path.endswith('/newseditdata'):
diff --git a/webinterface.py b/webinterface.py
index e2992d69..1cd4b94c 100644
--- a/webinterface.py
+++ b/webinterface.py
@@ -5914,6 +5914,7 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
# list of newswire items
if newswire:
+ ctr = 0
for dateStr, item in newswire.items():
publishedDate = \
datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
@@ -5923,11 +5924,12 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
link = item[1]
htmlStr += \
- '' + \
+ '' + \
'' + title + ' '
htmlStr += '' + \
dateShown + '
\n'
+ ctr += 1
htmlStr += '\n'
return htmlStr + htmlFooter()