Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/core/device/hb_device.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ message_to_fun(Dev, Msg, Key, Opts) ->
%% internal module-loading path.
message_to_device(Msg, Opts) ->
DevID = hb_maps:get(<<"device">>, Msg, ?DEFAULT_DEVICE, Opts),
case hb_opts:get(<<"admissible-devices">>, all, Opts) of
all -> ok;
DevIDs when is_list(DevIDs) ->
case lists:member(DevID, DevIDs) of
true -> ok;
false -> throw({error, {device_not_admissible, DevID}})
end
end,
Comment thread
speeddragon marked this conversation as resolved.
case hb_device_load:reference(DevID, Opts) of
{error, Reason} -> throw({error, {device_not_loadable, DevID, Reason}});
{ok, DevMod} -> DevMod
Expand Down
2 changes: 1 addition & 1 deletion src/preloaded/vm/dev_lua.erl
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ ao_core_sandbox_test() ->
<<"parameters">> => [],
<<"device-sandbox">> => [<<"message@1.0">>]
},
?assertMatch({error, _}, hb_ao:resolve(Base, <<"ao_relay">>, #{})),
?assertMatch({error, _}, hb_ao:resolve(Base, <<"ao_meta">>, #{})),
?assertMatch({ok, _}, hb_ao:resolve(Base, <<"ao_resolve">>, #{})).

%% @doc Run an AO-Core resolution from the Lua environment.
Expand Down
4 changes: 2 additions & 2 deletions test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ function ao_resolve()
return res
end

function ao_relay()
function ao_meta()
local status, res =
ao.resolve({
path = "/~relay@1.0/call?relay-path=http://localhost:10000/hello"
path = "/~meta@1.0/info"
})
return res
end
Expand Down