mirror of
https://git.phreedom.club/localhost_frssoft/fediauth.git
synced 2025-01-07 00:24:32 +00:00
Add automatic delete messages and reformat message
This commit is contained in:
parent
77debe610f
commit
9a79e6d7cf
13
mastoapi.lua
13
mastoapi.lua
|
@ -1,9 +1,18 @@
|
|||
local http, instance, key
|
||||
local server_name = minetest.settings:get("server_name") or ""
|
||||
local automatic_delete = minetest.settings:get_bool("fediauth.automatic_delete")
|
||||
|
||||
function fediauth.send_code(code, account_handle)
|
||||
expires_in = nil
|
||||
if automatic_delete then
|
||||
expires_in = 3600
|
||||
end
|
||||
|
||||
local status = {
|
||||
visibility = "direct",
|
||||
status = "" .. code .. " " .. account_handle .. " code for minetest fediauth, do not share it!"
|
||||
status = "This is an automated message from minetest server " .. server_name ..
|
||||
" If you did not request this message please ignore or block.\n\n" .. code .. "\n\n" .. account_handle,
|
||||
expires_in = expires_in
|
||||
}
|
||||
local json = minetest.write_json(status)
|
||||
http.fetch({
|
||||
|
@ -12,7 +21,7 @@ function fediauth.send_code(code, account_handle)
|
|||
timeout = 15,
|
||||
post_data = json
|
||||
}, function(res)
|
||||
if res then
|
||||
if res.code == 200 then
|
||||
minetest.log("action", "[fediauth] code sent to: '" .. account_handle .. "'")
|
||||
else
|
||||
minetest.log("error", "[fediauth] code not sent to: '" .. account_handle .. "'")
|
||||
|
|
|
@ -11,3 +11,7 @@ fediauth.fedi_required (Require Fediverse account for each user) bool false
|
|||
# Useful if remote instance blocked on service account server or any other reasons
|
||||
# Separated by comma
|
||||
fediauth.restricted_instances (Restrict instance domains) string example.com,another.example.com,
|
||||
|
||||
# After hour post will be deleted
|
||||
# Supported on: Pleroma/Akkoma and their forks
|
||||
fediauth.automatic_delete (Mark messages for delete*) bool false
|
||||
|
|
Loading…
Reference in a new issue