fixed broken shutdown command

master
Kevin Froman 2018-05-02 20:14:00 -05:00
parent 98dac40139
commit 1a02124122
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 4 additions and 4 deletions

View File

@ -137,6 +137,7 @@ class API:
resp = Response('Hello, World! ' + request.host)
elif action == 'shutdown':
# request.environ.get('werkzeug.server.shutdown')()
self.http_server.stop()
resp = Response('Goodbye')
elif action == 'ping':
resp = Response('pong')
@ -151,7 +152,6 @@ class API:
self.mimeType = 'text/html'
response = siteData.split(b'-', 2)[-1]
resp = Response(response)
else:
resp = Response('(O_o) Dude what? (invalid command)')
endTime = math.floor(time.time())
@ -257,8 +257,8 @@ class API:
logger.info('Starting client on ' + self.host + ':' + str(bindPort) + '...', timestamp=True)
try:
http_server = WSGIServer((self.host, bindPort), app)
http_server.serve_forever()
self.http_server = WSGIServer((self.host, bindPort), app)
self.http_server.serve_forever()
except KeyboardInterrupt:
pass
#app.run(host=self.host, port=bindPort, debug=False, threaded=True)

View File

@ -23,7 +23,7 @@
import sys
if sys.version_info[0] == 2 or sys.version_info[1] < 5:
print('Error, Onionr requires Python 3.4.x+')
print('Error, Onionr requires Python 3.4+')
sys.exit(1)
import os, base64, random, getpass, shutil, subprocess, requests, time, platform, datetime, re
from threading import Thread