diff --git a/mod_ecaptcha/README.md b/mod_ecaptcha/README.md index b3aa8cc..d81feaa 100644 --- a/mod_ecaptcha/README.md +++ b/mod_ecaptcha/README.md @@ -12,6 +12,9 @@ This small module uses the erlang library to generate CAPTCHA images suitable for ejabberd's [CAPTCHA](https://docs.ejabberd.im/admin/configuration/basic/#captcha) feature. +Installing this module in a containerized ejabberd requires +some additional steps, please read below. + Basic Configuration ------------------- @@ -103,3 +106,40 @@ modules: font: "hplhs-oldstyle" ``` + +Install in Container +-------------------- + +There are some additional steps to install this module in a containerized ejabberd. + +For example, if using the container image available at GitHub Container Registry: +``` +docker run --name ejabberd -it -p 5222:5222 -p 5280:5280 -p 5288:5288 ghcr.io/processone/ejabberd:23.01 live +``` + +Install the dependencies required to compile C code: +``` +docker exec --user root ejabberd apk add git make g++ freetype-dev erlang-dev +``` + +It's a good idea to update specs and modules source code: +``` +docker exec ejabberd ejabberdctl modules_update_specs +``` + +Install the module so it gets the Erlang dependencies, +then compile that dependency C code, and finally recompile it: +``` +docker exec ejabberd ejabberdctl module_install mod_ecaptcha +docker exec ejabberd make -C .ejabberd-modules/sources/ejabberd-contrib/mod_ecaptcha/deps/ecaptcha/c_src +docker exec ejabberd ejabberdctl module_upgrade mod_ecaptcha +``` + +If using the Docker Hub Container, `ejabberdctl` is in a different path, +please use those commands instead: +``` +docker exec ejabberd bin/ejabberdctl modules_update_specs +docker exec ejabberd bin/ejabberdctl module_install mod_ecaptcha +docker exec ejabberd make -C .ejabberd-modules/sources/ejabberd-contrib/mod_ecaptcha/deps/ecaptcha/c_src +docker exec ejabberd bin/ejabberdctl module_upgrade mod_ecaptcha +``` diff --git a/mod_ecaptcha/src/mod_ecaptcha.erl b/mod_ecaptcha/src/mod_ecaptcha.erl index 3a76c57..f8ac9ba 100644 --- a/mod_ecaptcha/src/mod_ecaptcha.erl +++ b/mod_ecaptcha/src/mod_ecaptcha.erl @@ -83,7 +83,7 @@ create_image(_Key) -> font => get_opt(font)} ), case Response of - {Phrase, PNGImage} when is_binary(PNGImage) -> + {Phrase, PNGImage} when is_binary(Phrase) -> PNGBin = binary:list_to_bin([PNGImage]), {ok, <<"image/png">>, Phrase, PNGBin}; {error, Reason} ->