Make relays dynamic

This commit is contained in:
Guy Van Sanden 2023-03-06 13:02:52 +01:00
parent a584467907
commit c1c349a6f3

View File

@ -65,6 +65,8 @@ def get_json():
nostr = {} nostr = {}
nostr['names'] = {} nostr['names'] = {}
nostr['relays'] = {}
if localusers is not None: if localusers is not None:
for user in localusers: for user in localusers:
if user['nickname'] == 'gvs': if user['nickname'] == 'gvs':
@ -72,11 +74,7 @@ def get_json():
for field in user.get('fields'): for field in user.get('fields'):
if field.get('name').lower() == 'nostr': if field.get('name').lower() == 'nostr':
nostr['names'][user['nickname']] = field.get('value') nostr['names'][user['nickname']] = field.get('value')
nostr['relays'][field.get('value')] = relays
# print(json.dumps(nostr))
# nostr['names']['gvs'] = 'eb2881406ad19ba7cf01c210ce002f4fe53e8ce6d84e77df5a2319f9f00a8005'
nostr['relays'] = {}
nostr['relays']['eb2881406ad19ba7cf01c210ce002f4fe53e8ce6d84e77df5a2319f9f00a8005'] = relays
print(json.dumps(nostr))
return json.dumps(nostr) return json.dumps(nostr)