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

Update Guide links in WebAdmin to website, as local file isn't included

This commit is contained in:
Badlop 2019-10-02 12:31:04 +02:00
parent 20205c66c1
commit 949e71efb6
2 changed files with 1 additions and 25 deletions

View File

@ -93,7 +93,7 @@
-define(GL(Ref, Title), -define(GL(Ref, Title),
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}], ?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
[?XAE(<<"a">>, [?XAE(<<"a">>,
[{<<"href">>, <<"/admin/doc/guide.html#", Ref/binary>>}, [{<<"href">>, <<"https://docs.ejabberd.im/admin/configuration/#", Ref/binary>>},
{<<"target">>, <<"_blank">>}], {<<"target">>, <<"_blank">>}],
[?C(<<"[Guide: ", Title/binary, "]">>)])])). [?C(<<"[Guide: ", Title/binary, "]">>)])])).

View File

@ -150,30 +150,6 @@ url_to_path(URL) -> str:tokens(URL, <<"/">>).
%%%================================== %%%==================================
%%%% process/2 %%%% process/2
process([<<"doc">>, LocalFile], _Request) ->
DocPath = case os:getenv("EJABBERD_DOC_PATH") of
P when is_list(P) -> P;
false -> <<"/share/doc/ejabberd/">>
end,
FileName = filename:join(DocPath, LocalFile),
case file:read_file(FileName) of
{ok, FileContents} ->
?DEBUG("Delivering content.", []),
{200, [{<<"Server">>, <<"ejabberd">>}], FileContents};
{error, Error} ->
Help = <<" ", FileName/binary,
" - Try to specify the path to ejabberd "
"documentation with the environment variable "
"EJABBERD_DOC_PATH. Check the ejabberd "
"Guide for more information.">>,
?WARNING_MSG("Problem '~p' accessing the local Guide file ~ts", [Error, Help]),
case Error of
eacces -> {403, [], <<"Forbidden", Help/binary>>};
enoent -> {307, [{<<"Location">>, <<"http://docs.ejabberd.im/admin/guide/configuration/">>}], <<"Not found", Help/binary>>};
_Else ->
{404, [], <<(iolist_to_binary(atom_to_list(Error)))/binary, Help/binary>>}
end
end;
process([<<"server">>, SHost | RPath] = Path, process([<<"server">>, SHost | RPath] = Path,
#request{auth = Auth, lang = Lang, host = HostHTTP, #request{auth = Auth, lang = Lang, host = HostHTTP,
method = Method} = method = Method} =