Fix HTTP compression
This commit is contained in:
parent
2a420d4130
commit
54971620f0
21
init.lua
21
init.lua
|
@ -74,7 +74,10 @@ function MatrixChat:get_sync_table(timeout)
|
|||
if #params > 0 then
|
||||
u = u .. "?" .. table.concat(params, "&")
|
||||
end
|
||||
local h = {"Authorization: Bearer " .. self.token}
|
||||
local h = {
|
||||
"Authorization: Bearer " .. self.token,
|
||||
"Accept-Encoding: identity"
|
||||
}
|
||||
return {url=u, method="GET", extra_headers=h}
|
||||
end
|
||||
|
||||
|
@ -105,7 +108,10 @@ end
|
|||
function MatrixChat:login()
|
||||
local u = self.server .."/_matrix/client/r0/login"
|
||||
local d = '{"type":"m.login.password","password":"'.. self.password ..'","identifier":{"type":"m.id.user","user":"'.. self.username ..'"}}'
|
||||
local h = {"Content-Type: application/json"}
|
||||
local h = {
|
||||
"Content-Type: application/json",
|
||||
"Accept-Encoding: identity"
|
||||
}
|
||||
http.fetch({url=u, method="POST", extra_headers=h, post_data=d},
|
||||
function(res)
|
||||
if res.code == 200 then
|
||||
|
@ -134,7 +140,11 @@ function MatrixChat:send(msg)
|
|||
end
|
||||
local txid = os.time()
|
||||
local u = self.server .."/_matrix/client/r0/rooms/".. self.room .."/send/m.room.message/" .. txid -- ?access_token=..token
|
||||
local h = {"Content-Type: application/json", "Authorization: Bearer " .. self.token}
|
||||
local h = {
|
||||
"Content-Type: application/json",
|
||||
"Authorization: Bearer " .. self.token,
|
||||
"Accept-Encoding: identity"
|
||||
}
|
||||
local d = minetest.write_json({msgtype="m.text", body=msg})
|
||||
local req
|
||||
if self.proxy then
|
||||
|
@ -164,7 +174,10 @@ end
|
|||
-- POST /logout/all
|
||||
function MatrixChat:logout()
|
||||
local u = self.server .."/logout/all"
|
||||
local h = {"Authorization: Bearer " .. self.token}
|
||||
local h = {
|
||||
"Authorization: Bearer " .. self.token,
|
||||
"Accept-Encoding: identity"
|
||||
}
|
||||
http.fetch({url=u, method="POST", extra_headers=h, function(res) end})
|
||||
minetest.log("action", "matrix_bridge - signing out.")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue