Fix OPML export (OMEMO is not yet supported);
Add commands blacklist/whitelist to command list.
This commit is contained in:
parent
d3dbcb0cdb
commit
5104919588
8 changed files with 28 additions and 9 deletions
|
@ -248,6 +248,24 @@ stats = """
|
|||
stats
|
||||
Show general statistics.
|
||||
"""
|
||||
|
||||
[list]
|
||||
blacklist = """
|
||||
blacklist
|
||||
List all blacklisted JIDs.
|
||||
"""
|
||||
blacklist_action = """
|
||||
blacklist [add|delete] <jid>
|
||||
Manage allowed list.
|
||||
"""
|
||||
whitelist = """
|
||||
whitelist
|
||||
List all whitelisted JIDs.
|
||||
"""
|
||||
whitelist_action = """
|
||||
whitelist [add|delete] <jid>
|
||||
Manage denied list.
|
||||
"""
|
||||
# analyses = """
|
||||
# analyses
|
||||
# Show report and statistics of feeds.
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
__version__ = '0.1.103'
|
||||
__version_info__ = (0, 1, 103)
|
||||
__version__ = '0.1.104'
|
||||
__version_info__ = (0, 1, 104)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue