25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

ext_mod: Support managing remote nodes in the cluster

This commit is contained in:
Badlop 2022-08-05 16:10:25 +02:00
parent 72944d895b
commit 7d8fa3c880

View File

@ -36,7 +36,7 @@
config_dir/0, get_commands_spec/0]). config_dir/0, get_commands_spec/0]).
-export([modules_configs/0, module_ebin_dir/1]). -export([modules_configs/0, module_ebin_dir/1]).
-export([compile_erlang_file/2, compile_elixir_file/2]). -export([compile_erlang_file/2, compile_elixir_file/2]).
-export([web_menu_node/3, web_page_node/5]). -export([web_menu_node/3, web_page_node/5, get_page/3]).
%% gen_server callbacks %% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@ -858,6 +858,12 @@ web_menu_node(Acc, _Node, Lang) ->
Acc ++ [{<<"contrib">>, translate:translate(Lang, ?T("Contrib Modules"))}]. Acc ++ [{<<"contrib">>, translate:translate(Lang, ?T("Contrib Modules"))}].
web_page_node(_, Node, [<<"contrib">>], Query, Lang) -> web_page_node(_, Node, [<<"contrib">>], Query, Lang) ->
Res = rpc:call(Node, ?MODULE, get_page, [Node, Query, Lang]),
{stop, Res};
web_page_node(Acc, _, _, _, _) ->
Acc.
get_page(Node, Query, Lang) ->
QueryRes = list_modules_parse_query(Query), QueryRes = list_modules_parse_query(Query),
Title = ?H1GL(translate:translate(Lang, ?T("Contrib Modules")), Title = ?H1GL(translate:translate(Lang, ?T("Contrib Modules")),
<<"../../developer/extending-ejabberd/modules/#ejabberd-contrib">>, <<"../../developer/extending-ejabberd/modules/#ejabberd-contrib">>,
@ -867,10 +873,7 @@ web_page_node(_, Node, [<<"contrib">>], Query, Lang) ->
ok -> [?XREST(?T("Submitted"))]; ok -> [?XREST(?T("Submitted"))];
nothing -> [] nothing -> []
end, end,
Res = Title ++ Result ++ Contents, Title ++ Result ++ Contents.
{stop, Res};
web_page_node(Acc, _, _, _, _) ->
Acc.
get_module_home(Module, Attrs) -> get_module_home(Module, Attrs) ->
case element(2, lists:keyfind(home, 1, Attrs)) of case element(2, lists:keyfind(home, 1, Attrs)) of