mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 15:13:36 +00:00
Add uri_root_path option. References #104.
This commit is contained in:
@@ -64,6 +64,9 @@ tornado.options.define("generate_current_user_pkcs", default=False,
|
||||
tornado.options.define("generate_user_pkcs", default='',
|
||||
help="Generate user pfx for client authentication "
|
||||
"(Must be root to create for another user)")
|
||||
tornado.options.define("uri_root_path", default='',
|
||||
help="Sets the servier root path: "
|
||||
"example.com/<uri_root_path>/static/")
|
||||
|
||||
if os.getuid() == 0:
|
||||
ev = os.getenv('XDG_CONFIG_DIRS', '/etc')
|
||||
@@ -296,7 +299,8 @@ from butterfly import application
|
||||
application.butterfly_dir = butterfly_dir
|
||||
log.info('Starting server')
|
||||
http_server = tornado_systemd.SystemdHTTPServer(
|
||||
application, ssl_options=ssl_opts)
|
||||
application,
|
||||
ssl_options=ssl_opts)
|
||||
http_server.listen(port, address=host)
|
||||
|
||||
if http_server.systemd:
|
||||
|
||||
@@ -66,7 +66,10 @@ if hasattr(tornado.options.options, 'debug'):
|
||||
application = tornado.web.Application(
|
||||
static_path=os.path.join(os.path.dirname(__file__), "static"),
|
||||
template_path=os.path.join(os.path.dirname(__file__), "templates"),
|
||||
debug=tornado.options.options.debug
|
||||
debug=tornado.options.options.debug,
|
||||
static_url_prefix='%s/static/' % (
|
||||
'/%s' % tornado.options.options.uri_root_path
|
||||
if tornado.options.options.uri_root_path else '')
|
||||
)
|
||||
|
||||
import butterfly.routes
|
||||
|
||||
2
butterfly/static/ext.min.js
vendored
2
butterfly/static/ext.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
|
||||
$ = document.querySelectorAll.bind(document);
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var ctl, lastData, queue, send, t_queue, term, treat, ws, wsUrl;
|
||||
var ctl, lastData, queue, root_path, send, t_queue, term, treat, ws, wsUrl;
|
||||
term = null;
|
||||
send = function(data) {
|
||||
return ws.send('S' + data);
|
||||
@@ -30,7 +30,11 @@
|
||||
} else {
|
||||
wsUrl = 'ws://';
|
||||
}
|
||||
wsUrl += document.location.host + '/ws' + location.pathname;
|
||||
root_path = document.body.getAttribute('data-root-path');
|
||||
if (root_path.length) {
|
||||
root_path = "/" + root_path;
|
||||
}
|
||||
wsUrl += document.location.host + root_path + '/ws' + location.pathname;
|
||||
ws = new WebSocket(wsUrl);
|
||||
ws.addEventListener('open', function() {
|
||||
console.log("WebSocket open", arguments);
|
||||
|
||||
6
butterfly/static/main.min.js
vendored
6
butterfly/static/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -14,7 +14,8 @@
|
||||
</head>
|
||||
|
||||
<body spellcheck="false"
|
||||
data-force-unicode-width="{{ 'yes' if options.force_unicode_width else 'no' }}">
|
||||
data-force-unicode-width="{{ 'yes' if options.force_unicode_width else 'no' }}"
|
||||
data-root-path="{{ options.uri_root_path }}">
|
||||
<div id="popup" class="hidden">
|
||||
</div>
|
||||
<script src="{{ static_url('html-sanitizer.js') }}"></script>
|
||||
|
||||
@@ -36,7 +36,11 @@ document.addEventListener 'DOMContentLoaded', ->
|
||||
else
|
||||
wsUrl = 'ws://'
|
||||
|
||||
wsUrl += document.location.host + '/ws' + location.pathname
|
||||
root_path = document.body.getAttribute('data-root-path')
|
||||
if root_path.length
|
||||
root_path = "/#{root_path}"
|
||||
|
||||
wsUrl += document.location.host + root_path + '/ws' + location.pathname
|
||||
ws = new WebSocket wsUrl
|
||||
|
||||
ws.addEventListener 'open', ->
|
||||
|
||||
Reference in New Issue
Block a user