mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-27 09:28:56 +01:00
Merge pull request #536 from JeLuF/serverip
Show network addresses in system settings
This commit is contained in:
commit
65102bb64d
@ -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.
|
||||
|
@ -254,6 +254,14 @@
|
||||
<h3><i class="fa fa-microchip icon"></i> System Info</h3>
|
||||
<div id="system-info"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h3><i class="fa fa-solid fa-network-wired icon"></i> Server Address</h3>
|
||||
<p>You can access Stable Diffusion UI from other devices in your network. To do this, enable network access in the settings
|
||||
above, and open Stable Diffusion UI in a browser using the server's IP. You can use this button to get your server's address.</p>
|
||||
<button id="get-server-ip" class="primaryButton">Get Server IP</button>
|
||||
<div id="ip-info"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-content-about" class="tab-content">
|
||||
|
@ -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%;
|
||||
}
|
||||
|
@ -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 = "<h4>List of server addresses</h4><p>If there is more than one result, not all of them might be reachable from other devices.</p><div>"
|
||||
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+=`<div><a href="${url}">${url}</a></div>`;})
|
||||
list += "</div>"
|
||||
ipInfoContainer.innerHTML = list
|
||||
})
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user