added nostr-relay.untethr.me as default relay rather than onsats, which returns lot more messages. and fixed some small old issues exposed such messages

This commit is contained in:
vishalxl
2022-08-08 15:47:49 +05:30
parent afe266f75a
commit 0d07600066

View File

@@ -3,11 +3,11 @@ import 'dart:io';
import 'dart:convert'; import 'dart:convert';
//import 'dart:svg'; //import 'dart:svg';
const int screenWidth = 80; const int screenWidth = 120;
const bool enableVerticalLines = false; const bool enableVerticalLines = false;
const int spacesPerDepth = 8; const int spacesPerDepth = 8;
int keyLenPrinted = 6; int keyLenPrinted = 6;
String defaultServerUrl = 'wss://nostr.onsats.org'; String defaultServerUrl = 'wss://nostr-relay.untethr.me';
Map<String, String> gKindONames = {}; Map<String, String> gKindONames = {};
@@ -23,9 +23,16 @@ void getNames(Event e) {
if( content.isEmpty) { if( content.isEmpty) {
return; return;
} }
dynamic json = jsonDecode(content); try {
dynamic json = jsonDecode(content);
gKindONames[e.eventData.pubkey] = json["name"];
if(json["name"] != Null) {
gKindONames[e.eventData.pubkey] = json["name"]??"";
}
} catch(ex) {
print("in getNames: caught exception $ex for content ${e.eventData.content}");
}
} }
String getAuthorName(String pubkey) { String getAuthorName(String pubkey) {
@@ -125,7 +132,7 @@ class EventData {
if( n >=3 ) { if( n >=3 ) {
server = tag[2].toString(); server = tag[2].toString();
if( server == 'wss://nostr.rocks') { if( server == 'wss://nostr.rocks') {
server = 'wss://nostr.onsats.org'; server = defaultServerUrl;
} }
} }
Contact c = Contact(tag[1] as String, server, 3.toString()); Contact c = Contact(tag[1] as String, server, 3.toString());
@@ -254,7 +261,7 @@ class Tree {
processed.add(key); processed.add(key);
} else { } else {
// is not a parent, find its parent and then add this element to that parent Tree // is not a parent, find its parent and then add this element to that parent Tree
stdout.write("added to parent a child\n"); //stdout.write("added to parent a child\n");
String id = key; String id = key;
String parentId = value.e.eventData.getParent(); String parentId = value.e.eventData.getParent();
m[parentId]?.addChildNode(value); m[parentId]?.addChildNode(value);