mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Update Guide links in WebAdmin to website, as local file isn't included
This commit is contained in:
parent
20205c66c1
commit
949e71efb6
@ -93,7 +93,7 @@
|
||||
-define(GL(Ref, Title),
|
||||
?XAE(<<"div">>, [{<<"class">>, <<"guidelink">>}],
|
||||
[?XAE(<<"a">>,
|
||||
[{<<"href">>, <<"/admin/doc/guide.html#", Ref/binary>>},
|
||||
[{<<"href">>, <<"https://docs.ejabberd.im/admin/configuration/#", Ref/binary>>},
|
||||
{<<"target">>, <<"_blank">>}],
|
||||
[?C(<<"[Guide: ", Title/binary, "]">>)])])).
|
||||
|
||||
|
@ -150,30 +150,6 @@ url_to_path(URL) -> str:tokens(URL, <<"/">>).
|
||||
%%%==================================
|
||||
%%%% 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,
|
||||
#request{auth = Auth, lang = Lang, host = HostHTTP,
|
||||
method = Method} =
|
||||
|
Loading…
Reference in New Issue
Block a user