diff --git a/CHANGES.md b/CHANGES.md
index e6bf4d1a..c581eda6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,8 +20,10 @@
- Lots of minor bug fixes
- A `What's New?` tab in the UI
- Ask for a confimation before clearing the results pane or stopping a render task. The dialog can be skipped by holding down the shift key while clicking on the button.
+- Show the network addresses of the server in the systems setting dialog
### Detailed changelog
+* 2.4.17 - 30 Nov 2022 - Show the network addresses of the server in the systems setting dialog
* 2.4.17 - 30 Nov 2022 - Confirm before stopping or clearing all the tasks
* 2.4.16 - 29 Nov 2022 - Bug fixes for SD 2.0 - remove the need for patching, default to SD 1.4 model if trying to load an SD2 model in SD1.4.
* 2.4.15 - 25 Nov 2022 - Experimental support for SD 2.0. Uses lots of memory, not optimized, probably GPU-only.
diff --git a/ui/index.html b/ui/index.html
index 153b18c4..bce3579c 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -254,6 +254,14 @@
diff --git a/ui/media/css/main.css b/ui/media/css/main.css
index b1af0b16..a08cfc85 100644
--- a/ui/media/css/main.css
+++ b/ui/media/css/main.css
@@ -1015,3 +1015,9 @@ button:active {
button#save-system-settings-btn {
padding: 4pt 8pt;
}
+#ip-info a {
+ color:var(--text-color)
+}
+#ip-info div {
+ line-height: 200%;
+}
diff --git a/ui/media/js/parameters.js b/ui/media/js/parameters.js
index 7eaee64e..f8b1aaa4 100644
--- a/ui/media/js/parameters.js
+++ b/ui/media/js/parameters.js
@@ -219,6 +219,10 @@ let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_ac
let saveSettingsBtn = document.querySelector('#save-system-settings-btn')
+let getServerIPBtn = document.querySelector('#get-server-ip')
+let ipInfoContainer = document.querySelector('#ip-info')
+
+
async function changeAppConfig(configDelta) {
try {
let res = await fetch('/app_config', {
@@ -403,3 +407,17 @@ saveSettingsBtn.addEventListener('click', function() {
saveSettingsBtn.classList.add('active')
asyncDelay(300).then(() => saveSettingsBtn.classList.remove('active'))
})
+
+getServerIPBtn.addEventListener('click', async function() {
+ ipInfoContainer.innerHTML = "Retrieving server addresses..."
+ let list = "
List of server addresses
If there is more than one result, not all of them might be reachable from other devices.
"
+ let res = await fetch('/get/ip_config')
+ let data = await res.json()
+ let port = listenPortField.value
+ // Merge hostname (field 0) into list of IPs (field 2)
+ data[2].push(data[0])
+ data[2].forEach((addr) => { let url=`http://${addr}:${port}/`; list+=`
`;})
+ list += "
"
+ ipInfoContainer.innerHTML = list
+})
+
diff --git a/ui/server.py b/ui/server.py
index fca1aca8..af8cf77a 100644
--- a/ui/server.py
+++ b/ui/server.py
@@ -7,6 +7,7 @@ import traceback
import sys
import os
+import socket
import picklescan.scanner
import rich
@@ -305,6 +306,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.
@@ -324,6 +328,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