1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mastodon_ynh.git synced 2024-09-03 19:46:02 +02:00

Merge pull request #413 from YunoHost-Apps/revert-410-testing

Revert "Testing - Upgrade to v4.2.0 (#409)"
This commit is contained in:
Tagada 2023-09-25 22:15:16 +02:00 committed by GitHub
commit 0051a14832
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 7 deletions

View file

@ -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/

View file

@ -19,7 +19,7 @@ Si vous navez 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/

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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