From 6f37df213504b20ab647cd4b97b9fd0b80d1db51 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 28 Jul 2019 09:34:49 +0100 Subject: [PATCH] Posting shares from the web interface --- daemon.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/daemon.py b/daemon.py index c445b6ba..acbc0114 100644 --- a/daemon.py +++ b/daemon.py @@ -66,6 +66,7 @@ from webinterface import htmlNewPost from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload +from shares import addShare import os import sys @@ -1179,7 +1180,29 @@ class PubServer(BaseHTTPRequestHandler): return True if postType=='newshare': - # TODO + if not fields.get('itemType'): + return False + if not fields.get('category'): + return False + if not fields.get('location'): + return False + if not fields.get('duration'): + return False + addShare(self.server.baseDir, \ + self.server.httpPrefix, \ + nickname, \ + self.server.domain,self.server.port, \ + fields['subject'], \ + fields['message'], \ + filename, \ + fields['itemType'], \ + fields['category'], \ + fields['location'], \ + fields['duration'], + self.server.debug) + # TODO distribute shares to followers + if os.path.isfile(filename): + os.remove(filename) return True return False