From 69aaec95d9ab2a94dfc12fe62f6e9349e1b922c0 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:14:46 +0200 Subject: [PATCH] Revert "Testing - Upgrade to v4.2.0 (#409)" --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 +-- manifest.json | 4 +-- scripts/_common.sh | 2 +- sources/patches/app-sso.patch | 56 +++++++++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 sources/patches/app-sso.patch diff --git a/README.md b/README.md index 22d8f00..615b9fb 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Mastodon is a free, open-source microblogging social network. It is a decentralized alternative to commercial platforms like Twitter and avoids the risks of a single company monopolizing your communication for commercial purposes. -**Shipped version:** 4.2.0~ynh1 +**Shipped version:** 4.1.9~ynh1 **Demo:** https://joinmastodon.org/ diff --git a/README_fr.md b/README_fr.md index 086d648..b7d4faf 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Mastodon est un réseau social de microblog auto-hébergé et open source. C'est une alternative décentralisée aux plates-formes commerciales comme Twitter. Mastodon évite ainsi les risques qu'une seule société monopolise votre communication à des fins commerciales. -**Version incluse :** 4.2.0~ynh1 +**Version incluse :** 4.1.9~ynh1 **Démo :** https://joinmastodon.org/ diff --git a/conf/app.src b/conf/app.src index 641cd1f..4e5bd2f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/tootsuite/mastodon/archive/refs/tags/v4.2.0.tar.gz -SOURCE_SUM=97c6bd9eb31efb96b10f78f6397de93a49ce8fa7237ffd73c7407f5d9692dfea +SOURCE_URL=https://github.com/tootsuite/mastodon/archive/refs/tags/v4.1.9.tar.gz +SOURCE_SUM=1b0233b1141f64d146d5f9717df1548a162a13df9e028603536226c169c20d2e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index fae5b7e..2387640 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Libre and federated social network", "fr": "Réseau social libre et fédéré" }, - "version": "4.2.0~ynh1", + "version": "4.1.9~ynh1", "url": "https://github.com/mastodon/mastodon", "upstream": { "license": "AGPL-3.0-or-later", @@ -49,7 +49,7 @@ }, { "name": "language", - "type": "select", + "type": "string", "ask": { "en": "Choose the application language", "fr": "Choisissez la langue de l'application" diff --git a/scripts/_common.sh b/scripts/_common.sh index d6028ea..8fb5cec 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git build_pkg_dependencies="" memory_needed="2560" -ruby_version=3.2.2 +ruby_version=3.0.6 nodejs_version=16 # Workaround for Mastodon on Bullseye diff --git a/sources/patches/app-sso.patch b/sources/patches/app-sso.patch new file mode 100644 index 0000000..72f738e --- /dev/null +++ b/sources/patches/app-sso.patch @@ -0,0 +1,56 @@ +diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb +index 7c36bc6b8..3f691d102 100644 +--- a/app/controllers/application_controller.rb ++++ b/app/controllers/application_controller.rb +@@ -69,7 +69,7 @@ class ApplicationController < ActionController::Base + end + + def after_sign_out_path_for(_resource_or_scope) +- new_user_session_path ++ "https://#{File.read('/etc/yunohost/current_host')}/yunohost/sso/?action=logout" + end + + protected +diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb +index 5232e6cfd..160348674 100644 +--- a/config/initializers/devise.rb ++++ b/config/initializers/devise.rb +@@ -180,7 +180,7 @@ Devise.setup do |config| + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. The supported strategies are: + # :database = Support basic authentication with authentication key + password +- config.http_authenticatable = [:pam, :database] ++ config.http_authenticatable = [:two_factor_ldap, :pam, :database] + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true +diff --git a/lib/devise/two_factor_ldap_authenticatable.rb b/lib/devise/two_factor_ldap_authenticatable.rb +index 065aa2de8..0eb4be10c 100644 +--- a/lib/devise/two_factor_ldap_authenticatable.rb ++++ b/lib/devise/two_factor_ldap_authenticatable.rb +@@ -5,13 +5,13 @@ require 'devise/strategies/base' + + module Devise + module Strategies +- class TwoFactorLdapAuthenticatable < Base ++ class TwoFactorLdapAuthenticatable < Authenticatable + def valid? +- valid_params? && mapping.to.respond_to?(:authenticate_with_ldap) ++ (valid_for_params_auth? || valid_for_http_auth?) && mapping.to.respond_to?(:authenticate_with_ldap) + end + + def authenticate! +- resource = mapping.to.authenticate_with_ldap(params[scope]) ++ resource = mapping.to.authenticate_with_ldap(authentication_hash.merge(:password => password)) + + if resource && !resource.otp_required_for_login? + success!(resource) +@@ -23,7 +23,7 @@ module Devise + protected + + def valid_params? +- params[scope] && params[scope][:password].present? ++ super && params[scope][:password].present? + end + end + end