mirror of
https://git.phreedom.club/localhost_frssoft/fediauth.git
synced 2025-01-07 00:24:32 +00:00
small localization for code message
This commit is contained in:
parent
64f1f0c47c
commit
33586a6423
8
join.lua
8
join.lua
|
@ -67,9 +67,9 @@ minetest.register_on_joinplayer(function(player)
|
||||||
local codeseq = fediauth.give_code(secret_b32)
|
local codeseq = fediauth.give_code(secret_b32)
|
||||||
local fedihandle = fediauth.storage:get_string(playername .. "_fedi"):split("@")
|
local fedihandle = fediauth.storage:get_string(playername .. "_fedi"):split("@")
|
||||||
if fediauth.is_home_instance(fedihandle[2]) then
|
if fediauth.is_home_instance(fedihandle[2]) then
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1], playername)
|
||||||
else
|
else
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2], playername)
|
||||||
end
|
end
|
||||||
-- send verification formspec
|
-- send verification formspec
|
||||||
local formspec = "size[10,2]" ..
|
local formspec = "size[10,2]" ..
|
||||||
|
@ -148,9 +148,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local secret_b32 = fediauth.get_player_secret_b32(playername)
|
local secret_b32 = fediauth.get_player_secret_b32(playername)
|
||||||
local codeseq = fediauth.give_code(secret_b32)
|
local codeseq = fediauth.give_code(secret_b32)
|
||||||
if fediauth.is_home_instance(fedihandle[2]) then
|
if fediauth.is_home_instance(fedihandle[2]) then
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1], playername)
|
||||||
else
|
else
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2], playername)
|
||||||
end
|
end
|
||||||
feditempstore[playername] = fields.fediverse_account_url
|
feditempstore[playername] = fields.fediverse_account_url
|
||||||
local formspec = "size[9,10]" ..
|
local formspec = "size[9,10]" ..
|
||||||
|
|
4
locale/fediauth.ru.tr
Normal file
4
locale/fediauth.ru.tr
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: fediauth
|
||||||
|
This is an automated message from minetest server =Это автоматическое сообщение от minetest сервера
|
||||||
|
If you did not request this message please ignore or block. Your requested one-time code is:@n@n= Если вы не запрашивали это сообщение, пожалуйста игнорируйте или заблокируйте. Ваш запрошенный временный код:@n@n
|
||||||
|
|
3
locale/template.txt
Normal file
3
locale/template.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: fediauth
|
||||||
|
This is an automated message from minetest server =
|
||||||
|
If you did not request this message please ignore or block. Your requested one-time code is:@n@n=
|
15
mastoapi.lua
15
mastoapi.lua
|
@ -1,8 +1,10 @@
|
||||||
local http, instance, key
|
local http, instance, key
|
||||||
local server_name = minetest.settings:get("server_name") or ""
|
local server_name = minetest.settings:get("server_name") or ""
|
||||||
local automatic_delete = minetest.settings:get_bool("fediauth.automatic_delete")
|
local automatic_delete = minetest.settings:get_bool("fediauth.automatic_delete")
|
||||||
|
local S = minetest.get_translator("fediauth")
|
||||||
|
|
||||||
function fediauth.send_code(code, account_handle)
|
function fediauth.send_code(code, account_handle, playername)
|
||||||
|
local lang_code = minetest.get_player_information(playername).lang_code
|
||||||
local expires_in = nil
|
local expires_in = nil
|
||||||
if automatic_delete then
|
if automatic_delete then
|
||||||
expires_in = 3600
|
expires_in = 3600
|
||||||
|
@ -10,8 +12,11 @@ function fediauth.send_code(code, account_handle)
|
||||||
|
|
||||||
local status = {
|
local status = {
|
||||||
visibility = "direct",
|
visibility = "direct",
|
||||||
status = "This is an automated message from minetest server " .. server_name ..
|
status = minetest.get_translated_string(lang_code, S("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,
|
minetest.get_translated_string(lang_code, S(" If you did not request this message please ignore or block. Your requested one-time code is:\n\n")) ..
|
||||||
|
code ..
|
||||||
|
"\n\n" ..
|
||||||
|
account_handle,
|
||||||
expires_in = expires_in
|
expires_in = expires_in
|
||||||
}
|
}
|
||||||
local json = minetest.write_json(status)
|
local json = minetest.write_json(status)
|
||||||
|
@ -22,9 +27,9 @@ function fediauth.send_code(code, account_handle)
|
||||||
post_data = json
|
post_data = json
|
||||||
}, function(res)
|
}, function(res)
|
||||||
if res.code == 200 then
|
if res.code == 200 then
|
||||||
minetest.log("action", "[fediauth] code sent to: '" .. account_handle .. "'")
|
minetest.log("action", "[fediauth] code sent to: '" .. account_handle .. "' for player " .. playername)
|
||||||
else
|
else
|
||||||
minetest.log("error", "[fediauth] code not sent to: '" .. account_handle .. "'")
|
minetest.log("error", "[fediauth] code not sent to: '" .. account_handle .. "' for player " .. playername)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,9 +58,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local secret_b32 = fediauth.get_player_secret_b32(playername)
|
local secret_b32 = fediauth.get_player_secret_b32(playername)
|
||||||
local codeseq = fediauth.give_code(secret_b32)
|
local codeseq = fediauth.give_code(secret_b32)
|
||||||
if fediauth.is_home_instance(fedihandle[2]) then
|
if fediauth.is_home_instance(fedihandle[2]) then
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1], playername)
|
||||||
else
|
else
|
||||||
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2])
|
fediauth.send_code(codeseq[1], "@" .. fedihandle[1] .. "@" .. fedihandle[2], playername)
|
||||||
end
|
end
|
||||||
feditempstore[playername] = fields.fediverse_account_url
|
feditempstore[playername] = fields.fediverse_account_url
|
||||||
local formspec = "size[9,10]" ..
|
local formspec = "size[9,10]" ..
|
||||||
|
|
Loading…
Reference in a new issue