Skip to content

Commit

Permalink
Merge pull request #2 from aaPanel/master
Browse files Browse the repository at this point in the history
Synchronize Repo
  • Loading branch information
logicalphase authored Nov 11, 2020
2 parents 1ea4c50 + 5e2cbf9 commit b2076c6
Show file tree
Hide file tree
Showing 422 changed files with 68,749 additions and 22,147 deletions.
104 changes: 0 additions & 104 deletions .gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/aaPanel_github.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions BT-Panel
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/www/server/panel/pyenv/bin/python
#coding: utf-8
# +-------------------------------------------------------------------
# | 宝塔Linux面板
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved.
# +-------------------------------------------------------------------
# | Author: hwliang <[email protected]>
# +-------------------------------------------------------------------
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.setsid()

_pid = os.fork()
if _pid:
public.writeFile('logs/panel.pid',str(_pid))
sys.exit(0)

sys.stdout.flush()
sys.stderr.flush()

f = open('data/port.pl')
PORT = int(f.read())
HOST = '0.0.0.0'
if os.path.exists('data/ipv6.pl'):
HOST = "0:0:0:0:0:0:0:0"
f.close()

is_debug = os.path.exists('data/debug.pl')
keyfile = 'ssl/privateKey.pem'
certfile = 'ssl/certificate.pem'
is_ssl = False
if os.path.exists('data/ssl.pl') and os.path.exists(keyfile) and os.path.exists(certfile):
is_ssl = True

if not is_ssl or is_debug:
err_f = open('logs/error.log','a+')
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)
ssl_context.options |= (ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
ssl_context.set_ciphers("ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE")
http_server = WSGIServer((HOST, PORT), app,handler_class=WebSocketHandler,ssl_context = ssl_context)
else:
http_server = WSGIServer((HOST, PORT), app,handler_class=WebSocketHandler)

http_server.serve_forever()
14 changes: 14 additions & 0 deletions BT-Task
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/www/server/panel/pyenv/bin/python
#coding: utf-8
# +-------------------------------------------------------------------
# | 宝塔Linux面板
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved.
# +-------------------------------------------------------------------
# | Author: hwliang <[email protected]>
# +-------------------------------------------------------------------

import os,sys
os.chdir('/www/server/panel')
import task
task.main()
Loading

0 comments on commit b2076c6

Please sign in to comment.