@@ -57,7 +57,7 @@ const D3R_ACTUAL_PORT = Dict{Int,Int}()
5757# TODO : Concrete socket types
5858const D3R_CLIENT_SOCKETS = Dict {Int,Dict{Int,Vector{Any}}} ()
5959
60- const D3R_WORKER_HOST_MAP = Dict {Int,IPAddr} ()
60+ const D3R_WORKER_HOST_MAP = Dict {Int,Union{ IPAddr,String} } ()
6161const D3R_WORKER_PORT_MAP = Dict {Int,Int} ()
6262
6363struct D3Renderer
@@ -143,6 +143,17 @@ function d3r_init(port::Int, port_range::UnitRange, config_updated::Ref{Bool}, c
143143 Dict (:status => 404 )
144144 end
145145 end ),
146+ page (" /assets/:path" , req-> begin
147+ path = req[:params ][:path ]
148+ occursin (" .." , path) && return Dict (:status => 404 )
149+ assets_path = normpath (joinpath (@__DIR__ , " .." , " assets" ))
150+ path = normpath (joinpath (assets_path, path))
151+ if ispath (path) && normpath (dirname (path)) == assets_path
152+ Dict (:body => String (read (path)))
153+ else
154+ Dict (:status => 404 )
155+ end
156+ end ),
146157 page (" /worker_id" , respond (" $(myid ()) " )),
147158 page (" /worker/:id/:location" , req-> begin
148159 id = parse (Int, req[:params ][:id ])
311322function worker_host_port (id:: Int , port:: Int , port_range:: UnitRange )
312323 worker_host = get! (D3R_WORKER_HOST_MAP, port) do
313324 worker_host, worker_port = remotecall_fetch (id, port) do port
314- (MemPool. host, get_actual_port (port, port_range))
325+ host = gethostname ()
326+ if isempty (host)
327+ host = getipaddr ()
328+ end
329+ (host, get_actual_port (port, port_range))
315330 end
316331 D3R_WORKER_PORT_MAP[port] = worker_port
317332 worker_host
0 commit comments