Fix saving of bookmarks via bookmark manager.
Fix default settings file.
This commit is contained in:
parent
077042dd43
commit
8e76ae4506
8 changed files with 61 additions and 63 deletions
|
@ -4,8 +4,8 @@
|
|||
[default]
|
||||
archive = 50 # Maximum items to archive (0 - 500)
|
||||
check = 120 # Source check interval (recommended 90; minimum 10)
|
||||
enabled = 1# Work status (Value 0 to disable)
|
||||
filter = 0 # Enable filters (Value 1 to enable)
|
||||
enabled = 1 # Work status (Value 0 to disable)
|
||||
filter = 0 # Enable filters (Value 1 to enable)
|
||||
interval = 300 # Update interval (Minimum value 10)
|
||||
length = 300 # Maximum length of summary (Value 0 to disable)
|
||||
media = 0 # Display media (audio, image, video) when available
|
||||
|
@ -25,7 +25,6 @@ formatting = """
|
|||
{link}
|
||||
{feed_title} [{ix}]
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Utilized in case of missing protocol support.
|
||||
|
@ -38,7 +37,7 @@ tor = ""
|
|||
yggdrasil = ""
|
||||
|
||||
[network]
|
||||
http_proxy = "http://localhost:8118"
|
||||
http_proxy = ""
|
||||
user_agent = "Slixfeed/0.1"
|
||||
clearnet = 0 # Enable policed DNS system (not recommended)
|
||||
i2p = 1 # Enable I2P mixnet system (safer)
|
||||
|
|
|
@ -67,6 +67,8 @@ class Config:
|
|||
return result
|
||||
|
||||
async def set_setting_value(settings, jid_bare, db_file, key, val):
|
||||
print('key and val (inside)')
|
||||
print(key, val)
|
||||
key = key.lower()
|
||||
key_val = [key, val]
|
||||
settings[jid_bare][key] = val
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
__version__ = '0.1.39'
|
||||
__version_info__ = (0, 1, 39)
|
||||
__version__ = '0.1.40'
|
||||
__version_info__ = (0, 1, 40)
|
||||
|
|
|
@ -41,11 +41,11 @@ class XmppBookmark:
|
|||
conferences = result['private']['bookmarks']['conferences']
|
||||
groupchats = []
|
||||
for conference in conferences:
|
||||
groupchats.extend([conference])
|
||||
if conference['jid'] != properties['jid']:
|
||||
groupchats.extend([conference])
|
||||
if properties:
|
||||
properties['jid'] = properties['room'] + '@' + properties['host']
|
||||
if not properties['alias']: properties['alias'] = self.alias
|
||||
|
||||
else:
|
||||
properties = {
|
||||
'jid' : jid,
|
||||
|
@ -62,7 +62,7 @@ class XmppBookmark:
|
|||
# if groupchat['jid'] == groupchat['name']:
|
||||
# groupchat['name'] = groupchat['name'].split('@')[0]
|
||||
bookmarks.add_conference(groupchat['jid'],
|
||||
groupchat['alias'],
|
||||
groupchat['nick'],
|
||||
name=groupchat['name'],
|
||||
autojoin=groupchat['autojoin'],
|
||||
password=groupchat['password'])
|
||||
|
@ -71,7 +71,8 @@ class XmppBookmark:
|
|||
name=properties['name'],
|
||||
autojoin=properties['autojoin'],
|
||||
password=properties['password'])
|
||||
await self.plugin['xep_0048'].set_bookmarks(bookmarks)
|
||||
# await self.plugin['xep_0048'].set_bookmarks(bookmarks)
|
||||
self.plugin['xep_0048'].set_bookmarks(bookmarks)
|
||||
# bookmarks = Bookmarks()
|
||||
# await self.plugin['xep_0048'].set_bookmarks(bookmarks)
|
||||
# print(await self.plugin['xep_0048'].get_bookmarks())
|
||||
|
|
|
@ -1985,16 +1985,17 @@ class Slixfeed(slixmpp.ClientXMPP):
|
|||
options = form.add_field(var='option',
|
||||
ftype='list-single',
|
||||
label='Choose',
|
||||
required=True)
|
||||
required=True,
|
||||
value='admin')
|
||||
jid = session['from'].bare
|
||||
if is_operator(self, jid):
|
||||
options.addOption('Administration', 'admin')
|
||||
# options.addOption('Activity', 'activity')
|
||||
# options.addOption('Filters', 'filter')
|
||||
# options.addOption('Statistics', 'statistics')
|
||||
# options.addOption('Scheduler', 'scheduler')
|
||||
options.addOption('Import', 'import')
|
||||
options.addOption('Export', 'export')
|
||||
jid = session['from'].bare
|
||||
if is_operator(self, jid):
|
||||
options.addOption('Administration', 'admin')
|
||||
session['payload'] = form
|
||||
session['next'] = self._handle_advanced_result
|
||||
session['has_next'] = True
|
||||
|
@ -2626,6 +2627,11 @@ class Slixfeed(slixmpp.ClientXMPP):
|
|||
label='Jabber ID',
|
||||
value=jid_bare)
|
||||
options.addOption(jid_bare, jid_bare)
|
||||
form.addField(var='alias',
|
||||
ftype='text-single',
|
||||
label='Alias',
|
||||
value=properties['nick'],
|
||||
required=True)
|
||||
form.addField(var='name',
|
||||
ftype='text-single',
|
||||
label='Name',
|
||||
|
@ -2641,11 +2647,6 @@ class Slixfeed(slixmpp.ClientXMPP):
|
|||
label='Host',
|
||||
value=host,
|
||||
required=True)
|
||||
form.addField(var='alias',
|
||||
ftype='text-single',
|
||||
label='Alias',
|
||||
value=properties['nick'],
|
||||
required=True)
|
||||
form.addField(var='password',
|
||||
ftype='text-private',
|
||||
label='Password',
|
||||
|
@ -2679,24 +2680,24 @@ class Slixfeed(slixmpp.ClientXMPP):
|
|||
function_name = sys._getframe().f_code.co_name
|
||||
logger.debug('{}: jid_full: {}'
|
||||
.format(function_name, jid_full))
|
||||
# form = self['xep_0004'].make_form('result', 'Done')
|
||||
# form['instructions'] = ('✅️ Bookmark has been saved')
|
||||
# # In this case (as is typical), the payload is a form
|
||||
form = self['xep_0004'].make_form('result', 'Done')
|
||||
form['instructions'] = ('Bookmark has been saved')
|
||||
values = payload['values']
|
||||
await XmppBookmark.add(self, properties=values)
|
||||
# for value in values:
|
||||
# key = str(value)
|
||||
# val = str(values[value])
|
||||
# if not val: val = 'None' # '(empty)'
|
||||
# form.add_field(var=key,
|
||||
# ftype='text-single',
|
||||
# label=key.capitalize(),
|
||||
# value=val)
|
||||
form = payload
|
||||
form['title'] = 'Done'
|
||||
form['instructions'] = 'has been completed!'
|
||||
for i in values:
|
||||
key = str(i)
|
||||
val = str(values[i])
|
||||
if val and key == 'password': val = '**********'
|
||||
# if not val: val = 'None'
|
||||
# form_type = 'text-single' if key != 'password' else 'text-private'
|
||||
if val:
|
||||
form.add_field(var=key,
|
||||
ftype='text-single',
|
||||
label=key.capitalize(),
|
||||
value=val)
|
||||
session['next'] = None
|
||||
session['payload'] = form
|
||||
# session['notes'] = [['warn', text_warn]]
|
||||
return session
|
||||
|
||||
|
||||
|
|
|
@ -1946,16 +1946,17 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
|||
options = form.add_field(var='option',
|
||||
ftype='list-single',
|
||||
label='Choose',
|
||||
required=True)
|
||||
required=True,
|
||||
value='admin')
|
||||
jid = session['from'].bare
|
||||
if is_operator(self, jid):
|
||||
options.addOption('Administration', 'admin')
|
||||
# options.addOption('Activity', 'activity')
|
||||
# options.addOption('Filters', 'filter')
|
||||
# options.addOption('Statistics', 'statistics')
|
||||
# options.addOption('Scheduler', 'scheduler')
|
||||
options.addOption('Import', 'import')
|
||||
options.addOption('Export', 'export')
|
||||
jid = session['from'].bare
|
||||
if is_operator(self, jid):
|
||||
options.addOption('Administration', 'admin')
|
||||
session['payload'] = form
|
||||
session['next'] = self._handle_advanced_result
|
||||
session['has_next'] = True
|
||||
|
@ -2587,6 +2588,11 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
|||
label='Jabber ID',
|
||||
value=jid_bare)
|
||||
options.addOption(jid_bare, jid_bare)
|
||||
form.addField(var='alias',
|
||||
ftype='text-single',
|
||||
label='Alias',
|
||||
value=properties['nick'],
|
||||
required=True)
|
||||
form.addField(var='name',
|
||||
ftype='text-single',
|
||||
label='Name',
|
||||
|
@ -2602,11 +2608,6 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
|||
label='Host',
|
||||
value=host,
|
||||
required=True)
|
||||
form.addField(var='alias',
|
||||
ftype='text-single',
|
||||
label='Alias',
|
||||
value=properties['nick'],
|
||||
required=True)
|
||||
form.addField(var='password',
|
||||
ftype='text-private',
|
||||
label='Password',
|
||||
|
@ -2640,24 +2641,24 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
|||
function_name = sys._getframe().f_code.co_name
|
||||
logger.debug('{}: jid_full: {}'
|
||||
.format(function_name, jid_full))
|
||||
# form = self['xep_0004'].make_form('result', 'Done')
|
||||
# form['instructions'] = ('✅️ Bookmark has been saved')
|
||||
# # In this case (as is typical), the payload is a form
|
||||
form = self['xep_0004'].make_form('result', 'Done')
|
||||
form['instructions'] = ('Bookmark has been saved')
|
||||
values = payload['values']
|
||||
await XmppBookmark.add(self, properties=values)
|
||||
# for value in values:
|
||||
# key = str(value)
|
||||
# val = str(values[value])
|
||||
# if not val: val = 'None' # '(empty)'
|
||||
# form.add_field(var=key,
|
||||
# ftype='text-single',
|
||||
# label=key.capitalize(),
|
||||
# value=val)
|
||||
form = payload
|
||||
form['title'] = 'Done'
|
||||
form['instructions'] = 'has been completed!'
|
||||
for i in values:
|
||||
key = str(i)
|
||||
val = str(values[i])
|
||||
if val and key == 'password': val = '**********'
|
||||
# if not val: val = 'None'
|
||||
# form_type = 'text-single' if key != 'password' else 'text-private'
|
||||
if val:
|
||||
form.add_field(var=key,
|
||||
ftype='text-single',
|
||||
label=key.capitalize(),
|
||||
value=val)
|
||||
session['next'] = None
|
||||
session['payload'] = form
|
||||
# session['notes'] = [['warn', text_warn]]
|
||||
return session
|
||||
|
||||
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
|
||||
"""
|
||||
|
||||
FIXME
|
||||
|
||||
Message from OpenFire server log.
|
||||
|
||||
2024.03.12 14:21:22.518 ERROR [nioEventLoopGroup-3-2]: org.jivesoftware.openfire.IQRouter - Unable to process a stanza that has no 'from' attribute, addressed to a remote entity. Stanza is being dropped: <iq id="8e4e60ae0d894b40a2fc465268d46d0b" type="get" to="rss.simon.goodbytes.im"><ping xmlns="urn:xmpp:ping"></ping></iq>
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
1) Check interval, and if no connection is establish after 30 seconds
|
||||
|
|
|
@ -822,6 +822,7 @@ async def message(self, message):
|
|||
db_file = config.get_pathname_to_database(jid_file)
|
||||
key = 'old'
|
||||
val = 0
|
||||
print('key and val (outside)')
|
||||
await Config.set_setting_value(self.settings, jid_bare,
|
||||
db_file, key, val)
|
||||
response = 'Only new items of newly added feeds be delivered.'
|
||||
|
|
Loading…
Reference in a new issue