revision: proxy support, and map the delete-key

* option to specify list of known proxy IPs; any connections coming
   from these IPs will be forced through the config wizard, to avoid
   mixing up client configs

* the delete-key now works as expected in most clients
This commit is contained in:
ed 2024-03-30 01:00:24 +00:00
parent 7c82c316f2
commit f8780fef2e
2 changed files with 16 additions and 0 deletions

View File

@ -49,6 +49,7 @@ def optgen(ap, pwd):
ac.add_argument("-pw", metavar="PWD", type=u, default=pwd, help="admin password")
ac.add_argument("--ara", action="store_true", help="admin-access requires auth (even for localhost)")
ac.add_argument("--nsalt", metavar="TXT", type=u, default="lammo/", help="salt for generated nicknames based on IP")
ac.add_argument("--proxy", metavar="A,A", type=u, default="", help="comma-sep. list of IPs which are relays to disable config persistence on")
ac = ap.add_argument_group("logging")
ac.add_argument("--log-rx", action="store_true", help="log incoming traffic from clients")
@ -197,6 +198,8 @@ class Core(object):
rap = run_ap
ar = self.ar = rap(argv, pwd) # type: argparse.Namespace
ar.proxy = ar.proxy.split(",")
Util.HEX_WIDTH = ar.hex_w
Itelnet.init(ar)

View File

@ -485,6 +485,9 @@ class VT100_Client(object):
self.user.admin = self.adr[0] == "127.0.0.1" and not self.ar.ara
try:
if self.adr[0] in self.ar.proxy:
raise Exception()
(
ts,
nick,
@ -2884,6 +2887,16 @@ class VT100_Client(object):
self.user.exec_cmd("a")
elif act == "tab":
self.tabcomplete()
elif act == "del":
self.linepos += 1
if self.linepos > len(self.linebuf):
self.linepos = len(self.linebuf)
if self.linepos > 0:
self.linebuf = (
self.linebuf[: self.linepos - 1]
+ self.linebuf[self.linepos :]
)
self.linepos -= 1
else:
print("unimplemented action: {0}".format(act))