Fix for flaskwebgui
This commit is contained in:
parent
f112fc3493
commit
2964175d8b
|
@ -2068,7 +2068,7 @@ def index():
|
|||
if 'new_ui' in request.args:
|
||||
return render_template('index_new.html', hide_ai_menu=args.noaimenu)
|
||||
else:
|
||||
return render_template('index.html', hide_ai_menu=args.noaimenu)
|
||||
return render_template('index.html', hide_ai_menu=args.noaimenu, flaskwebgui=vars.flaskwebgui)
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
return send_from_directory(app.root_path,
|
||||
|
@ -5913,7 +5913,7 @@ if __name__ == "__main__":
|
|||
from flaskwebgui import FlaskUI
|
||||
vars.serverstarted = True
|
||||
vars.flaskwebgui = True
|
||||
FlaskUI(app, socketio=socketio, start_server="flask-socketio", maximized=True, close_server_on_exit=False).run()
|
||||
FlaskUI(app, socketio=socketio, start_server="flask-socketio", maximized=True, close_server_on_exit=True).run()
|
||||
except:
|
||||
import webbrowser
|
||||
webbrowser.open_new('http://localhost:{0}'.format(port))
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
async function getRequest(url='') {
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
cache: 'no-cache'
|
||||
})
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
let url = document.location
|
||||
let route = "/flaskwebgui-keep-server-alive";
|
||||
let interval_request = 3 * 1000; //sec
|
||||
|
||||
function keep_alive_server(){
|
||||
getRequest(url + route);
|
||||
}
|
||||
|
||||
setInterval(keep_alive_server, interval_request);
|
||||
|
||||
})
|
|
@ -19,6 +19,9 @@
|
|||
<script src="static/rangy-core.min.js"></script>
|
||||
<script src="static/application.js?ver=1.18.1b"></script>
|
||||
<script src="static/favicon.js"></script>
|
||||
{% if flaskwebgui %}
|
||||
<script src="static/flask_web_gui.js"></script>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<input type="file" id="remote-save-select" accept="application/json" style="display:none">
|
||||
|
|
Loading…
Reference in New Issue