diff --git a/README.md b/README.md index 160988f..6a21cf4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! -**Shipped version:** 2.7.13~ynh5 +**Shipped version:** 2.8.6~ynh1 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index b2e0460..0113274 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! -**Version incluse :** 2.7.13~ynh5 +**Version incluse :** 2.8.6~ynh1 **Démo :** https://try.discourse.org diff --git a/check_process b/check_process index 0ab6265..88b9e72 100644 --- a/check_process +++ b/check_process @@ -14,6 +14,8 @@ upgrade=1 # 2.6.1~ynh2 upgrade=1 from_commit=c626379c98bb7f052061446cd152e4406979d49d + # 2.7.13~ynh5 + upgrade=1 from_commit=c1a386fa83c9278ba7bd58875b51e03606f84f13 backup_restore=1 # Activate multi-instance test only if you have more than 2Gb RAM! multi_instance=0 diff --git a/conf/app.src b/conf/app.src index 9f59e18..fde689e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.13.tar.gz -SOURCE_SUM=29905c395311844fb3dacbbc11de37d3147ec45fc6c5f0a68b5d8ea98a2bc364 +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.8.6.tar.gz +SOURCE_SUM=15df26119cfe296da82902d1876ef28ddd2f33465c940357322ba183bf3fa443 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/discourse_defaults.conf b/conf/discourse_defaults.conf index 9747b30..39276eb 100644 --- a/conf/discourse_defaults.conf +++ b/conf/discourse_defaults.conf @@ -173,7 +173,7 @@ message_bus_redis_skip_client_commands = false enable_cors = false cors_origin = '' -# enable if you really need to serve assets in prd +# enable if you really need to serve assets in prod serve_static_assets = true # number of sidekiq workers (launched via unicorn master) @@ -210,7 +210,7 @@ secret_key_base = fallback_assets_path = # S3 settings used for serving ALL public files -# be sure to configre a CDN as well per cdn_url +# be sure to configure a CDN as well per cdn_url s3_bucket = s3_region = s3_access_key_id = @@ -225,7 +225,7 @@ s3_install_cors_rule = max_user_api_reqs_per_minute = 20 max_user_api_reqs_per_day = 2880 -max_admin_api_reqs_per_key_per_minute = 60 +max_admin_api_reqs_per_minute = 60 max_reqs_per_ip_per_minute = 200 max_reqs_per_ip_per_10_seconds = 50 @@ -239,6 +239,9 @@ max_reqs_per_ip_mode = block # bypass rate limiting any IP resolved as a private IP max_reqs_rate_limit_on_private = false +# use per user rate limits vs ip rate limits for users with this trust level or more. +skip_per_ip_rate_limit_trust_level = 1 + # logged in DoS protection # protection will only trigger for requests that queue longer than this amount @@ -315,7 +318,7 @@ anon_cache_store_threshold = 2 # you may restrict it so only specific themes are approved # in allowlist mode all theme updates must happen via git repos # themes missing from the list are automatically disallowed -# list is a comma seperated list of git repos eg: +# list is a comma separated list of git repos eg: # https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git allowed_theme_repos = @@ -336,3 +339,12 @@ max_digests_enqueued_per_30_mins_per_site = 10000 # This cluster name can be passed to the /srv/status route to verify # the application cluster is the same one you are expecting cluster_name = + +# The YAML file used to configure multisite clusters +multisite_config_path = config/multisite.yml + +# If false, only short (regular) polling will be attempted +enable_long_polling = + +# Length of time to hold open a long polling connection in milliseconds +long_polling_interval = diff --git a/manifest.json b/manifest.json index 9449bbf..552c0f2 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.13~ynh5", + "version": "2.8.6~ynh1", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", diff --git a/scripts/_common.sh b/scripts/_common.sh index e95268c..10d395d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,10 +5,13 @@ #================================================= # dependencies used by the app -pkg_dependencies="g++ libjemalloc1|libjemalloc2 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" -build_pkg_dependencies="" +#pkg_dependencies="g++ libjemalloc1|libjemalloc2 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" +pkg_dependencies="postgresql postgresql-client postgresql-contrib imagemagick libjemalloc1|libjemalloc2" +build_pkg_dependencies="libcurl4-openssl-dev libyaml-dev libxml2-dev libpq-dev libreadline-dev brotli libunwind-dev libtcmalloc-minimal4 cmake pngcrush pngquant advancecomp jhead jpegoptim libjpeg-turbo-progs optipng" -ruby_version="2.7.1" +ruby_version="2.7.6" + +nodejs_version="16" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 8831a38..9509e6c 100644 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,9 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # CREATE DEDICATED USER @@ -186,13 +188,21 @@ if [ -n "$(uname -m | grep arm)" ] ; then ln -s $(ldconfig -p | grep libpsl | awk 'END {print $NF}') libpsl.so) fi +pushd "$final_path" + ynh_use_nodejs + ynh_npm install --location=global terser + ynh_npm install --location=global uglify-js + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --production --frozen-lockfile + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn cache clean +popd + #================================================= # PREPARE THE DATABASE #================================================= ynh_script_progression --message="Preparing the database..." -ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake db:migrate -ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/bundle exec rake db:migrate +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/bundle exec rake themes:update assets:precompile ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_package_autoremove diff --git a/scripts/remove b/scripts/remove index 9e27c5d..1d5f13c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -89,6 +89,7 @@ ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies +ynh_remove_nodejs ynh_remove_ruby #================================================= diff --git a/scripts/restore b/scripts/restore index 204178d..e346337 100644 --- a/scripts/restore +++ b/scripts/restore @@ -78,7 +78,9 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE THE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index a83c554..a0853c8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -183,7 +183,9 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_use_ruby #================================================= @@ -270,6 +272,14 @@ then ln -s $(ldconfig -p | grep libpsl | awk 'END {print $NF}') libpsl.so ) fi + + pushd "$final_path" + ynh_use_nodejs + ynh_npm install --location=global terser + ynh_npm install --location=global uglify-js + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --production --frozen-lockfile + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn cache clean + popd fi #================================================= @@ -280,8 +290,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Preparing the database..." - ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake db:migrate - ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile + ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/bundle exec rake db:migrate + ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/bundle exec rake themes:update assets:precompile fi ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies diff --git a/sources/patches/app-1-use-latest_uglify-js.patch b/sources/patches/app-1-use-latest_uglify-js.patch index 5af4246..415ec9e 100644 --- a/sources/patches/app-1-use-latest_uglify-js.patch +++ b/sources/patches/app-1-use-latest_uglify-js.patch @@ -2,11 +2,13 @@ diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 4a02d5f1b1..7b47f21658 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake -@@ -94,6 +94,7 @@ def compress_ruby(from, to) +@@ -126,6 +126,9 @@ data = File.read("#{assets_path}/#{from}") - + uglified, map = Uglifier.new(comments: :none, + harmony: true, ++ mangle: false, ++ compress: false, source_map: { filename: File.basename(from), output_filename: File.basename(to) diff --git a/sources/patches/app-4-fix-missing-git-repository.patch b/sources/patches/app-4-fix-missing-git-repository.patch index c02d177..a98afb6 100644 --- a/sources/patches/app-4-fix-missing-git-repository.patch +++ b/sources/patches/app-4-fix-missing-git-repository.patch @@ -3,20 +3,20 @@ index 2b53a91eb3..eec55647d5 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -439,7 +439,7 @@ module Discourse - $full_version ||= - begin - git_cmd = 'git describe --dirty --match "v[0-9]*"' -- self.try_git(git_cmd, 'unknown') -+ self.try_git(git_cmd, Discourse::VERSION::STRING) - end + def self.full_version + @full_version ||= begin + git_cmd = 'git describe --dirty --match "v[0-9]*" 2> /dev/null' +- self.try_git(git_cmd, 'unknown') ++ self.try_git(git_cmd, Discourse::VERSION::STRING) + end end @@ -448,7 +448,7 @@ module Discourse - $last_commit_date ||= - begin - git_cmd = 'git log -1 --format="%ct"' -- seconds = self.try_git(git_cmd, nil) -+ seconds = '1563199245' # Note(decentral1se): Output from actual command in the v2.3.2 branch - seconds.nil? ? nil : DateTime.strptime(seconds, '%s') - end + def self.last_commit_date + @last_commit_date ||= begin + git_cmd = 'git log -1 --format="%ct"' +- seconds = self.try_git(git_cmd, nil) ++ seconds = '1563199245' # Note(decentral1se): Output from actual command in the v2.3.2 branch + seconds.nil? ? nil : DateTime.strptime(seconds, '%s') + end end diff --git a/sources/patches/app-5-fix-admin-watched-words-action.patch b/sources/patches/app-5-fix-admin-watched-words-action.patch new file mode 100644 index 0000000..a431d71 --- /dev/null +++ b/sources/patches/app-5-fix-admin-watched-words-action.patch @@ -0,0 +1,15 @@ +diff --git a/app/assets/javascripts/admin/addon/controllers/admin-watched-words-action.js b/app/assets/javascripts/admin/addon/controllers/admin-watched-words-action.js +index 2b53a91eb3..eec55647d5 100644 +--- a/app/assets/javascripts/admin/addon/controllers/admin-watched-words-action.js ++++ b/app/assets/javascripts/admin/addon/controllers/admin-watched-words-action.js +@@ -32,9 +32,9 @@ + for (const { regexp, word } of words) { + try { + RegExp(regexp); +- } catch { ++ } catch (err) { + return I18n.t("admin.watched_words.invalid_regex", { word }); + } + } + }, + diff --git a/sources/patches/app-6-fix-download-calendar.patch b/sources/patches/app-6-fix-download-calendar.patch new file mode 100644 index 0000000..580e10d --- /dev/null +++ b/sources/patches/app-6-fix-download-calendar.patch @@ -0,0 +1,13 @@ +diff --git a/app/assets/javascripts/discourse/app/lib/download-calendar.js b/app/assets/javascripts/discourse/app/lib/download-calendar.js +index 2b53a91eb3..eec55647d5 100644 +--- a/app/assets/javascripts/discourse/app/lib/download-calendar.js ++++ b/app/assets/javascripts/discourse/app/lib/download-calendar.js +@@ -22,7 +22,7 @@ + } + + export function downloadIcs(title, dates) { +- const REMOVE_FILE_AFTER = 20_000; ++ const REMOVE_FILE_AFTER = 20000; + const file = new File([generateIcsData(title, dates)], { + type: "text/plain", + }); diff --git a/sources/patches/app-7-fix-uppy-upload.patch b/sources/patches/app-7-fix-uppy-upload.patch new file mode 100644 index 0000000..6af3580 --- /dev/null +++ b/sources/patches/app-7-fix-uppy-upload.patch @@ -0,0 +1,13 @@ +diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +index 2b53a91eb3..eec55647d5 100644 +--- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js ++++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +@@ -21,7 +21,7 @@ + import { warn } from "@ember/debug"; + import bootbox from "bootbox"; + +-export const HUGE_FILE_THRESHOLD_BYTES = 104_857_600; // 100MB ++export const HUGE_FILE_THRESHOLD_BYTES = "104_857_600"; // 100MB + + export default Mixin.create(UppyS3Multipart, { + uploading: false,