fix(invites): include js/css deps in static dir
This commit is contained in:
@@ -19,7 +19,7 @@ RUN go install -v \
|
||||
FROM docker.io/erlang:${OTP_VSN}-alpine AS ejabberd
|
||||
|
||||
RUN apk -U add --no-cache \
|
||||
nodejs npm ca-certificates \
|
||||
ca-certificates \
|
||||
autoconf \
|
||||
automake \
|
||||
bash \
|
||||
@@ -33,6 +33,7 @@ RUN apk -U add --no-cache \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
linux-pam-dev \
|
||||
npm \
|
||||
openssl-dev \
|
||||
sqlite-dev \
|
||||
yaml-dev \
|
||||
@@ -54,15 +55,6 @@ COPY / $BUILD_DIR/
|
||||
|
||||
WORKDIR $BUILD_DIR
|
||||
|
||||
RUN npm init -y \
|
||||
&& npm install --silent jquery@3.7.1 bootstrap@4.6.2 \
|
||||
&& mkdir -p /rootfs/usr/share/javascript/bootstrap4/css \
|
||||
&& mkdir -p /rootfs/usr/share/javascript/bootstrap4/js \
|
||||
&& mkdir -p /rootfs/usr/share/javascript/jquery/ \
|
||||
&& cp -r node_modules/bootstrap/dist/css/bootstrap.min* /rootfs/usr/share/javascript/bootstrap4/css \
|
||||
&& cp -r node_modules/bootstrap/dist/js/bootstrap.min* /rootfs/usr/share/javascript/bootstrap4/js \
|
||||
&& cp -r node_modules/jquery/dist/jquery.min* /rootfs/usr/share/javascript/jquery/
|
||||
|
||||
RUN mv .github/container/ejabberdctl.template . \
|
||||
&& mv .github/container/ejabberd.yml.example . \
|
||||
&& ./autogen.sh \
|
||||
|
||||
@@ -47,3 +47,6 @@ Mnesia.nonode@nohost/
|
||||
/ejabberd-*.rpm
|
||||
/ejabberd-*.run
|
||||
/ejabberd-*.tar.gz
|
||||
/priv/mod_invites/static/bootstrap4/
|
||||
/priv/mod_invites/static/jquery/
|
||||
/node_modules/
|
||||
|
||||
+13
-2
@@ -212,7 +212,7 @@ endif
|
||||
|
||||
all: scripts deps src
|
||||
|
||||
deps: $(DEPSDIR)/.got
|
||||
deps: $(DEPSDIR)/.got invites-deps
|
||||
|
||||
$(DEPSDIR)/.got:
|
||||
rm -rf $(DEPSDIR)/.got
|
||||
@@ -224,6 +224,15 @@ $(DEPSDIR)/.got:
|
||||
$(DEPSDIR)/.built: $(DEPSDIR)/.got
|
||||
$(REBAR) compile && :> $(DEPSDIR)/.built
|
||||
|
||||
ifeq (, $(shell which npm))
|
||||
INSTALL_INVITES_DEPS=tools/dl_invites_page_deps.sh priv/mod_invites/static
|
||||
else
|
||||
INSTALL_INVITES_DEPS=npm install
|
||||
endif
|
||||
|
||||
invites-deps:
|
||||
$(INSTALL_INVITES_DEPS)
|
||||
|
||||
src: $(DEPSDIR)/.built
|
||||
$(REBAR) $(SKIPDEPS) compile
|
||||
$(EXPLICIT_ELIXIR_COMPILE)
|
||||
@@ -311,7 +320,8 @@ BINARIES=$(DEPSDIR)/epam/priv/bin/epam $(DEPSDIR)/eimp/priv/bin/eimp $(DEPSDIR)/
|
||||
DEPS_FILES_FILTERED=$(filter-out $(BINARIES) $(DEPSDIR)/elixir/ebin/elixir.app,$(DEPS_FILES))
|
||||
DEPS_DIRS=$(sort $(DEPSDIR)/ $(foreach DEP,$(DEPS),$(DEPSDIR)/$(DEP)/) $(dir $(DEPS_FILES)))
|
||||
|
||||
MAIN_FILES=$(filter-out %/configure.beam,$(call FILES_WILDCARD,$(EBINDIR)/*.beam $(EBINDIR)/*.app priv/msgs/*.msg priv/css/*.css priv/img/*.png priv/js/*.js priv/lib/* priv/mod_invites/* priv/mod_invites/static/* priv/mod_invites/static/logos/* include/*.hrl COPYING))
|
||||
MAIN_FILES=$(filter-out %/configure.beam,$(call FILES_WILDCARD,$(EBINDIR)/*.beam $(EBINDIR)/*.app priv/msgs/*.msg priv/css/*.css priv/img/*.png priv/js/*.js priv/lib/* priv/mod_invites/* priv/mod_invites/static/* priv/mod_invites/static/bootstrap4/css/bootstrap.min.css priv/mod_invites/static/bootstrap4/js/bootstrap.min.js priv/mod_invites/static/jquery/jquery.min.js \
|
||||
priv/mod_invites/static/logos/* include/*.hrl COPYING))
|
||||
MAIN_DIRS=$(sort $(dir $(MAIN_FILES)) priv/bin priv/sql priv/lua priv/mod_invites)
|
||||
|
||||
define DEP_VERSION_template
|
||||
@@ -553,6 +563,7 @@ clean:
|
||||
rm -rf test/*.beam
|
||||
rm -f rebar.lock
|
||||
rm -f ejabberdctl.example ejabberd.init ejabberd.service
|
||||
rm -rf priv/mod_invites/static/{jquery,bootstrap4}
|
||||
$(REBAR) clean $(CLEANARG)
|
||||
|
||||
clean-rel:
|
||||
|
||||
Generated
+56
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "ejabberd",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ejabberd",
|
||||
"version": "1.0.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bootstrap": "4.6.2",
|
||||
"jquery": "3.7.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz",
|
||||
"integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==",
|
||||
"deprecated": "This version of Bootstrap is no longer supported. Please upgrade to the latest version.",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"jquery": "1.9.1 - 3",
|
||||
"popper.js": "^1.16.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jquery": {
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
|
||||
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/popper.js": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
|
||||
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
|
||||
"deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "ejabberd",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"jquery": "3.7.1",
|
||||
"bootstrap": "4.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "npm run -s clean && npm run -s mkdir-jquery && npm run -s cp-jquery && npm run -s cp-bootstrap",
|
||||
"clean": "rm -rf priv/mod_invites/static/{jquery,bootstrap4}",
|
||||
"mkdir-jquery": "mkdir -p priv/mod_invites/static/jquery",
|
||||
"cp-jquery": "cp node_modules/jquery/dist/jquery.min.js priv/mod_invites/static/jquery/jquery.min.js",
|
||||
"cp-bootstrap": "cp -r node_modules/bootstrap/dist priv/mod_invites/static/bootstrap4"
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% blocktrans %}Invite to {{ site_name }}{% endblocktrans %}{% endblock %}</title>
|
||||
{% block rel_alternate %}{% endblock %}
|
||||
<link rel="stylesheet" href="/share/bootstrap4/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N">
|
||||
<link rel="stylesheet" href="{{ static }}/bootstrap4/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N">
|
||||
<!-- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> -->
|
||||
<!-- <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> -->
|
||||
<!-- <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> -->
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
{% block qr_code %}{% endblock %}
|
||||
{% block extra_scripts %}{% endblock %}
|
||||
<script src="/share/jquery/jquery.min.js" integrity="sha384-1H217gwSVyLSIfaLxHbE7dRb3v4mYCKbpQvzx0cegeju1MVsGrX5xXxAvs/HgeFs"></script>
|
||||
<script src="/share/bootstrap4/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"></script>
|
||||
<script src="{{ static }}/jquery/jquery.min.js" integrity="sha384-1H217gwSVyLSIfaLxHbE7dRb3v4mYCKbpQvzx0cegeju1MVsGrX5xXxAvs/HgeFs"></script>
|
||||
<script src="{{ static }}/bootstrap4/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+8
-24
@@ -125,28 +125,15 @@ mod_doc() ->
|
||||
"then guide the recipient with setting up a client "
|
||||
"and creating an account if required."),
|
||||
"",
|
||||
?T("In order to use the included landing page feature, you have to"),
|
||||
?T("In order to use the included landing page feature, you have to"
|
||||
" set `landing_page` to either `auto` or an URL template like "
|
||||
"`https://{{ host }}/invites/{{ invite.token }}` "
|
||||
" if your server setup includes a so called reverse proxy"),
|
||||
"",
|
||||
?T(" * have a copy of https://code.jquery.com/jquery-3.7.1.min.js[jQuery 3] and "
|
||||
" https://github.com/twbs/bootstrap/releases/download/v4.6.2/bootstrap-4.6.2-dist.zip[Bootstrap 4] "
|
||||
" in a shared directory on your system. If you're using Debian or "
|
||||
" derivatives this is easiest accomplished by installing both "
|
||||
" `libjs-jquery` and `libjs-bootstrap4` which will put them under "
|
||||
" `/usr/share/javascript/{jquery,bootstrap4}`. Alternatively you can use "
|
||||
" `tools/dl_invites_page_deps.sh <outdir>`."),
|
||||
?T(" * in `ejabberd.yml` configure a listener for module `ejabberd_http` "
|
||||
" with a request handler for `/share: mod_http_fileserver`"),
|
||||
?T(" * in the `modules` section configure `mod_http_fileserver` so that "
|
||||
" `docroot` points to the shared directory from above "
|
||||
" (e.g. `docroot: /usr/share/javascript`)"),
|
||||
?T(" * configure `mod_invites` and set `landing_page` to either `auto` "
|
||||
" or an URL template like `https://{{ host }}/invites/{{ invite.token }}` "
|
||||
" if your server setup includes a so called reverse proxy"),
|
||||
"",
|
||||
"If you'd rather want to use an external service, set `landing_page` "
|
||||
"to something like "
|
||||
"`http://{{ host }}:8080/easy-xmpp-invites/#{{ invite.uri|strip_protocol }}` "
|
||||
"or `https://invites.joinjabber.org/#{{ invite.uri|strip_protocol }}`."],
|
||||
?T("If you'd rather want to use an external service, set `landing_page` "
|
||||
"to something like "
|
||||
"`http://{{ host }}:8080/easy-xmpp-invites/#{{ invite.uri|strip_protocol }}` "
|
||||
"or `https://invites.joinjabber.org/#{{ invite.uri|strip_protocol }}`.")],
|
||||
note => "added in 26.01",
|
||||
opts =>
|
||||
[{access_create_account,
|
||||
@@ -208,11 +195,8 @@ mod_doc() ->
|
||||
" module: ejabberd_http",
|
||||
" request_handlers:",
|
||||
" /invites: mod_invites",
|
||||
" /share: mod_http_fileserver",
|
||||
"# [...]",
|
||||
"modules:",
|
||||
" mod_http_fileserver:",
|
||||
" docroot: /usr/share/javascript",
|
||||
" mod_invites:",
|
||||
" landing_page: auto"]},
|
||||
{?T("To allow only admin users to create invites of 'create account' and "
|
||||
|
||||
@@ -52,7 +52,8 @@
|
||||
|
||||
-define(DEFAULT_CONTENT_TYPE, <<"application/octet-stream">>).
|
||||
-define(CONTENT_TYPES,
|
||||
[{<<".js">>, <<"application/javascript">>},
|
||||
[{<<".css">>, <<"text/css">>},
|
||||
{<<".js">>, <<"application/javascript">>},
|
||||
{<<".png">>, <<"image/png">>},
|
||||
{<<".svg">>, <<"image/svg+xml">>}]).
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ bootstrap4="$(mktemp /tmp/bootstrap4.XXXXXXXXX)"
|
||||
curl -L -s -o $bootstrap4 https://github.com/twbs/bootstrap/releases/download/v4.6.2/bootstrap-4.6.2-dist.zip
|
||||
check $bootstrap4_checksum $bootstrap4
|
||||
|
||||
rm -rf "$install_dir/bootstrap4"
|
||||
unzip -q -d "$install_dir" $bootstrap4
|
||||
mv "$install_dir/bootstrap-4.6.2-dist" "$install_dir/bootstrap4"
|
||||
rm $bootstrap4
|
||||
|
||||
@@ -193,8 +193,6 @@ make_package()
|
||||
--provides 'xmpp-server' \
|
||||
--no-depends \
|
||||
--no-auto-depends \
|
||||
--deb-recommends 'libjs-jquery' \
|
||||
--deb-recommends 'libjs-bootstrap4' \
|
||||
--deb-maintainerscripts-force-errorchecks \
|
||||
--deb-systemd-enable \
|
||||
--deb-systemd-auto-start \
|
||||
|
||||
Reference in New Issue
Block a user