mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-10-11 11:52:47 +02:00
fix for issue #49 by exiting if too many wrong menu input given
> 40 for now
This commit is contained in:
@@ -117,13 +117,17 @@ To 'login' as a user with private key K:
|
||||
nostr_console.exe --prikey=K
|
||||
```
|
||||
|
||||
|
||||
To get ALL the latest messages on relays for last 3 days (on bash shell which allows backtick execution), for user with private key K:
|
||||
|
||||
```
|
||||
nostr_console.exe --prikey=K --request=`echo "[\"REQ\",\"l\",{\"since\":$(date -d '-3 day' +%s)}]"`
|
||||
```
|
||||
|
||||
To get all encrypted messages:
|
||||
```
|
||||
./nostr_console_elf64 --prikey=K --request='["REQ","cn",{"limit":20000,"kinds":[104,140,141,142],"since":1663417739}]' # run on linux/bash
|
||||
```
|
||||
|
||||
# Configuring Proxy
|
||||
When you are in an network which blocks outgoing HTTPS (e.g. company firewall), but there is a proxy you can set environment variable before running nostr_console.
|
||||
Examples below use authentication. Drop username:password if not required.
|
||||
|
@@ -448,6 +448,8 @@ int showMenu(List<String> menuOptions, String menuName, [String menuInfo = ""])
|
||||
if( valueOption >= 1 && valueOption <= menuOptions.length) {
|
||||
reAdjustAlignment(); // in case user has changed alignment
|
||||
print('You picked: $valueOption');
|
||||
// reset this
|
||||
gInvalidInputCount = 0;
|
||||
return valueOption;
|
||||
}
|
||||
}
|
||||
@@ -458,6 +460,13 @@ int showMenu(List<String> menuOptions, String menuName, [String menuInfo = ""])
|
||||
}
|
||||
}
|
||||
printWarning("\nInvalid option. Kindly try again. The valid options are from 1 to ${menuOptions.length}");
|
||||
gInvalidInputCount++;
|
||||
|
||||
if( gInvalidInputCount > gMaxInValidInputAccepted) {
|
||||
printWarning("The program has received an invalid input more than $gMaxInValidInputAccepted. There seems to be some problem etc, so exiting");
|
||||
exit(0);
|
||||
//programExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1576,3 +1585,12 @@ Future<void> mainMenuUi(Store node) async {
|
||||
} // end while
|
||||
} // end mainMenuUi()
|
||||
|
||||
|
||||
Future<void> programExit([String message= ""]) async {
|
||||
if( gEventsFilename != "") {
|
||||
await gStore?.writeEventsToFile(gEventsFilename);
|
||||
}
|
||||
print("In programexit");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@@ -187,6 +187,10 @@ const int gEventLenPrinted = 6;
|
||||
// used in word/event search
|
||||
const int gMinEventIdLenInSearch = gEventLenPrinted;
|
||||
|
||||
// invalid int handling
|
||||
int gInvalidInputCount = 0;
|
||||
const int gMaxInValidInputAccepted = 40;
|
||||
|
||||
// https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
|
||||
// Color related settings
|
||||
const String defaultTextColor = "green";
|
||||
|
@@ -7,7 +7,7 @@ homepage: https://github.com/vishalxl/nostr_console
|
||||
# improved 2 -> 5. better printing. and fixed white after reaction highlighed issue
|
||||
# improved 2 -> 6 too, now follows posts get highlighed, and so do their reactions.
|
||||
# mentions get highlighed in above menus
|
||||
|
||||
# if too many wrong menu inputs are given ( >40) then program exits without saving any new events. for issue #49
|
||||
|
||||
# 0.3.0
|
||||
# added check marks; added more default users
|
||||
|
Reference in New Issue
Block a user