mirror of
https://git.phreedom.club/localhost_frssoft/fediauth
synced 2025-07-21 14:44:50 -04:00
fork creation done
This commit is contained in:
parent
376d163d08
commit
3466db227f
24 changed files with 416 additions and 1652 deletions
27
mastoapi.lua
Normal file
27
mastoapi.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
local http, instance, key
|
||||
|
||||
function fediauth.send_code(code, account_handle)
|
||||
local status = {
|
||||
visibility = "direct",
|
||||
status = "" .. code .. " " .. account_handle .. " code for minetest fediauth, do not share it!"
|
||||
}
|
||||
local json = minetest.write_json(status)
|
||||
http.fetch({
|
||||
url = "https://" .. instance .. "/api/v1/statuses",
|
||||
extra_headers = { "Content-Type: application/json", "Authorization: Bearer " .. key },
|
||||
timeout = 15,
|
||||
post_data = json
|
||||
}, function(res)
|
||||
if res then
|
||||
minetest.log("action", "[fediauth] code sent to: '" .. account_handle .. "'")
|
||||
else
|
||||
minetest.log("error", "[fediauth] code not sent to: '" .. account_handle .. "'")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function mastoapi_init(h, i, k)
|
||||
http = h
|
||||
instance = i
|
||||
key = k
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue