Token works
This commit is contained in:
parent
a02bcef7ad
commit
cb6dde19e5
7
init.lua
7
init.lua
|
@ -36,7 +36,9 @@ assert(http, "[MOD] yl_matterbridge: Please add yl_matterbridge to secure.http_m
|
|||
|
||||
function send(user_name, message_text)
|
||||
local url = "http://" .. address .. ":" .. port .. "/api/message"
|
||||
local post_headers = {"Content-Type: application/json, "}
|
||||
local post_headers = {"Content-Type: application/json"}
|
||||
if token and token ~= "" then table.insert(post_headers,"Authorization: Bearer "..token) end
|
||||
core.log("action", "[MOD] yl_matterbridge : Posted " .. dump(post_headers))
|
||||
local timeout = 10
|
||||
local data = {
|
||||
text = message_text,
|
||||
|
@ -66,11 +68,14 @@ end
|
|||
|
||||
local function receive()
|
||||
local url = "http://" .. address .. ":" .. port .. "/api/messages"
|
||||
local post_headers = {"Content-Type: application/json"}
|
||||
if token and token ~= "" then table.insert(post_headers,"Authorization: Bearer "..token) end
|
||||
local timeout = 0
|
||||
|
||||
http.fetch(
|
||||
{
|
||||
url = url,
|
||||
extra_headers = post_headers,
|
||||
timeout = timeout
|
||||
},
|
||||
function(result)
|
||||
|
|
Loading…
Reference in New Issue