From 510491958893d48efdef109c5700a6fb2ec5b334 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Thu, 5 Dec 2024 12:06:57 +0200 Subject: [PATCH] Fix OPML export (OMEMO is not yet supported); Add commands blacklist/whitelist to command list. --- slixfeed/configs/commands.toml | 18 ++++++++++++++++++ slixfeed/syndication.py | 4 ++-- slixfeed/utilities.py | 1 + slixfeed/version.py | 4 ++-- slixfeed/xmpp/chat.py | 2 +- slixfeed/xmpp/client.py | 2 +- slixfeed/xmpp/commands.py | 4 ++-- slixfeed/xmpp/ipc.py | 2 +- 8 files changed, 28 insertions(+), 9 deletions(-) diff --git a/slixfeed/configs/commands.toml b/slixfeed/configs/commands.toml index 753233c..f67e9e5 100644 --- a/slixfeed/configs/commands.toml +++ b/slixfeed/configs/commands.toml @@ -248,6 +248,24 @@ stats = """ stats Show general statistics. """ + +[list] +blacklist = """ +blacklist +List all blacklisted JIDs. +""" +blacklist_action = """ +blacklist [add|delete] +Manage allowed list. +""" +whitelist = """ +whitelist +List all whitelisted JIDs. +""" +whitelist_action = """ +whitelist [add|delete] +Manage denied list. +""" # analyses = """ # analyses # Show report and statistics of feeds. diff --git a/slixfeed/syndication.py b/slixfeed/syndication.py index e36b76b..e5e09ef 100644 --- a/slixfeed/syndication.py +++ b/slixfeed/syndication.py @@ -43,7 +43,7 @@ logger = Logger(__name__) class Feed: # NOTE Consider removal of MD (and any other option HTML and XBEL) - def export_feeds(dir_cache, jid_bare, ext): + def export_feeds(dir_data, dir_cache, jid_bare, ext): function_name = sys._getframe().f_code.co_name logger.debug('{}: jid_bare: {}: ext: {}'.format(function_name, jid_bare, ext)) if not os.path.isdir(dir_cache): @@ -52,7 +52,7 @@ class Feed: os.mkdir(dir_cache + '/' + ext) filename = os.path.join( dir_cache, ext, 'slixfeed_' + DateAndTime.timestamp() + '.' + ext) - db_file = os.path.join(self.dir_data, 'sqlite', f'{jid_bare}.db') + db_file = os.path.join(dir_data, 'sqlite', f'{jid_bare}.db') results = sqlite.get_feeds(db_file) match ext: # case 'html': diff --git a/slixfeed/utilities.py b/slixfeed/utilities.py index d6aa2d1..4de18e3 100644 --- a/slixfeed/utilities.py +++ b/slixfeed/utilities.py @@ -551,6 +551,7 @@ class Url: else: proxies_obsolete_file = os.path.join(configuration_directory, 'proxies_obsolete.toml') proxies_file = os.path.join(configuration_directory, 'proxies.toml') + breakpoint() proxies_obsolete = Toml.open_file(proxies_obsolete_file) proxies_obsolete['proxies'][proxy_name][proxy_type].append(proxy_url) Toml.save_file(proxies_obsolete_file, proxies_obsolete) diff --git a/slixfeed/version.py b/slixfeed/version.py index 9a4d362..ef51aeb 100644 --- a/slixfeed/version.py +++ b/slixfeed/version.py @@ -1,2 +1,2 @@ -__version__ = '0.1.103' -__version_info__ = (0, 1, 103) +__version__ = '0.1.104' +__version_info__ = (0, 1, 104) diff --git a/slixfeed/xmpp/chat.py b/slixfeed/xmpp/chat.py index be06aa6..5643791 100644 --- a/slixfeed/xmpp/chat.py +++ b/slixfeed/xmpp/chat.py @@ -288,7 +288,7 @@ class XmppChat: XmppPresence.send(self, jid_bare, status_message, status_type=status_type) pathname, response = XmppCommands.export_feeds( - self.dir_cache, jid_bare, ext) + self.dir_data, self.dir_cache, jid_bare, ext) encrypt_omemo = Config.get_setting_value(self, jid_bare, 'omemo') encrypted = True if encrypt_omemo else False url = await XmppUpload.start(self, jid_bare, Path(pathname), encrypted=encrypted) diff --git a/slixfeed/xmpp/client.py b/slixfeed/xmpp/client.py index 5c27fba..772b857 100644 --- a/slixfeed/xmpp/client.py +++ b/slixfeed/xmpp/client.py @@ -2984,7 +2984,7 @@ class XmppClient(slixmpp.ClientXMPP): # form['instructions'] = ('✅️ Feeds have been exported') exts = values['filetype'] for ext in exts: - filename = Feed.export_feeds(self.dir_cache, jid_bare, ext) + filename = Feed.export_feeds(self.dir_data, self.dir_cache, jid_bare, ext) encrypt_omemo = Config.get_setting_value(self, jid_bare, 'omemo') encrypted = True if encrypt_omemo else False url = await XmppUpload.start( diff --git a/slixfeed/xmpp/commands.py b/slixfeed/xmpp/commands.py index 3fe4d98..0ab81ae 100644 --- a/slixfeed/xmpp/commands.py +++ b/slixfeed/xmpp/commands.py @@ -324,8 +324,8 @@ class XmppCommands: await sqlite.set_filter_value(db_file, ['deny', val]) - def export_feeds(dir_cache, jid_bare, ext): - pathname = Feed.export_feeds(dir_cache, jid_bare, ext) + def export_feeds(dir_data, dir_cache, jid_bare, ext): + pathname = Feed.export_feeds(dir_data, dir_cache, jid_bare, ext) message = f'Feeds successfuly exported to {ext}.' return pathname, message diff --git a/slixfeed/xmpp/ipc.py b/slixfeed/xmpp/ipc.py index c483b2e..c48d747 100644 --- a/slixfeed/xmpp/ipc.py +++ b/slixfeed/xmpp/ipc.py @@ -176,7 +176,7 @@ class XmppIpcServer: ext = command[7:] if ext in ('md', 'opml'): filename, result = XmppCommands.export_feeds( - self.dir_cache, jid_bare, ext) + self.dir_data, self.dir_cache, jid_bare, ext) response = result + ' : ' + filename else: response = 'Unsupported filetype. Try: md or opml'