mirror of https://gitlab.com/bashrc2/epicyon
Include notes in csv export
parent
874357c87f
commit
a6d90d0ae6
10
daemon.py
10
daemon.py
|
@ -16518,7 +16518,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._login_headers('text/html', msglen, calling_domain)
|
self._login_headers('text/html', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
elif csv_getreq:
|
elif csv_getreq:
|
||||||
msg = csv_following_list(following_filename)
|
msg = csv_following_list(following_filename,
|
||||||
|
self.server.base_dir,
|
||||||
|
nickname,
|
||||||
|
self.server.domain)
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._login_headers('text/csv', msglen, calling_domain)
|
self._login_headers('text/csv', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
|
@ -16553,7 +16556,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._login_headers('text/html', msglen, calling_domain)
|
self._login_headers('text/html', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
elif csv_getreq:
|
elif csv_getreq:
|
||||||
msg = csv_following_list(followers_filename)
|
msg = csv_following_list(followers_filename,
|
||||||
|
self.server.base_dir,
|
||||||
|
nickname,
|
||||||
|
self.server.domain)
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._login_headers('text/csv', msglen, calling_domain)
|
self._login_headers('text/csv', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
|
|
|
@ -99,7 +99,8 @@ def html_following_list(base_dir: str, following_filename: str) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def csv_following_list(following_filename: str) -> str:
|
def csv_following_list(following_filename: str,
|
||||||
|
base_dir: str, nickname: str, domain: str) -> str:
|
||||||
"""Returns a csv of handles being followed
|
"""Returns a csv of handles being followed
|
||||||
"""
|
"""
|
||||||
with open(following_filename, 'r', encoding='utf-8') as following_file:
|
with open(following_filename, 'r', encoding='utf-8') as following_file:
|
||||||
|
@ -113,8 +114,16 @@ def csv_following_list(following_filename: str) -> str:
|
||||||
continue
|
continue
|
||||||
if following_list_csv:
|
if following_list_csv:
|
||||||
following_list_csv += '\n'
|
following_list_csv += '\n'
|
||||||
following_list_csv += following_address + ',true'
|
following_list_csv += following_address + ',true,'
|
||||||
msg = 'Account address,Show boosts\n' + following_list_csv
|
person_notes_filename = \
|
||||||
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
|
'/notes/' + following_address + '.txt'
|
||||||
|
if os.path.isfile(person_notes_filename):
|
||||||
|
with open(person_notes_filename, 'r',
|
||||||
|
encoding='utf-8') as fp_notes:
|
||||||
|
person_notes = fp_notes.read()
|
||||||
|
following_list_csv += person_notes
|
||||||
|
msg = 'Account address,Show boosts,Notes\n' + following_list_csv
|
||||||
return msg
|
return msg
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue