[+] add auto addr search for public, http-server

This commit is contained in:
Siarhei Siniak 2025-04-21 17:45:53 +03:00
parent a912e1b6bf
commit dc39583cc6
3 changed files with 19 additions and 1 deletions

@ -1215,6 +1215,21 @@ def http_server(argv):
assert options.port >= 1 assert options.port >= 1
try: try:
if options.public and options.host == '0.0.0.0':
found : bool = False
for o in commands_os.interfaces_index():
if found:
break
for o2 in o.addr_info:
if o2.family == 'inet' and o2.local != '127.0.0.1':
options.host = o2.local
logger.info(dict(
host=options.host,
msg='found',
))
found = True
break
assert not socket.inet_aton(options.host) is None assert not socket.inet_aton(options.host) is None
# subprocess.check_call([ # subprocess.check_call([
# 'ping', '-w', '1', # 'ping', '-w', '1',

@ -1,6 +1,6 @@
[project] [project]
name = 'online.fxreader.pr34' name = 'online.fxreader.pr34'
version = '0.1.5.9+27.2' version = '0.1.5.9+27.3'
dependencies = [ dependencies = [
#"-r requirements.txt", #"-r requirements.txt",

Binary file not shown.