diff --git a/init.lua b/init.lua index 605e687..f0ba9d2 100644 --- a/init.lua +++ b/init.lua @@ -17,16 +17,18 @@ label[0.5,3.4;Сообщение] local function get_formspec_main(name) local formspec = { "size[8,5]", - "label[0.2,0.4;".. S("Attention! The site is under development.") .."]", - "label[0.2,1;" .. S("Enter your password to log in to the site") .. "]", + --"label[0.2,0.4;".. S("Attention! The site is under development.") .."]", + "label[0.2,0.4;" .. S("Enter your password to log in to the site") .. "]", + --"...", "field[0.5,2.2;5,0.8;pass;".. S("Password") ..";]", - "button[4.3,3.4;3,0.8;save;".. S("Save") .."]", + "button[4.3,3.0;3,0.8;save;".. S("Save") .."]", + "button_url[0.2,4.5;4,0;url;"..S("Go to the authorization page")..";https://apocalypse.texnoblog.uz/authorization]", } if pass[name] == 'empty' then - table.insert(formspec, 'label[0.2,3.4;'.. S("The password field must not be empty.") ..']') + table.insert(formspec, 'label[0.2,3.0;'.. S("The password field must not be empty.") ..']') end if pass[name] == 'success' then - table.insert(formspec, 'label[0.2,3.4;'.. S("Password saved") ..']') + table.insert(formspec, 'label[0.2,3.0;'.. S("Password saved") ..']') end return table.concat(formspec, "") @@ -43,6 +45,11 @@ minetest.register_chatcommand("set_site_pass", { minetest.register_on_player_receive_fields(function(player, formname, fields) local name = player:get_player_name() + if fields.set_site_pass_ui then + minetest.show_formspec(name, "site_connect:set_password", get_formspec_main(name)) + return true + end + if formname ~= "site_connect:set_password" then return end @@ -62,4 +69,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.show_formspec(name, "site_connect:set_password", get_formspec_main(name)) --minetest.chat_send_all(sha256(fields.pass)) end -end) \ No newline at end of file +end) + +if minetest.global_exists("unified_inventory") then + unified_inventory.register_button("set_site_pass_ui", { + type = "image", + image = "site_connect_password.png", + tooltip = S("Set a password for the site"), + hide_lite = true, + condition = function(player) + return minetest.check_player_privs(player:get_player_name(), {interact=true}) + end, + }) +end \ No newline at end of file diff --git a/locale/site_connect.ru.tr b/locale/site_connect.ru.tr index ebf8447..6baed64 100644 --- a/locale/site_connect.ru.tr +++ b/locale/site_connect.ru.tr @@ -1,4 +1,5 @@ # textdomain: site_connect + Attention! The site is under development.=Внимание! Сайт в процессе разработки. Enter your password to log in to the site=Введите пароль для авторизации на сайте Password=Пароль @@ -6,3 +7,5 @@ Save=Сохранить The password field must not be empty.=Поле пароля не должно быть пустым Password saved=Пароль сохранен Setting up an authorization password for the site=Установка авторизационного пароля на сайт +Set a password for the site=Установить пароль для сайта +Go to the authorization page=Перейти на страницу авторизации \ No newline at end of file diff --git a/mod.conf b/mod.conf index 04a6033..3e653f5 100644 --- a/mod.conf +++ b/mod.conf @@ -3,3 +3,4 @@ description = Allows you to interact with the site via sql min_minetest_version = 5.7 title = Site Connect author = VinAdmin +optional_depends = unified_inventory diff --git a/textures/site_connect_password.png b/textures/site_connect_password.png new file mode 100644 index 0000000..4a759c6 Binary files /dev/null and b/textures/site_connect_password.png differ