-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alexgithublab: change time, 3.0 (supersedes #1737) #1748
Alexgithublab: change time, 3.0 (supersedes #1737) #1748
Conversation
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Signed-off-by: Thierry Laurion <insurgo@riseup.net> Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…ove unneeded duplicate menu options to change system time Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Use local named variables instead of $1-$4 throughout the function. This makes the implementation clearer and documents the usage. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
…e leading zeroes Allow Backspace in input. It's really frustrating otherwise if a typo cannot be corrected, and worse, the backspace key actually produces a character that becomes part of the input. Complete input with Enter. It is surprising when the script just moves on right away once a fourth/second digit is entered, and worse, users expecting to press Enter could reasonably press it before realizing the script did not require it, which then skips the _next_ prompt inadvertently. Users with imperfect typing might double a digit unintentionally, do not force them to proceed with an incorrect value. Removing '-n $digits' from read does both of those. Add '-r' so backslashes do not have unexpected behavior. Don't require leading zeroes, zero-pad automatically. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
There's no need to try to parse stdout/stderr to figure out if date succeeded, just check if it was successful directly. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
There's little value to offering the minimum field value as a default IMO: * it's rarely accurate (e.g. minute 00 is only accuate 1/60 of the time) * it's very obvious to just press '0'<enter> instead (and no longer needs to be '00') * it eliminates a lot of wordiness you otherwise have to read (or more likely, ignore) Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
Infer digits from the length of the maximum value. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
…of recurse Ask whether to retry instead of always retrying, so users can escape if there is a problem setting the date instead of being forced to enter values until it works. Ask to press Enter instead of "any key". "Any key" prompts are generally misleading, because there are usually keys that won't actually work (e.g. Ctrl, Caps Lock, Shift). Loop to retry if setting the date fails instead of recursing. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
Adjust prompt wording when entering fields. Technically the desired value isn't always between min/max, because min and max are also acceptable :) No need to repeat an incorrect value, it is right there on the screen and it dilutes the important point describing what value is needed. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
We're trying to move all shell scripts to including '.sh' to differentiate them from functions. While it's not 100% consistent yet, do it for new scripts. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This was a yes/no prompt but didn't actually have a question in it, ask if the user wants to change the time. Include the current time so the user can tell if it's correct. Mention that if it's incorrect they should change the time and check again. The first line was too long for fbwhiptail by a few characters, trim it a little. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
Will run and take screenshots in next hours (I think this is good habit to take when we change UX) |
@JonathonHall-Purism unfortunately inconsistent ! |
@JonathonHall-Purism Also, current date should be given in expected format so user knows approximately which offset he needs to work agaist to resolve current time drift causing TOTP mismatch as said under #1737 (comment) for @alexgithublab to address. |
Wow, nice catch on the octal shenanigans, will fix that 💯 |
What would you suggest? The current prompt displays the numbers in the same order that we prompt for them. E.g. it says: `The current UTC time is: 2024-08-06 16:33:16 UTC" You would enter:
I suppose there's a redundant "UTC" there that's not needed. Is there something else you'd suggest to change? |
printf was interpreting these as invalid octal numbers, they're decimal. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
The time zone in Heads is always UTC and we mentioned that in the text. Don't repeat it. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
That would be perfect, nothing more needed, just a reminder of the time just prior of entering the time in UTC format (normally its minutes and seconds that are problematic with time drift if CMOS battery not garbage), which most end users will need to fix manually. So simple timestamp is fine. Testing last changes and outputting UX changes and report if ok. If ok, will merge. |
@JonathonHall-Purism just a timestamp reminder where %Z is already giving UTC would be fine, but missing |
Nevermind clarified below, we're adding a reminder of the system's configured time when setting the time |
Show the system time when starting to change the time. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
@JonathonHall-Purism I took liberty to add UX screenshot in OP. Merging |
@JonathonHall-Purism @alexgithublab thanks! This improves TOTP mismatch manual resolution a lot (setting date+time manually reducing friction)! Merged! |
@JonathonHall-Purism @tlaurion No problem, I'm happy to help and thank you for improving my code. |
Nice work on this under #1737 @alexgithublab and @tlaurion . I made some improvements:
UX
Scripting
Approved changes of UX, new prompt looks like