mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +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()}.
|
||||
do_create_image(Key) ->
|
||||
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])),
|
||||
case cmd(Cmd) of
|
||||
{ok,
|
||||
@ -551,6 +563,7 @@ return(Port, TRef, Result) ->
|
||||
is_feature_available() ->
|
||||
case get_prog_name() of
|
||||
Prog when is_binary(Prog) -> true;
|
||||
MF when is_list(MF) -> true;
|
||||
false -> false
|
||||
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."), ""
|
||||
]}},
|
||||
{captcha_cmd,
|
||||
#{value => ?T("Path"),
|
||||
note => "improved in 21.10",
|
||||
#{value => ?T("Path | ModuleName"),
|
||||
note => "improved in 23.xx",
|
||||
desc =>
|
||||
?T("Full path to a script that generates http://../basic/#captcha[CAPTCHA] images. "
|
||||
"@VERSION@ is replaced with ejabberd version number in XX.YY format. "
|
||||
"@SEMVER@ is replaced with ejabberd version number in semver format "
|
||||
"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 "
|
||||
"set, CAPTCHA functionality is completely disabled."),
|
||||
example =>
|
||||
|
Loading…
Reference in New Issue
Block a user