cosmetics:

* fix toast/tooltip colors on splashpage
* properly warn if --ah-cli or --ah-gen is used without --ah-alg
* support ^D during --ah-cli
* improve flavor texts
This commit is contained in:
ed 2023-11-03 16:52:43 +00:00
parent 76afb62b7b
commit 95566e8388
4 changed files with 30 additions and 13 deletions

View file

@ -1094,7 +1094,7 @@ def add_logging(ap):
ap2.add_argument("--ansi", action="store_true", help="force colors; overrides environment-variable NO_COLOR") ap2.add_argument("--ansi", action="store_true", help="force colors; overrides environment-variable NO_COLOR")
ap2.add_argument("--no-voldump", action="store_true", help="do not list volumes and permissions on startup") ap2.add_argument("--no-voldump", action="store_true", help="do not list volumes and permissions on startup")
ap2.add_argument("--log-tdec", metavar="N", type=int, default=3, help="timestamp resolution / number of timestamp decimals") ap2.add_argument("--log-tdec", metavar="N", type=int, default=3, help="timestamp resolution / number of timestamp decimals")
ap2.add_argument("--log-badpwd", metavar="N", type=int, default=1, help="log passphrase of failed login attempts: 0=terse, 1=plaintext, 2=hashed") ap2.add_argument("--log-badpwd", metavar="N", type=int, default=1, help="log failed login attempt passwords: 0=terse, 1=plaintext, 2=hashed")
ap2.add_argument("--log-conn", action="store_true", help="debug: print tcp-server msgs") ap2.add_argument("--log-conn", action="store_true", help="debug: print tcp-server msgs")
ap2.add_argument("--log-htp", action="store_true", help="debug: print http-server threadpool scaling") ap2.add_argument("--log-htp", action="store_true", help="debug: print http-server threadpool scaling")
ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="dump incoming header") ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="dump incoming header")
@ -1314,7 +1314,7 @@ def run_argparse(
for k, h, t in sects: for k, h, t in sects:
k2 = "help_" + k.replace("-", "_") k2 = "help_" + k.replace("-", "_")
if vars(ret)[k2]: if vars(ret)[k2]:
lprint("# {} help page".format(k)) lprint("# %s help page (%s)" % (k, h))
lprint(t + "\033[0m") lprint(t + "\033[0m")
sys.exit(0) sys.exit(0)

View file

@ -1723,6 +1723,9 @@ class AuthSrv(object):
def setup_pwhash(self, acct: dict[str, str]) -> None: def setup_pwhash(self, acct: dict[str, str]) -> None:
self.ah = PWHash(self.args) self.ah = PWHash(self.args)
if not self.ah.on: if not self.ah.on:
if self.args.ah_cli or self.args.ah_gen:
t = "\n BAD CONFIG:\n cannot --ah-cli or --ah-gen without --ah-alg"
raise Exception(t)
return return
if self.args.ah_cli: if self.args.ah_cli:

View file

@ -136,8 +136,12 @@ class PWHash(object):
import getpass import getpass
while True: while True:
p1 = getpass.getpass("password> ") try:
p2 = getpass.getpass("again or just hit ENTER> ") p1 = getpass.getpass("password> ")
p2 = getpass.getpass("again or just hit ENTER> ")
except EOFError:
return
if p2 and p1 != p2: if p2 and p1 != p2:
print("\033[31minputs don't match; try again\033[0m", file=sys.stderr) print("\033[31minputs don't match; try again\033[0m", file=sys.stderr)
continue continue

View file

@ -1,3 +1,18 @@
:root {
--fg: #ccc;
--fg-max: #fff;
--bg-u2: #2b2b2b;
--bg-u5: #444;
}
html.y {
--fg: #222;
--fg-max: #000;
--bg-u2: #f7f7f7;
--bg-u5: #ccc;
}
html.bz {
--bg-u2: #202231;
}
@font-face { @font-face {
font-family: 'scp'; font-family: 'scp';
font-display: swap; font-display: swap;
@ -14,6 +29,7 @@ html {
max-width: min(34em, 90%); max-width: min(34em, 90%);
max-width: min(34em, calc(100% - 7em)); max-width: min(34em, calc(100% - 7em));
color: #ddd; color: #ddd;
color: var(--fg);
background: #333; background: #333;
background: var(--bg-u2); background: var(--bg-u2);
border: 0 solid #777; border: 0 solid #777;
@ -171,24 +187,15 @@ html {
color: #f6a; color: #f6a;
} }
html.y #tt { html.y #tt {
color: #333;
background: #fff;
border-color: #888 #000 #777 #000; border-color: #888 #000 #777 #000;
} }
html.bz #tt { html.bz #tt {
background: #202231;
border-color: #3b3f58; border-color: #3b3f58;
} }
html.y #tt, html.y #tt,
html.y #toast { html.y #toast {
box-shadow: 0 .3em 1em rgba(0,0,0,0.4); box-shadow: 0 .3em 1em rgba(0,0,0,0.4);
} }
html.y #tt code {
color: #fff;
color: var(--fg-max);
background: #060;
background: var(--bg-u5);
}
#modalc code { #modalc code {
color: #060; color: #060;
background: transparent; background: transparent;
@ -326,6 +333,9 @@ html.y .btn:focus {
box-shadow: 0 .1em .2em #037 inset; box-shadow: 0 .1em .2em #037 inset;
outline: #037 solid .1em; outline: #037 solid .1em;
} }
input[type="submit"] {
cursor: pointer;
}
input[type="text"]:focus, input[type="text"]:focus,
input:not([type]):focus, input:not([type]):focus,
textarea:focus { textarea:focus {