mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-03-27 02:01:51 +01:00
displayed lud16 if people have it in their profile page
This commit is contained in:
parent
0959c5019c
commit
27ce32bd1b
@ -119,6 +119,7 @@ Future<void> main(List<String> arguments) async {
|
||||
if( userPublicKey == gDefaultPublicKey) {
|
||||
print("You should ideally create your own private key and use it with ${gWarningColor}--prikey$gColorEndMarker program argument. ");
|
||||
print("Create a private key from ${gWarningColor}astral.ninja, @damusapp, or even from command line using `openssl rand -hex 32`.$gColorEndMarker.\n");
|
||||
print("npub/nsec keys can be converted to hex key format using https://damus.io/key");
|
||||
}
|
||||
|
||||
// handle relay related argument
|
||||
|
@ -318,12 +318,14 @@ void printProfile(Store node, String profilePubkey) {
|
||||
print("");
|
||||
String about = gKindONames[profilePubkey]?.about??"";
|
||||
String picture = gKindONames[profilePubkey]?.picture??"";
|
||||
String lud16 = gKindONames[profilePubkey]?.lud16??"";
|
||||
int dateLastUpdated = gKindONames[profilePubkey]?.createdAt??0;
|
||||
bool verified = gKindONames[profilePubkey]?.nip05Verified??false;
|
||||
String nip05Id = gKindONames[profilePubkey]?.nip05Id??"";
|
||||
print("\nName : $authorName ( ${profilePubkey} ).");
|
||||
print("About : $about");
|
||||
print("Picture : $picture");
|
||||
print("Lud16 : $lud16");
|
||||
print("Nip 05 : ${verified?"yes. ${nip05Id}":"no"}");
|
||||
print("\nLast Updated: ${getPrintableDate(dateLastUpdated)}\n");
|
||||
|
||||
|
@ -31,12 +31,12 @@ List<String> nip08PlaceHolders = ["#[0]", "#[1]", "#[2]", "#[3]", "#[4]", "#[5]"
|
||||
// kind 0 event and/or kind 3 event, both with their own time stamps.
|
||||
class UserNameInfo {
|
||||
int? createdAt;
|
||||
String? name, about, picture;
|
||||
String? name, about, picture, lud16;
|
||||
int? createdAtKind3;
|
||||
Event ?latestContactEvent;
|
||||
bool nip05Verified;
|
||||
String? nip05Id;
|
||||
UserNameInfo(this.createdAt, this.name, this.about, this.picture, this.nip05Id , this.latestContactEvent, [this.createdAtKind3 = null, this.nip05Verified = false]);
|
||||
UserNameInfo(this.createdAt, this.name, this.about, this.picture, this.lud16, this.nip05Id , this.latestContactEvent, [this.createdAtKind3 = null, this.nip05Verified = false]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1064,6 +1064,7 @@ bool processKind0Event(Event e) {
|
||||
String name = "";
|
||||
String about = "";
|
||||
String picture = "";
|
||||
String lud16 = "";
|
||||
String nip05 = "";
|
||||
|
||||
try {
|
||||
@ -1071,6 +1072,7 @@ bool processKind0Event(Event e) {
|
||||
name = json["name"]??"";
|
||||
about = json["about"]??"";
|
||||
picture = json["picture"]??"";
|
||||
lud16 = json["lud16"]??"";
|
||||
nip05 = json['nip05']??"";
|
||||
//String twitterId = json['twitter']??"";
|
||||
//String githubId = json['github']??"";
|
||||
@ -1080,12 +1082,12 @@ bool processKind0Event(Event e) {
|
||||
|
||||
bool newEntry = false, entryModified = false;
|
||||
if( !gKindONames.containsKey(e.eventData.pubkey)) {
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, nip05, null);
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, lud16, nip05, null);
|
||||
newEntry = true;;
|
||||
} else {
|
||||
int oldTime = gKindONames[e.eventData.pubkey]?.createdAt??0;
|
||||
if( oldTime < e.eventData.createdAt) {
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, nip05, null);
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, lud16, nip05, null);
|
||||
entryModified = true;
|
||||
}
|
||||
}
|
||||
@ -1121,7 +1123,7 @@ bool processKind0Event(Event e) {
|
||||
int oldTime = 0;
|
||||
if( !gKindONames.containsKey(e.eventData.pubkey)) {
|
||||
//printWarning("in response handing. creating user info");
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, null, null);
|
||||
gKindONames[e.eventData.pubkey] = UserNameInfo(e.eventData.createdAt, name, about, picture, lud16, null, null);
|
||||
} else {
|
||||
oldTime = gKindONames[e.eventData.pubkey]?.createdAt??0;
|
||||
//print("in response handing. user info exists with old time = $oldTime and this event time = ${e.eventData.createdAt}");
|
||||
@ -1157,7 +1159,7 @@ bool processKind3Event(Event newContactEvent) {
|
||||
|
||||
bool newEntry = false, entryModified = false;
|
||||
if( !gKindONames.containsKey(newContactEvent.eventData.pubkey)) {
|
||||
gKindONames[newContactEvent.eventData.pubkey] = UserNameInfo(null, null, null, null, null, newContactEvent, newContactEvent.eventData.createdAt);
|
||||
gKindONames[newContactEvent.eventData.pubkey] = UserNameInfo(null, null, null, null, null, null, newContactEvent, newContactEvent.eventData.createdAt);
|
||||
newEntry = true;;
|
||||
} else {
|
||||
// if entry already exists, then check its old time and update only if we have a newer entry now
|
||||
@ -1167,9 +1169,10 @@ bool processKind3Event(Event newContactEvent) {
|
||||
String? name = gKindONames[newContactEvent.eventData.pubkey]?.name,
|
||||
about = gKindONames[newContactEvent.eventData.pubkey]?.about,
|
||||
picture = gKindONames[newContactEvent.eventData.pubkey]?.picture,
|
||||
lud16 = gKindONames[newContactEvent.eventData.pubkey]?.lud16,
|
||||
nip05id = gKindONames[newContactEvent.eventData.pubkey]?.nip05Id??"";
|
||||
|
||||
gKindONames[newContactEvent.eventData.pubkey] = UserNameInfo(createdAt, name, about, picture, nip05id, newContactEvent, newContactEvent.eventData.createdAt );
|
||||
gKindONames[newContactEvent.eventData.pubkey] = UserNameInfo(createdAt, name, about, picture, lud16, nip05id, newContactEvent, newContactEvent.eventData.createdAt );
|
||||
entryModified = true;;
|
||||
}
|
||||
}
|
||||
|
@ -1258,7 +1258,7 @@ class Store {
|
||||
// for pubkeys that don't have any kind 0 events ( but have other events), add then to global kind0 store so they can still be accessed
|
||||
tempChildEventsMap.forEach((key, value) {
|
||||
if( !gKindONames.containsKey(value.event.eventData.pubkey)) {
|
||||
gKindONames[value.event.eventData.pubkey] = UserNameInfo(null, null, null, null, null, null );
|
||||
gKindONames[value.event.eventData.pubkey] = UserNameInfo(null, null, null, null, null, null, null );
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user