mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-03-27 02:01:51 +01:00
Merge branch 'main' into patch-1
This commit is contained in:
commit
6453ec7f2f
@ -115,7 +115,7 @@ usage: dart run bin/nostr_console.dart [OPTIONS]
|
||||
|
||||
Advanced
|
||||
-y, --difficulty <number> The difficulty number in bits, only for kind 1 messages. The next larger number divisible by 4 is
|
||||
taken as difficulty. Can't be more than 24 bits, because otherwise it typically takes too much
|
||||
taken as difficulty. Can't be more than 32 bits, because otherwise it typically takes too much
|
||||
time. Minimum and default is 0, which means no difficulty.
|
||||
-e, --overwrite Will over write the file with all the events that were read from file, and all newly received. Is
|
||||
useful when the file has to be cleared of old unused events. A backup should be made just in case
|
||||
|
@ -380,21 +380,20 @@ Future<void> main(List<String> arguments) async {
|
||||
}
|
||||
|
||||
// get only limited number of contacts otherwise relays get less responsive
|
||||
int maxContactsFetched = 500;
|
||||
int maxContactsFetched = 700;
|
||||
if( contacts.length > maxContactsFetched) {
|
||||
int i = 0;
|
||||
contacts.retainWhere((element) => i++ > maxContactsFetched); // retain only first 200, whichever they may be
|
||||
contacts.retainWhere((element) => i++ < maxContactsFetched); // retain only first 200, whichever they may be
|
||||
}
|
||||
|
||||
getMultiUserEvents(gListRelayUrls2, contacts.union(gDefaultFollows).union(pTags).difference(usersFetched), 4 * limitPerSubscription, getSecondsDaysAgo(limitOthersEvents));
|
||||
usersFetched = usersFetched.union(gDefaultFollows).union(contacts).union(pTags);
|
||||
|
||||
// get meta events of all users fetched
|
||||
getMultiUserEvents(gListRelayUrls1, usersFetched, 4 * limitPerSubscription, getSecondsDaysAgo(limitSelfEvents*2), {0,3});
|
||||
getMultiUserEvents(gListRelayUrls1, usersFetched, 10 * limitPerSubscription, getSecondsDaysAgo(limitSelfEvents*100), {0,3});
|
||||
//print("fetched meta of ${usersFetched.length}");
|
||||
|
||||
|
||||
|
||||
void resetRelays() {
|
||||
relays.closeAll();
|
||||
|
||||
@ -421,12 +420,12 @@ Future<void> main(List<String> arguments) async {
|
||||
|
||||
String req = '["REQ","latest_live_all",{"limit":40000,"kinds":[0,1,3,4,5,6,7,40,41,42,104,140,141,142],"since":${getTimeSecondsAgo(gSecsLatestLive).toString()}}]';
|
||||
sendRequest(gListRelayUrls1, req);
|
||||
//getMultiUserEvents(gListRelayUrls1, usersFetched, 10 * limitPerSubscription, getSecondsDaysAgo(limitSelfEvents*100), {0,3});
|
||||
|
||||
// Create tree from all events that's have yet been received/accumulated
|
||||
Store node = getTree(initialEvents);
|
||||
gStore = node;
|
||||
|
||||
clearEvents();
|
||||
|
||||
mainMenuUi(node);
|
||||
});
|
||||
});
|
||||
|
@ -1325,7 +1325,7 @@ Future<void> socialMenuUi(Store node) async {
|
||||
|
||||
switch(option) {
|
||||
case 1:
|
||||
bool selectorTrees_followActionsNoNotifications (Tree t) => t.treeSelectorUserPostAndLike(getFollows( userPublicKey), enableNotifications: false);
|
||||
bool selectorTrees_followActionsNoNotifications (Tree t) => t.treeSelectorUserPostAndLike(getFollows( userPublicKey).union(gDefaultFollows).union({userPublicKey}), enableNotifications: false);
|
||||
node.printStoreTrees(0, DateTime.now().subtract(Duration(hours:gHoursDefaultPrint)), selectorTrees_followActionsNoNotifications);
|
||||
await processAnyIncomingEvents(node, true);
|
||||
break;
|
||||
|
@ -3,7 +3,7 @@ import 'package:logging/logging.dart';
|
||||
|
||||
// name of executable
|
||||
const String exename = "nostr_console";
|
||||
const String version = "0.3.4-beta";
|
||||
const String version = "0.3.5-beta";
|
||||
|
||||
int gDebug = 0;
|
||||
int gSpecificDebug = 0;
|
||||
@ -53,14 +53,21 @@ String defaultServerUrl = "wss://relay.damus.io";
|
||||
const String relayNostrInfo = 'wss://relay.nostr.info';
|
||||
|
||||
Set<String> gListRelayUrls1 = { defaultServerUrl,
|
||||
relayNostrInfo,
|
||||
"wss://nostr-2.zebedee.cloud",
|
||||
//relayNostrInfo,
|
||||
//"wss://nostr-2.zebedee.cloud",
|
||||
"wss://nostr.semisol.dev",
|
||||
"wss://nostr.coinos.io",
|
||||
//"wss://nostr.coinos.io",
|
||||
"wss://nostr-relay.wlvs.space",
|
||||
"wss://nostr-relay.digitalmob.ro",
|
||||
"wss://nostr.drss.io",
|
||||
"wss://nostr.radixrat.com",
|
||||
"wss://relay.nostr.ch"
|
||||
"wss://relay.nostr.ch",
|
||||
|
||||
// added on 17 jan 2023 after testing using test_servers.sh
|
||||
"wss://nostr.rdfriedl.com",
|
||||
"wss://nostr-pub.wellorder.net",
|
||||
"wss://nostrrelay.com"
|
||||
|
||||
};
|
||||
|
||||
Set<String> gListRelayUrls2 = {
|
||||
@ -340,7 +347,7 @@ usage: $exename [OPTIONS]
|
||||
|
||||
Advanced
|
||||
-y, --difficulty <number> The difficulty number in bits, only for kind 1 messages. Tne next larger number divisible
|
||||
by 4 is taken as difficulty. Can't be more than 24 bits, because otherwise it typically
|
||||
by 4 is taken as difficulty. Can't be more than 32 bits, because otherwise it typically
|
||||
takes too much time. Minimum and default is 0, which means no difficulty.
|
||||
-e, --overwrite Will over write the file with all the events that were read from file, and all newly
|
||||
received. Is useful when the file has to be cleared of old unused events. A backup should
|
||||
@ -352,23 +359,16 @@ const String helpAndAbout =
|
||||
HOW TO USE
|
||||
----------
|
||||
|
||||
* When entering a event you want to reply to, you need to enter only the first few letters of the event-id. Lets say the event is
|
||||
Check out the main readme, wiki and discussions on github.com/vishalxl/nostr_console
|
||||
|
||||
+-------+
|
||||
|Author : vishalxl id: 6c1 Time: 07:48 PM Aug 24, 2022
|
||||
|Message: example comment or post or reply
|
||||
|
||||
The event id of this event is 6c1.
|
||||
|
||||
When the UI asks for an event id, you can just enter 6c1, and press enter. Then the program will find the most recent event in its memory
|
||||
with this prefix as its id, and send a reply/like to it. It is possible that some other event has the same 3 letter prefix, and is printed
|
||||
later than your own event, in which case a different event will get a reply/like. But the odds of that happening are very low if the event
|
||||
you are replying to is not too old.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
To 'login' as a user with private key K:
|
||||
|
||||
\$ nostr_console.exe --prikey=K
|
||||
|
||||
To get ALL the latest messages for last 3 days (on linux bash which allows backtick execution):
|
||||
|
||||
\$ nostr_console.exe --request=`echo "[\\"REQ\\",\\"l\\",{\\"since\\":\$(date -d \\'-3 day\\' +%s)}]"`
|
||||
|
@ -576,7 +576,7 @@ class Tree {
|
||||
|
||||
if( checkChildrenToo ) {
|
||||
for( int i = 0; i < children.length; i++ ) {
|
||||
if( children[i].treeSelectorUserPostAndLike(pubkeys)) {
|
||||
if( children[i].treeSelectorUserPostAndLike(pubkeys, enableNotifications: enableNotifications)) {
|
||||
childMatches = true;
|
||||
}
|
||||
}
|
||||
@ -1641,6 +1641,8 @@ class Store {
|
||||
static List<int> printTopPost(Tree topTree, int depth, DateTime newerThan, [int maxToPrint = gMaxEventsInThreadPrinted]) {
|
||||
stdout.write(Store.startMarkerStr);
|
||||
|
||||
//if(topTree.event.eventData.isNotification) print('is notification');
|
||||
|
||||
List<int> counts = topTree.printTree(depth, newerThan, true, 0, maxToPrint);
|
||||
counts[0] += 1; // for this top post
|
||||
stdout.write(endMarkerStr);
|
||||
|
11
pubspec.yaml
11
pubspec.yaml
@ -1,14 +1,23 @@
|
||||
name: nostr_console
|
||||
description: A multi-platform nostr client built for terminal/console
|
||||
version: 0.3.4-beta
|
||||
version: 0.3.5-beta
|
||||
homepage: https://github.com/vishalxl/nostr_console
|
||||
|
||||
|
||||
# 0.3.5
|
||||
# fix for crash in issue #70
|
||||
# improved highlighted events code in 2->1
|
||||
# in 2->1 printed popular accounts with follows
|
||||
# difficulty limit set to 32
|
||||
# added three new relays and removed some older ones
|
||||
# fixed fetching of contact names ( now all are fetched whereas previously they werent)
|
||||
|
||||
# 0.3.4
|
||||
# improved logic that only new events from follows are shown; this reduces the flood of notifications seen
|
||||
# longer-named follows were not getting tick mark at end. fixed it, now they get tick marks in posts, channels and in one liners for channels
|
||||
# fix lud06/16 qr code printing in profiles
|
||||
# ask user y/n to avoid overwriting contact list if no contact list is seen for user
|
||||
# saved dm's sent to user
|
||||
|
||||
# 0.3.3
|
||||
# Linux arm64 build added; docker images pushed to github store; and improving of build process by @AaronDewes
|
||||
|
@ -1,6 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# writes hello to a group
|
||||
# echo '\n' ; for line in `cowsay hi` ; do echo -e "${line}\\\n" ; done
|
||||
|
||||
IFS=$'\n'
|
||||
channel=test99
|
||||
{ echo -e "3\n1\n${channel}\nHello, this is a random test.\nx\nx\nx" ; cat /dev/stdin; } | ./nostr_console_ubuntu_x64 --prikey=`openssl rand -hex 32`
|
||||
# { echo -e "3\n1\n${channel}\nHello, this is a random test.\nx\nx\nx" ; cat /dev/stdin; } | ./nostr_console_ubuntu_x64 --prikey=`openssl rand -hex 32`
|
||||
|
||||
|
||||
# \n\n.____ \n< hi > \n ---- \n \\\n ^__^ \n (oo)_______ \n (__) )/ \n ||----w | \n || || \n
|
||||
message=""
|
||||
message=$message'\n' ; for line in `cowsay hi` ; do message=$message"${line} \n" ; done
|
||||
echo $message
|
||||
{ echo -e "3\n1\n${channel}\nHello, this is a random test.\nx\nx\nx" ; cat /dev/stdin; } | ./nostr_console --prikey=`openssl rand -hex 32`
|
Loading…
x
Reference in New Issue
Block a user