New injectScript and redirect command for UiServer

This commit is contained in:
shortcutme 2018-11-26 00:05:04 +01:00
parent 7cbbc33319
commit 233e161327
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -92,8 +92,15 @@ class Wrapper
else if cmd == "updating" # Close connection else if cmd == "updating" # Close connection
@ws.ws.close() @ws.ws.close()
@ws.onCloseWebsocket(null, 4000) @ws.onCloseWebsocket(null, 4000)
else if cmd == "redirect"
window.top.location = message.params
else if cmd == "injectHtml" else if cmd == "injectHtml"
$("body").append(message.params) $("body").append(message.params)
else if cmd == "injectScript"
script_tag = $("<script>")
script_tag.attr("nonce", @script_nonce)
script_tag.html(message.params)
document.head.appendChild(script_tag[0])
else else
@sendInner message # Pass message to inner frame @sendInner message # Pass message to inner frame