mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] try to make websockets relative
This commit is contained in:
parent
67c837c496
commit
f7ea9da20c
4 changed files with 8 additions and 4 deletions
4
run.py
4
run.py
|
@ -389,13 +389,13 @@ async def job(request, job_id):
|
|||
if job.count == 0:
|
||||
raise NotFound()
|
||||
|
||||
return {"job": job[0], 'relative_path_to_root': '../../'}
|
||||
return {"job": job[0], 'relative_path_to_root': '../../', 'path': request.path}
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@jinja.template('index.html')
|
||||
async def index(request):
|
||||
return {'relative_path_to_root': ''}
|
||||
return {'relative_path_to_root': '', 'path': request.path}
|
||||
|
||||
|
||||
def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/key.pem", certfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/crt.pem"):
|
||||
|
|
|
@ -6,6 +6,10 @@ function websocketPrefix() {
|
|||
}
|
||||
}
|
||||
|
||||
function websocketRelativePath(path) {
|
||||
return window.location.pathname.substring(0, window.location.pathname.length - path.length)
|
||||
}
|
||||
|
||||
/* ansi_up.js
|
||||
* author : Dru Nelson
|
||||
* license : MIT
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
})
|
||||
|
||||
ws = new WebSocket(websocketPrefix() + '://' + document.domain + ':' + location.port + '/index-ws');
|
||||
ws = new WebSocket(websocketPrefix() + '://' + document.domain + ':' + location.port + websocketRelativePath('<{ path }>') + '/index-ws');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
var message = JSON.parse(event.data);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
})
|
||||
|
||||
ws = new WebSocket(websocketPrefix() + '://' + document.domain + ':' + location.port + '/job-<{ job.id }>-ws');
|
||||
ws = new WebSocket(websocketPrefix() + '://' + document.domain + ':' + location.port + websocketRelativePath('<{ path }>') + '/job-<{ job.id }>-ws');
|
||||
|
||||
ws.onmessage = function (event) {
|
||||
var message = JSON.parse(event.data);
|
||||
|
|
Loading…
Add table
Reference in a new issue