mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 01:39:35 +02:00
Compare commits
3 commits
517776acd4
...
41318e45a5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
41318e45a5 | ||
![]() |
a94f227103 | ||
![]() |
f150419891 |
2 changed files with 40 additions and 3 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -146,7 +146,7 @@ jobs:
|
||||||
- name: Run XMPP Interoperability Tests against CI server.
|
- name: Run XMPP Interoperability Tests against CI server.
|
||||||
if: matrix.otp == '27'
|
if: matrix.otp == '27'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: XMPP-Interop-Testing/xmpp-interop-tests-action@v1.5.0
|
uses: XMPP-Interop-Testing/xmpp-interop-tests-action@v1.6.0
|
||||||
with:
|
with:
|
||||||
domain: 'localhost'
|
domain: 'localhost'
|
||||||
adminAccountUsername: 'admin'
|
adminAccountUsername: 'admin'
|
||||||
|
|
|
@ -64,6 +64,7 @@ process([], #request{method = 'GET', host = Host, q = Query, raw_path = RawPath1
|
||||||
CSS = get_file_url(Host, conversejs_css,
|
CSS = get_file_url(Host, conversejs_css,
|
||||||
<<RawPath/binary, "/converse.min.css">>,
|
<<RawPath/binary, "/converse.min.css">>,
|
||||||
<<"https://cdn.conversejs.org/dist/converse.min.css">>),
|
<<"https://cdn.conversejs.org/dist/converse.min.css">>),
|
||||||
|
PluginsHtml = get_plugins_html(Host, RawPath),
|
||||||
Init = [{<<"discover_connection_methods">>, false},
|
Init = [{<<"discover_connection_methods">>, false},
|
||||||
{<<"default_domain">>, Domain},
|
{<<"default_domain">>, Domain},
|
||||||
{<<"domain_placeholder">>, Domain},
|
{<<"domain_placeholder">>, Domain},
|
||||||
|
@ -89,7 +90,8 @@ process([], #request{method = 'GET', host = Host, q = Query, raw_path = RawPath1
|
||||||
<<"<meta charset='utf-8'>">>,
|
<<"<meta charset='utf-8'>">>,
|
||||||
<<"<link rel='stylesheet' type='text/css' media='screen' href='">>,
|
<<"<link rel='stylesheet' type='text/css' media='screen' href='">>,
|
||||||
fxml:crypt(CSS), <<"'>">>,
|
fxml:crypt(CSS), <<"'>">>,
|
||||||
<<"<script src='">>, fxml:crypt(Script), <<"' charset='utf-8'></script>">>,
|
<<"<script src='">>, fxml:crypt(Script), <<"' charset='utf-8'></script>">>
|
||||||
|
] ++ PluginsHtml ++ [
|
||||||
<<"</head>">>,
|
<<"</head>">>,
|
||||||
<<"<body>">>,
|
<<"<body>">>,
|
||||||
<<"<script>">>,
|
<<"<script>">>,
|
||||||
|
@ -115,6 +117,7 @@ is_served_file([<<"emojis.js">>]) -> true;
|
||||||
is_served_file([<<"locales">>, _]) -> true;
|
is_served_file([<<"locales">>, _]) -> true;
|
||||||
is_served_file([<<"locales">>, <<"dayjs">>, _]) -> true;
|
is_served_file([<<"locales">>, <<"dayjs">>, _]) -> true;
|
||||||
is_served_file([<<"webfonts">>, _]) -> true;
|
is_served_file([<<"webfonts">>, _]) -> true;
|
||||||
|
is_served_file([<<"plugins">>, _]) -> true;
|
||||||
is_served_file(_) -> false.
|
is_served_file(_) -> false.
|
||||||
|
|
||||||
serve(Host, LocalPath) ->
|
serve(Host, LocalPath) ->
|
||||||
|
@ -224,6 +227,25 @@ get_auto_file_url(Host, Filename, Default) ->
|
||||||
_ -> Filename
|
_ -> Filename
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
get_plugins_html(Host, RawPath) ->
|
||||||
|
Resources = get_conversejs_resources(Host),
|
||||||
|
lists:map(fun(F) ->
|
||||||
|
Plugin =
|
||||||
|
case {F, Resources} of
|
||||||
|
{<<"libsignal">>, undefined} ->
|
||||||
|
<<"https://cdn.conversejs.org/3rdparty/libsignal-protocol.min.js">>;
|
||||||
|
{<<"libsignal">>, Path} ->
|
||||||
|
?WARNING_MSG("~p is configured to use local Converse files "
|
||||||
|
"from path ~ts but the public plugin ~ts!",
|
||||||
|
[?MODULE, Path, F]),
|
||||||
|
<<"https://cdn.conversejs.org/3rdparty/libsignal-protocol.min.js">>;
|
||||||
|
_ ->
|
||||||
|
fxml:crypt(<<RawPath/binary, "plugins/", F/binary>>)
|
||||||
|
end,
|
||||||
|
<<"<script src='", Plugin/binary, "' charset='utf-8'></script>">>
|
||||||
|
end,
|
||||||
|
gen_mod:get_module_opt(Host, ?MODULE, conversejs_plugins)).
|
||||||
|
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
%% WebAdmin link and autologin
|
%% WebAdmin link and autologin
|
||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
|
@ -305,6 +327,8 @@ mod_opt_type(conversejs_script) ->
|
||||||
econf:binary();
|
econf:binary();
|
||||||
mod_opt_type(conversejs_css) ->
|
mod_opt_type(conversejs_css) ->
|
||||||
econf:binary();
|
econf:binary();
|
||||||
|
mod_opt_type(conversejs_plugins) ->
|
||||||
|
econf:list(econf:binary());
|
||||||
mod_opt_type(default_domain) ->
|
mod_opt_type(default_domain) ->
|
||||||
econf:host().
|
econf:host().
|
||||||
|
|
||||||
|
@ -315,6 +339,7 @@ mod_options(Host) ->
|
||||||
{conversejs_resources, undefined},
|
{conversejs_resources, undefined},
|
||||||
{conversejs_options, []},
|
{conversejs_options, []},
|
||||||
{conversejs_script, auto},
|
{conversejs_script, auto},
|
||||||
|
{conversejs_plugins, []},
|
||||||
{conversejs_css, auto}].
|
{conversejs_css, auto}].
|
||||||
|
|
||||||
mod_doc() ->
|
mod_doc() ->
|
||||||
|
@ -345,6 +370,7 @@ mod_doc() ->
|
||||||
"modules:",
|
"modules:",
|
||||||
" mod_bosh: {}",
|
" mod_bosh: {}",
|
||||||
" mod_conversejs:",
|
" mod_conversejs:",
|
||||||
|
" conversejs_plugins: [\"libsignal\"]",
|
||||||
" websocket_url: \"ws://@HOST@:5280/websocket\""]},
|
" websocket_url: \"ws://@HOST@:5280/websocket\""]},
|
||||||
{?T("Host Converse locally and let auto detection of WebSocket and Converse URLs:"),
|
{?T("Host Converse locally and let auto detection of WebSocket and Converse URLs:"),
|
||||||
["listen:",
|
["listen:",
|
||||||
|
@ -358,7 +384,9 @@ mod_doc() ->
|
||||||
"",
|
"",
|
||||||
"modules:",
|
"modules:",
|
||||||
" mod_conversejs:",
|
" mod_conversejs:",
|
||||||
" conversejs_resources: \"/home/ejabberd/conversejs-9.0.0/package/dist\""]},
|
" conversejs_resources: \"/home/ejabberd/conversejs-x.y.z/package/dist\"",
|
||||||
|
" conversejs_plugins: [\"libsignal-protocol.min.js\"]",
|
||||||
|
" # File path is: /home/ejabberd/conversejs-x.y.z/package/dist/plugins/libsignal-protocol.min.js"]},
|
||||||
{?T("Configure some additional options for Converse"),
|
{?T("Configure some additional options for Converse"),
|
||||||
["modules:",
|
["modules:",
|
||||||
" mod_conversejs:",
|
" mod_conversejs:",
|
||||||
|
@ -410,6 +438,15 @@ mod_doc() ->
|
||||||
"See https://conversejs.org/docs/html/configuration.html[Converse configuration]. "
|
"See https://conversejs.org/docs/html/configuration.html[Converse configuration]. "
|
||||||
"Only boolean, integer and string values are supported; "
|
"Only boolean, integer and string values are supported; "
|
||||||
"lists are not supported.")}},
|
"lists are not supported.")}},
|
||||||
|
{conversejs_plugins,
|
||||||
|
#{value => ?T("[Filename]"),
|
||||||
|
desc =>
|
||||||
|
?T("List of additional local files to include as scripts in the homepage. "
|
||||||
|
"Please make sure those files are available in the path specified in "
|
||||||
|
"'conversejs_resources' option, in subdirectory 'plugins/'. "
|
||||||
|
"If using the public Converse client, then '\"libsignal\"' "
|
||||||
|
"gets replaced with the URL of the public library. "
|
||||||
|
"The default value is '[]'.")}},
|
||||||
{conversejs_script,
|
{conversejs_script,
|
||||||
#{value => ?T("auto | URL"),
|
#{value => ?T("auto | URL"),
|
||||||
desc =>
|
desc =>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue