forked from aaPanel/BaoTa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
199 changed files
with
19,797 additions
and
9,618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,20 @@ | |
# +------------------------------------------------------------------- | ||
# | Author: hwliang <[email protected]> | ||
# +------------------------------------------------------------------- | ||
from gevent import monkey,__version__ as gevent_version | ||
from gevent import monkey | ||
monkey.patch_all() | ||
import os,sys,ssl | ||
if os.path.exists("/www/server/panel/class/BTPanel"): | ||
os.system("rm -rf /www/server/panel/class/BTPanel") | ||
os.chdir('/www/server/panel') | ||
if not 'class/' in sys.path: | ||
sys.path.insert(0,'class/') | ||
from BTPanel import app,sys,public | ||
|
||
if __name__ == '__main__': | ||
pid = os.fork() | ||
if pid: sys.exit(0) | ||
|
||
#os.umask(0) | ||
os.setsid() | ||
|
||
_pid = os.fork() | ||
|
@@ -34,9 +37,6 @@ if __name__ == '__main__': | |
if os.path.exists('data/ipv6.pl'): | ||
HOST = "0:0:0:0:0:0:0:0" | ||
f.close() | ||
|
||
from gevent.pywsgi import WSGIServer | ||
from geventwebsocket.handler import WebSocketHandler | ||
|
||
is_debug = os.path.exists('data/debug.pl') | ||
keyfile = 'ssl/privateKey.pem' | ||
|
@@ -50,11 +50,21 @@ if __name__ == '__main__': | |
os.dup2(err_f.fileno(),sys.stderr.fileno()) | ||
err_f.close() | ||
|
||
import threading | ||
import jobs | ||
|
||
job = threading.Thread(target=jobs.control_init) | ||
job.setDaemon(True) | ||
job.start() | ||
|
||
if is_debug: | ||
ssl_context = None | ||
if is_ssl: ssl_context=(certfile,keyfile) | ||
app.run(host=HOST,port=PORT,threaded=True,debug=True,ssl_context=ssl_context) | ||
else: | ||
from gevent.pywsgi import WSGIServer | ||
from geventwebsocket.handler import WebSocketHandler | ||
|
||
if is_ssl: | ||
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) | ||
ssl_context.load_cert_chain(certfile=certfile,keyfile=keyfile) | ||
|
@@ -64,4 +74,5 @@ if __name__ == '__main__': | |
else: | ||
http_server = WSGIServer((HOST, PORT), app,handler_class=WebSocketHandler) | ||
|
||
http_server.serve_forever() | ||
http_server.serve_forever() | ||
|
Oops, something went wrong.