diff --git a/dd-apps/docker/nextcloud/Dockerfile b/dd-apps/docker/nextcloud/Dockerfile index 6ade834..dfdea19 100644 --- a/dd-apps/docker/nextcloud/Dockerfile +++ b/dd-apps/docker/nextcloud/Dockerfile @@ -82,9 +82,11 @@ COPY saml.sh / COPY template.docx / ## Save current forms plugin hash -RUN sh -c 'curl -sL https://api.github.com/repos/3iPunt/nextcloud_forms/commits/STABLE_25 | jq -r .sha > /forms.hash' +#RUN sh -c 'curl -sL https://api.github.com/repos/3iPunt/nextcloud_forms/commits/STABLE_25 | jq -r .sha > /forms.hash' ## And current forms code -RUN sh -c 'curl -sL "https://github.com/3iPunt/nextcloud_forms/archive/$(cat /forms.hash).zip" > /forms.zip' +#RUN sh -c 'curl -sL "https://github.com/3iPunt/nextcloud_forms/archive/$(cat /forms.hash).zip" > /forms.zip' +# Mail app patches. To remove in NC 25 +COPY nc_mail/ /nc_mail/ # Setup cron as documented in: # https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/cron/fpm-alpine/Dockerfile diff --git a/dd-apps/docker/nextcloud/dd-patch b/dd-apps/docker/nextcloud/dd-patch index fb3241e..72f2848 100644 --- a/dd-apps/docker/nextcloud/dd-patch +++ b/dd-apps/docker/nextcloud/dd-patch @@ -2,4 +2,7 @@ # file license author source nginx.conf AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/docker/04ab3157e4f1197a9f8f4b91cf2430586356dd9a/.examples/docker-compose/with-nginx-proxy/postgres/fpm/web/nginx.conf supervisord.conf AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/docker/04ab3157e4f1197a9f8f4b91cf2430586356dd9a/.examples/dockerfiles/cron/fpm-alpine/supervisord.conf -src/themes/dd/core/templates/layout.user.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/server/v25.0.4/core/templates/layout.user.php +nc_mail/appinfo/info.xml AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/v1.15.2/appinfo/info.xml +nc_mail/lib/Command/UpdateAccount.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/1e777a1783254bd4b7f69f39a6c5123323f8b701/lib/Command/UpdateAccount.php +nc_mail/lib/Db/MailAccountMapper.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/mail/1e777a1783254bd4b7f69f39a6c5123323f8b701/lib/Db/MailAccountMapper.php +src/themes/dd/core/templates/layout.user.php AGPL-3.0-or-later https://github.com/nextcloud/ https://raw.githubusercontent.com/nextcloud/server/v21.0.9/core/templates/layout.user.php diff --git a/dd-apps/docker/nextcloud/nc-setup.sh b/dd-apps/docker/nextcloud/nc-setup.sh index 5ab35eb..86b2fe5 100755 --- a/dd-apps/docker/nextcloud/nc-setup.sh +++ b/dd-apps/docker/nextcloud/nc-setup.sh @@ -20,10 +20,7 @@ plugin_status() { printf "%s\t%s" "enabled" "${version}" else version="$(echo "${plugins_state}" | jq -r ".disabled.${plugin}")" - is_available="$(echo "${plugins_state}" | jq -r \ - --arg plugin "${plugin}" \ - '.disabled | to_entries[] | select(.key == $plugin) | .key')" - if [ "${is_available}" = "${plugin}" ]; then + if [ "${version}" != "null" ]; then printf "%s\t%s" "disabled" "${version}" else printf "%s\t%s" "n/a" "n/a" @@ -52,20 +49,6 @@ cat > "${STATIC_CFG}" < '', 'theme' => 'dd', 'allow_local_remote_servers' => true, - 'enabledPreviewProviders' => [ - 'OC\\Preview\\PNG', - 'OC\\Preview\\JPEG', - 'OC\\Preview\\GIF', - 'OC\\Preview\\BMP', - 'OC\\Preview\\XBitmap', - 'OC\\Preview\\MP3', - 'OC\\Preview\\TXT', - 'OC\\Preview\\MarkDown', - 'OC\\Preview\\OpenDocument', - 'OC\\Preview\\Krita', - 'OC\\Preview\\Movie', - 'OC\\Preview\\MP4', - ], ); EOF @@ -74,8 +57,8 @@ occupgrade # These cannot be edited from outside of the DD project # Operators should instead rely on the environment variables to ease deployment # EXTRA_PLUGINS_ENABLE and EXTRA_PLUGINS_DISABLE -CORE_PLUGINS_ENABLE="user_saml,bruteforcesettings,polls,calendar,spreed,bbb,mail,onlyoffice" -CORE_PLUGINS_DISABLE="firstrunwizard,recommendations,dashboard,circles,ownpad" +CORE_PLUGINS_ENABLE="user_saml,bruteforcesettings,polls,calendar,spreed,bbb,mail,ownpad,onlyoffice" +CORE_PLUGINS_DISABLE="firstrunwizard,recommendations,dashboard,circles,forms" if [ "${DISABLE_CLAMAV:-true}" = "false" ]; then CORE_PLUGINS_ENABLE="${CORE_PLUGINS_ENABLE},files_antivirus" @@ -90,7 +73,7 @@ PLUGINS="${CORE_PLUGINS_ENABLE},${CORE_PLUGINS_DISABLE},${EXTRA_PLUGINS_ENABLE:- # Install all plugins # shellcheck disable=SC2086 # We do want multiple arguments for plugin in $(echo "${PLUGINS}" | tr ',' '\n'); do - if plugin_status "${plugin}" | grep -qE "^n/a"; then + if plugin_status "${plugin}" | grep -q "n/a"; then echo "--> Installing ${plugin}" ./occ --no-warnings app:install "${plugin}" fi @@ -135,32 +118,40 @@ done occupgrade +# Temporary patch while upstream lands our changes +# See: https://github.com/nextcloud/mail/pull/6908 +for f in appinfo/info.xml lib/Command/UpdateAccount.php lib/Db/MailAccountMapper.php; do + install -m 0644 -o www-data -g www-data "/nc_mail/$f" "/var/www/html/custom_apps/mail/$f" +done + +occupgrade ## Forms -## This should be upstreamed, see: -## https://github.com/juanan3ip/form/issues/76 -## This is what is being used: https://github.com/3iPunt/nextcloud_forms -FORMS_EXPECTED_HASH="$(cat /forms.hash)" -FORMS_DIR="/var/www/html/custom_apps/forms" -FORMS_HASH="" -if [ -f "${FORMS_DIR}.hash" ]; then - FORMS_HASH="$(cat "${FORMS_DIR}.hash")" -fi -if [ "${FORMS_EXPECTED_HASH}" != "${FORMS_HASH}" ]; then - # Remove old plugin - rm -rf "${FORMS_DIR}" - # Install new one - unzip -o /forms.zip -d /tmp - mv "/tmp/nextcloud_forms-${FORMS_EXPECTED_HASH}" "${FORMS_DIR}" - # Perform config / install - npm --prefix "${FORMS_DIR}" install - composer --ignore-platform-req=ext-dom -d"${FORMS_DIR}" install --no-dev -o - # Place hash marker - cp /forms.hash "${FORMS_DIR}.hash" -fi -if plugin_status "${plugin}" | grep -qE "^disabled"; then - ./occ app:enable forms -fi +# TODO: This is broken in NC 24 due to: +# https://github.com/nextcloud/forms/pull/1149/files +## TODO: request explanations and reduce upstream diff +## This is what is being used: https://github.com/juanan3ip/form +#FORMS_EXPECTED_HASH="$(cat /forms.hash)" +#FORMS_DIR="/var/www/html/custom_apps/forms" +#FORMS_HASH="" +#if [ -f "${FORMS_DIR}.hash" ]; then +# FORMS_HASH="$(cat "${FORMS_DIR}.hash")" +#fi +#if [ "${FORMS_EXPECTED_HASH}" != "${FORMS_HASH}" ]; then +# # Remove old plugin +# rm -rf "${FORMS_DIR}" +# # Install new one +# unzip -o /forms.zip -d /tmp +# mv "/tmp/form-${FORMS_EXPECTED_HASH}" "${FORMS_DIR}" +# # Perform config / install +# npm --prefix "${FORMS_DIR}" install +# composer --ignore-platform-req=ext-dom -d"${FORMS_DIR}" install --no-dev -o +# # Place hash marker +# cp /forms.hash "${FORMS_DIR}.hash" +#fi +#if plugin_status "${plugin}" | grep -qE "^disabled"; then +# ./occ app:enable forms +#fi # #occupgrade @@ -188,8 +179,27 @@ sed -i.orig \ -e 's/\(^\s*"Let.s go!" : [^¡]*\)¡\?\([^!]*\)!\(.*\)$/\1\2\3/' \ /var/www/html/custom_apps/bbb/l10n/*.json +# Patches / fixes for Ownpad +## Fix mimetypemapping for ownpad +MIMETYPEMAPPINGJSON="/var/www/html/config/mimetypemapping.json" +if ! grep -q "application/x-ownpad" "${MIMETYPEMAPPINGJSON}"; then + jq '. + {"pad": ["application/x-ownpad"], "calc": ["application/x-ownpad"]}' \ + /var/www/html/resources/config/mimetypemapping.dist.json > "${MIMETYPEMAPPINGJSON}" + # We have to tell NC about this change as documented here: + # https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#maintenance-commands + ./occ maintenance:mimetype:update-db +fi +## Open pads on new tab/window +OWNPADJS="/var/www/html/custom_apps/ownpad/js/ownpad.js" +if ! grep -q viewerDD "${OWNPADJS}"; then + ## TODO: Upstream this as a toggeable setting + sed -i.orig 's/^\(\s*\)var viewer = \(OC.generateUrl.*\)/\1var viewerDD = \2; window.open(viewerDD); return;/' "${OWNPADJS}" +fi + # Settings echo "--> Applying custom settings" +./occ --no-warnings config:app:set -n ownpad ownpad_etherpad_enable --value="yes" +./occ --no-warnings config:app:set -n ownpad ownpad_etherpad_host --value="https://pad.$DOMAIN" ./occ --no-warnings config:app:set -n onlyoffice DocumentServerUrl --value="https://oof.$DOMAIN" ./occ --no-warnings config:app:set -n onlyoffice jwt_secret --value="secret"