• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

processone / ejabberd / 1212

18 Nov 2025 12:37PM UTC coverage: 33.784% (+0.003%) from 33.781%
1212

push

github

badlop
mod_conversejs: Improve link to conversejs in WebAdmin (#4495)

Until now, the WebAdmin menu included a link to the first request handler
with mod_conversejs that the admin configured in ejabberd.yml
That link included the authentication credentials hashed as URI arguments
if using HTTPS. Then process/2 extracted those arguments and passed them
as autologin options to Converse.

From now, mod_conversejs automatically adds a request_handler nested in
webadmin subpath. The webadmin menu links to that converse URI; this allows
to access the HTTP auth credentials, no need to explicitly pass them.
process/2 extracts this HTTP auth and passes autologin options to Converse.
Now scram password storage is supported too.

This minimum configuration allows WebAdmin to access Converse:

listen:
  -
    port: 5443
    module: ejabberd_http
    tls: true
    request_handlers:
      /admin: ejabberd_web_admin
      /ws: ejabberd_http_ws
modules:
  mod_conversejs:
    conversejs_resources: "/home/conversejs/12.0.0/dist"

0 of 12 new or added lines in 1 file covered. (0.0%)

11290 existing lines in 174 files now uncovered.

15515 of 45924 relevant lines covered (33.78%)

1277.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

35.71
/src/mod_proxy65_lib.erl
1
%%%----------------------------------------------------------------------
2
%%% File    : mod_proxy65_lib.erl
3
%%% Author  : Evgeniy Khramtsov <xram@jabber.ru>
4
%%% Purpose : SOCKS5 parsing library.
5
%%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru>
6
%%%
7
%%%
8
%%% ejabberd, Copyright (C) 2002-2025   ProcessOne
9
%%%
10
%%% This program is free software; you can redistribute it and/or
11
%%% modify it under the terms of the GNU General Public License as
12
%%% published by the Free Software Foundation; either version 2 of the
13
%%% License, or (at your option) any later version.
14
%%%
15
%%% This program is distributed in the hope that it will be useful,
16
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
17
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
%%% General Public License for more details.
19
%%%
20
%%% You should have received a copy of the GNU General Public License along
21
%%% with this program; if not, write to the Free Software Foundation, Inc.,
22
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
%%%
24
%%%----------------------------------------------------------------------
25

26
-module(mod_proxy65_lib).
27

28
-author('xram@jabber.ru').
29

30
-include("mod_proxy65.hrl").
31

32
-export([unpack_init_message/1, unpack_auth_request/1,
33
         unpack_request/1, make_init_reply/1, make_auth_reply/1,
34
         make_reply/1, make_error_reply/1, make_error_reply/2]).
35

36
unpack_init_message(<<(?VERSION_5), N,
37
                      AuthMethodList:N/binary>>)
38
    when N > 0, N < 256 ->
UNCOV
39
    {ok, binary_to_list(AuthMethodList)};
4✔
40
unpack_init_message(_) -> error.
×
41

42
unpack_auth_request(<<1, ULen, User:ULen/binary, PLen,
43
                      Pass:PLen/binary>>)
44
    when ULen < 256, PLen < 256 ->
45
    {(User), (Pass)};
×
46
unpack_auth_request(_) -> error.
×
47

48
unpack_request(<<(?VERSION_5), CMD, RSV,
49
                 (?ATYP_DOMAINNAME), 40, SHA1:40/binary, 0, 0>>)
50
    when CMD == (?CMD_CONNECT); CMD == (?CMD_UDP) ->
UNCOV
51
    Command = if CMD == (?CMD_CONNECT) -> connect;
4✔
52
                 CMD == (?CMD_UDP) -> udp
×
53
              end,
UNCOV
54
    #s5_request{cmd = Command, rsv = RSV, sha1 = (SHA1)};
4✔
55
unpack_request(_) -> error.
×
56

UNCOV
57
make_init_reply(Method) -> [?VERSION_5, Method].
4✔
58

59
make_auth_reply(true) -> [1, ?SUCCESS];
×
60
make_auth_reply(false) -> [1, ?ERR_NOT_ALLOWED].
×
61

62
make_reply(#s5_request{rsv = RSV, sha1 = SHA1}) ->
UNCOV
63
    [?VERSION_5, ?SUCCESS, RSV, ?ATYP_DOMAINNAME,
4✔
64
     byte_size(SHA1), SHA1, 0, 0].
65

66
make_error_reply(Request) ->
67
    make_error_reply(Request, ?ERR_NOT_ALLOWED).
×
68

69
make_error_reply(#s5_request{rsv = RSV, sha1 = SHA1},
70
                 Reason) ->
71
    [?VERSION_5, Reason, RSV, ?ATYP_DOMAINNAME,
×
72
     byte_size(SHA1), SHA1, 0, 0].
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc