Update template.lsl

This commit is contained in:
Anna Puddles
2023-01-13 19:41:11 -05:00
committed by GitHub
parent 465b7709cc
commit 2e620971aa

View File

@@ -1,22 +1,23 @@
jsonrpc_link_notification(integer link, string method, string params_type, list params)
string jsonrpc_notification(string method, string params_type, list params)
{
llMessageLinked(link, 0, llList2Json(JSON_OBJECT, ["jsonrpc", "2.0", "method", method, "params", llList2Json(params_type, params)]), NULL_KEY);
return llList2Json(JSON_OBJECT, ["jsonrpc", "2.0", "method", method, "params", llList2Json(params_type, params)]);
}
default
{
link_message(integer sender, integer num, string str, key id)
{
if (llJsonGetValue(str, ["method"]) != "prim-dns:request")
string jsonrpc_method = llJsonGetValue(str, ["method"]);
if (jsonrpc_method == "prim-dns:request")
{
return;
key request_id = (key) llJsonGetValue(str, ["params", "request-id"]);
string method = llJsonGetValue(str, ["params", "method"]);
string headers = llJsonGetValue(str, ["params", "headers"]);
string body = llJsonGetValue(str, ["params", "body"]);
llMessageLinked(sender, 0, jsonrpc_notification("prim-dns:set-content-type", JSON_OBJECT, ["request-id", request_id, "content-type", CONTENT_TYPE_HTML]), NULL_KEY);
llMessageLinked(sender, 0, jsonrpc_notification("prim-dns:response", JSON_OBJECT, ["request-id", request_id, "status", 200, "body", "<b>Hello, world!</b>"]), NULL_KEY);
}
key request_id = (key) llJsonGetValue(str, ["params", "request-id"]);
string method = llJsonGetValue(str, ["params", "method"]);
string body = llJsonGetValue(str, ["params", "body"]);
jsonrpc_link_notification(sender, "prim-dns:set-content-type", JSON_OBJECT, ["request-id", request_id, "content-type", CONTENT_TYPE_HTML]);
jsonrpc_link_notification(sender, "prim-dns:response", JSON_OBJECT, ["request-id", request_id, "status", 200, "body", "<b>Hello, world!</b>"]);
}
}