added static dir and serving for web ui
This commit is contained in:
parent
afdee2a7a5
commit
d39208d648
@ -18,7 +18,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import flask
|
import flask
|
||||||
from flask import request, Response, abort
|
from flask import request, Response, abort, send_from_directory
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from gevent.wsgi import WSGIServer
|
from gevent.wsgi import WSGIServer
|
||||||
import sys, random, threading, hmac, hashlib, base64, time, math, os, logger, config
|
import sys, random, threading, hmac, hashlib, base64, time, math, os, logger, config
|
||||||
@ -113,6 +113,21 @@ class API:
|
|||||||
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
@app.route('/client/ui/<path:path>')
|
||||||
|
def webUI(path):
|
||||||
|
startTime = math.floor(time.time())
|
||||||
|
if request.args.get('timingToken') is None:
|
||||||
|
timingToken = ''
|
||||||
|
else:
|
||||||
|
timingToken = request.args.get('timingToken')
|
||||||
|
self.validateHost('private')
|
||||||
|
endTime = math.floor(time.time())
|
||||||
|
elapsed = endTime - startTime
|
||||||
|
if not hmac.compare_digest(timingToken, self.timeBypassToken):
|
||||||
|
if elapsed < self._privateDelayTime:
|
||||||
|
time.sleep(self._privateDelayTime - elapsed)
|
||||||
|
return send_from_directory('static-data/ui/', path)
|
||||||
|
|
||||||
@app.route('/client/')
|
@app.route('/client/')
|
||||||
def private_handler():
|
def private_handler():
|
||||||
if request.args.get('timingToken') is None:
|
if request.args.get('timingToken') is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user