add host option

This commit is contained in:
izenburnor 2020-06-03 11:59:43 +01:00
parent 4e544ab257
commit a6454a10ac

View file

@ -267,10 +267,10 @@ def openDownloadsFolder():
elif sys.platform == 'win32': elif sys.platform == 'win32':
subprocess.check_call(['explorer', folder]) subprocess.check_call(['explorer', folder])
def run_server(port, portable=None): def run_server(port, host, portable=None):
app.initialize(portable) app.initialize(portable)
print("Starting server at http://127.0.0.1:" + str(port)) print("Starting server at http://" + host + ":" + str(port))
socketio.run(server, host='0.0.0.0', port=port) socketio.run(server, host=host, port=port)
if __name__ == '__main__': if __name__ == '__main__':
@ -284,4 +284,8 @@ if __name__ == '__main__':
portable = path.join(path.dirname(path.realpath(__file__)), 'config') portable = path.join(path.dirname(path.realpath(__file__)), 'config')
else: else:
portable = None portable = None
run_server(port, portable) if '--host' in sys.argv:
host = str(sys.argv[sys.argv.index("--host")+1])
else:
host = "0.0.0.0"
run_server(port, host, portable)