Show network addresses in system settings

Users sometimes struggle to get the IP address of their PC. This PR adds a button to the system settings pane that will list the server's IP
addresses.
This commit is contained in:
JeLuF
2022-11-23 11:25:36 +01:00
parent 80ecb82cc2
commit f1fa10badd
5 changed files with 39 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import traceback
import sys
import os
import socket
import picklescan.scanner
import rich
@ -286,6 +287,9 @@ def getUIPlugins():
return plugins
def getIPConfig():
return socket.gethostbyname_ex(socket.getfqdn())
@app.get('/get/{key:path}')
def read_web_data(key:str=None):
if not key: # /get without parameters, stable-diffusion easter egg.
@ -305,6 +309,7 @@ def read_web_data(key:str=None):
elif key == 'modifiers': return FileResponse(os.path.join(SD_UI_DIR, 'modifiers.json'), headers=NOCACHE_HEADERS)
elif key == 'output_dir': return JSONResponse({ 'output_dir': outpath }, headers=NOCACHE_HEADERS)
elif key == 'ui_plugins': return JSONResponse(getUIPlugins(), headers=NOCACHE_HEADERS)
elif key == 'ip_config': return JSONResponse(getIPConfig(), headers=NOCACHE_HEADERS)
else:
raise HTTPException(status_code=404, detail=f'Request for unknown {key}') # HTTP404 Not Found