From 996499a2231108ffe016f95262d6078ff36c3d94 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 17 Oct 2020 21:12:49 +0100 Subject: [PATCH] Edit filtered words for newswire --- daemon.py | 11 +++++++++++ webinterface.py | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/daemon.py b/daemon.py index 86cb9be8f..69a154813 100644 --- a/daemon.py +++ b/daemon.py @@ -2973,6 +2973,17 @@ class PubServer(BaseHTTPRequestHandler): if os.path.isfile(newswireFilename): os.remove(newswireFilename) + # save filtered words list for the newswire + filterNewswireFilename = \ + baseDir + '/accounts/' + \ + 'news@' + domain + '/filters.txt' + if fields.get('filteredWordsNewswire'): + with open(filterNewswireFilename, 'w+') as filterfile: + filterfile.write(fields['filteredWordsNewswire']) + else: + if os.path.isfile(filterNewswireFilename): + os.remove(filterNewswireFilename) + newswireTrustedFilename = baseDir + '/accounts/newswiretrusted.txt' if fields.get('trustedNewswire'): newswireTrusted = fields['trustedNewswire'] diff --git a/webinterface.py b/webinterface.py index 14b4aa121..112124607 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1345,6 +1345,22 @@ def htmlEditNewswire(translate: {}, baseDir: str, path: str, ' ' + filterStr = '' + filterFilename = \ + baseDir + '/accounts/news@' + domain + '/filters.txt' + if os.path.isfile(filterFilename): + with open(filterFilename, 'r') as filterfile: + filterStr = filterfile.read() + + editNewswireForm += \ + '
\n' + editNewswireForm += '
\n' + editNewswireForm += ' \n' + editNewswireForm += \ ''