mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Add support to define module instead of path to script
This commit is contained in:
parent
9087e72f0e
commit
353c68cfa6
@ -398,6 +398,18 @@ create_image(Limiter, Key) ->
|
|||||||
{error, image_error()}.
|
{error, image_error()}.
|
||||||
do_create_image(Key) ->
|
do_create_image(Key) ->
|
||||||
FileName = get_prog_name(),
|
FileName = get_prog_name(),
|
||||||
|
case length(string:split(FileName, "/")) == 1 of
|
||||||
|
true ->
|
||||||
|
do_create_image(Key, misc:binary_to_atom(FileName));
|
||||||
|
false ->
|
||||||
|
do_create_image(Key, FileName)
|
||||||
|
end.
|
||||||
|
|
||||||
|
do_create_image(Key, Module) when is_atom(Module) ->
|
||||||
|
Function = create_image,
|
||||||
|
erlang:apply(Module, Function, [Key]);
|
||||||
|
|
||||||
|
do_create_image(Key, FileName) when is_binary(FileName) ->
|
||||||
Cmd = lists:flatten(io_lib:format("~ts ~ts", [FileName, Key])),
|
Cmd = lists:flatten(io_lib:format("~ts ~ts", [FileName, Key])),
|
||||||
case cmd(Cmd) of
|
case cmd(Cmd) of
|
||||||
{ok,
|
{ok,
|
||||||
@ -551,6 +563,7 @@ return(Port, TRef, Result) ->
|
|||||||
is_feature_available() ->
|
is_feature_available() ->
|
||||||
case get_prog_name() of
|
case get_prog_name() of
|
||||||
Prog when is_binary(Prog) -> true;
|
Prog when is_binary(Prog) -> true;
|
||||||
|
MF when is_list(MF) -> true;
|
||||||
false -> false
|
false -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -454,13 +454,14 @@ doc() ->
|
|||||||
?T("For server connections, this 'ca_file' option is overridden by the http://../toplevel/#s2s-cafile[s2s_cafile] option."), ""
|
?T("For server connections, this 'ca_file' option is overridden by the http://../toplevel/#s2s-cafile[s2s_cafile] option."), ""
|
||||||
]}},
|
]}},
|
||||||
{captcha_cmd,
|
{captcha_cmd,
|
||||||
#{value => ?T("Path"),
|
#{value => ?T("Path | ModuleName"),
|
||||||
note => "improved in 21.10",
|
note => "improved in 23.xx",
|
||||||
desc =>
|
desc =>
|
||||||
?T("Full path to a script that generates http://../basic/#captcha[CAPTCHA] images. "
|
?T("Full path to a script that generates http://../basic/#captcha[CAPTCHA] images. "
|
||||||
"@VERSION@ is replaced with ejabberd version number in XX.YY format. "
|
"@VERSION@ is replaced with ejabberd version number in XX.YY format. "
|
||||||
"@SEMVER@ is replaced with ejabberd version number in semver format "
|
"@SEMVER@ is replaced with ejabberd version number in semver format "
|
||||||
"when compiled with Elixir's mix, or XX.YY format otherwise. "
|
"when compiled with Elixir's mix, or XX.YY format otherwise. "
|
||||||
|
"Alternatively, it can be the name of a module that implements ejabberd CAPTCHA support. "
|
||||||
"There is no default value: when this option is not "
|
"There is no default value: when this option is not "
|
||||||
"set, CAPTCHA functionality is completely disabled."),
|
"set, CAPTCHA functionality is completely disabled."),
|
||||||
example =>
|
example =>
|
||||||
|
Loading…
Reference in New Issue
Block a user