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
|
if #params > 0 then
|
||||||
u = u .. "?" .. table.concat(params, "&")
|
u = u .. "?" .. table.concat(params, "&")
|
||||||
end
|
end
|
||||||
local h = {"Authorization: Bearer " .. self.token}
|
local h = {
|
||||||
|
"Authorization: Bearer " .. self.token,
|
||||||
|
"Accept-Encoding: identity"
|
||||||
|
}
|
||||||
return {url=u, method="GET", extra_headers=h}
|
return {url=u, method="GET", extra_headers=h}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,7 +108,10 @@ end
|
||||||
function MatrixChat:login()
|
function MatrixChat:login()
|
||||||
local u = self.server .."/_matrix/client/r0/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 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},
|
http.fetch({url=u, method="POST", extra_headers=h, post_data=d},
|
||||||
function(res)
|
function(res)
|
||||||
if res.code == 200 then
|
if res.code == 200 then
|
||||||
|
@ -134,7 +140,11 @@ function MatrixChat:send(msg)
|
||||||
end
|
end
|
||||||
local txid = os.time()
|
local txid = os.time()
|
||||||
local u = self.server .."/_matrix/client/r0/rooms/".. self.room .."/send/m.room.message/" .. txid -- ?access_token=..token
|
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 d = minetest.write_json({msgtype="m.text", body=msg})
|
||||||
local req
|
local req
|
||||||
if self.proxy then
|
if self.proxy then
|
||||||
|
@ -164,7 +174,10 @@ end
|
||||||
-- POST /logout/all
|
-- POST /logout/all
|
||||||
function MatrixChat:logout()
|
function MatrixChat:logout()
|
||||||
local u = self.server .."/logout/all"
|
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})
|
http.fetch({url=u, method="POST", extra_headers=h, function(res) end})
|
||||||
minetest.log("action", "matrix_bridge - signing out.")
|
minetest.log("action", "matrix_bridge - signing out.")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue