Skip to content

Commit

Permalink
Merge pull request #133 from SimonDanisch/master
Browse files Browse the repository at this point in the history
fixes webio
  • Loading branch information
pfitzseb authored Oct 2, 2018
2 parents ec7df8b + 55e1050 commit 97ba532
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/display/webio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ function isrunning(server)
isassigned(server) && !istaskdone(server[].serve_task)
end

# Be ready for the deprecation of tohtml :P
# once the no unsafe-script lands
if isdefined(WebIO, :tohtml)
const tohtml = WebIO.tohtml
else
tohtml(io, app) = show(io, MIME"text/html"(), app)
end

function routepages(req)
target = req.target[2:end]

Expand All @@ -23,13 +31,13 @@ function routepages(req)
<html>
<head>
<meta charset="UTF-8">
<script>var websocket_url = 'localhost:$(port[])/webio_websocket'</script>
<script>var websocket_url = 'ws://localhost:$(port[])/webio_websocket/'</script>
<script src=$(repr(webio_script))></script>
<script src=$(repr(ws_script))></script>
</head>
<body>
""")
WebIO.tohtml(io, pages[target])
tohtml(io, pages[target])
print(io, """
</body>
</html>
Expand Down

0 comments on commit 97ba532

Please sign in to comment.