Compare commits

...

3 Commits

Author SHA1 Message Date
Claire
acaac11c77
Merge 290f6d428d into 8b34daf254 2025-05-03 11:04:45 +00:00
Jonny Saunders
8b34daf254
Fix: Use strings not symbols to access totalItems in interaction collections (#34594)
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / test (3.3) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (3.3) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (3.3) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Bundler Audit / security (push) Has been cancelled
2025-05-03 10:37:06 +00:00
Claire
290f6d428d Change /api/v2/instance to be enabled without authentication when limited federation mode is enabled
Additionally, add `configuration.closed_federation` to indicate whether the
server has switched to limited federation.

Also sets `usage.users.active_month` to `0` in limited federation mode.
2025-04-29 15:59:28 +02:00
3 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class Api::V2::InstancesController < Api::BaseController
skip_before_action :require_authenticated_user!, unless: :limited_federation_mode?
skip_before_action :require_authenticated_user!
skip_around_action :set_locale
vary_by ''

View File

@ -95,11 +95,11 @@ class ActivityPub::Parser::StatusParser
end
def favourites_count
@object.dig(:likes, :totalItems)
@object.dig('likes', 'totalItems')
end
def reblogs_count
@object.dig(:shares, :totalItems)
@object.dig('shares', 'totalItems')
end
def quote_policy

View File

@ -49,7 +49,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
def usage
{
users: {
active_month: object.active_user_count(4),
active_month: limited_federation? ? 0 : object.active_user_count(4),
},
}
end
@ -99,6 +99,8 @@ class REST::InstanceSerializer < ActiveModel::Serializer
translation: {
enabled: TranslationService.configured?,
},
closed_federation: limited_federation?,
}
end
@ -127,6 +129,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
markdown.render(Setting.closed_registrations_message) if Setting.closed_registrations_message.present?
end
def limited_federation?
Rails.configuration.x.limited_federation_mode
end
def markdown
@markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, no_images: true)
end