Skip to content

Commit

Permalink
Merge pull request glitch-soc#2765 from ClearlyClaire/glitch-soc/merg…
Browse files Browse the repository at this point in the history
…e-upstream

Merge upstream changes up to df9e261
  • Loading branch information
ClearlyClaire authored Jul 4, 2024
2 parents 58f027a + e61a779 commit 05cfe04
Show file tree
Hide file tree
Showing 31 changed files with 186 additions and 47 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

All notable changes to this project will be documented in this file.

## [4.2.10] - 2024-07-04

### Security

- Fix incorrect permission checking on multiple API endpoints ([GHSA-58x8-3qxw-6hm7](https://github.com/mastodon/mastodon/security/advisories/GHSA-58x8-3qxw-6hm7))
- Fix incorrect authorship checking when processing some activities (CVE-2024-37903, [GHSA-xjvf-fm67-4qc3](https://github.com/mastodon/mastodon/security/advisories/GHSA-xjvf-fm67-4qc3))
- Fix ongoing streaming sessions not being invalidated when application tokens get revoked ([GHSA-vp5r-5pgw-jwqx](https://github.com/mastodon/mastodon/security/advisories/GHSA-vp5r-5pgw-jwqx))
- Update dependencies

### Added

- Add yarn version specification to avoid confusion with Yarn 3 and Yarn 4

### Changed

- Change preview cards generation to skip unusually long URLs ([oneiros](https://github.com/mastodon/mastodon/pull/30854))
- Change search modifiers to be case-insensitive ([Gargron](https://github.com/mastodon/mastodon/pull/30865))
- Change `STATSD_ADDR` handling to emit a warning rather than crashing if the address is unreachable ([timothyjrogers](https://github.com/mastodon/mastodon/pull/30691))
- Change PWA start URL from `/home` to `/` ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/27377))

### Removed

- Removed dependency on `posix-spawn` ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/18559))

### Fixed

- Fix scheduled statuses scheduled in less than 5 minutes being immediately published ([danielmbrasil](https://github.com/mastodon/mastodon/pull/30584))
- Fix encoding detection for link cards ([oneiros](https://github.com/mastodon/mastodon/pull/30780))
- Fix `/admin/accounts/:account_id/statuses/:id` for edited posts with media attachments ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/30819))
- Fix duplicate `@context` attribute in user archive export ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/30653))

## [4.2.9] - 2024-05-30

### Security
Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/scheduled_statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Api::V1::ScheduledStatusesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:statuses' }, except: [:update, :destroy]
before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:update, :destroy]

before_action :require_user!
before_action :set_statuses, only: :index
before_action :set_status, except: :index

Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/v1/statuses/translations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class Api::V1::Statuses::TranslationsController < Api::V1::Statuses::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:statuses' }
before_action :require_user!
before_action :set_translation

rescue_from TranslationService::NotConfiguredError, with: :not_found
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/api/v1/timelines/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
class Api::V1::Timelines::BaseController < Api::BaseController
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }

before_action :require_user!, if: :require_auth?

private

def require_auth?
!Setting.timeline_preview
end

def pagination_collection
@statuses
end
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/api/v1/timelines/link_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Api::V1::Timelines::LinkController < Api::V1::Timelines::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:statuses' }, only: :show, if: :require_auth?
before_action -> { authorize_if_got_token! :read, :'read:statuses' }
before_action :set_preview_card
before_action :set_statuses

Expand All @@ -17,10 +17,6 @@ def show

private

def require_auth?
!Setting.timeline_preview
end

def set_preview_card
@preview_card = PreviewCard.joins(:trend).merge(PreviewCardTrend.allowed).find_by!(url: params[:url])
end
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Api::V1::Timelines::PublicController < Api::V1::Timelines::BaseController
before_action :require_user!, only: [:show], if: :require_auth?
before_action -> { authorize_if_got_token! :read, :'read:statuses' }

PERMITTED_PARAMS = %i(local remote limit only_media allow_local_only).freeze

Expand All @@ -13,10 +13,6 @@ def show

private

def require_auth?
!Setting.timeline_preview
end

def load_statuses
preloaded_public_statuses_page
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/timelines/tag_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Api::V1::Timelines::TagController < Api::V1::Timelines::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:statuses' }, only: :show, if: :require_auth?
before_action -> { authorize_if_got_token! :read, :'read:statuses' }
before_action :load_tag

PERMITTED_PARAMS = %i(local limit only_media).freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio

def destroy
Web::PushSubscription.unsubscribe_for(params[:id], current_resource_owner)
Doorkeeper::Application.find_by(id: params[:id])&.close_streaming_sessions(current_resource_owner)
super
end

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"domain_pill.their_server": "O seu fogar dixital, onde están as súas publicacións.",
"domain_pill.their_username": "O seu identificador único no seu servidor. É posible atopar usuarias co mesmo nome de usuaria en diferentes servidores.",
"domain_pill.username": "Nome de usuaria",
"domain_pill.whats_in_a_handle": "Que é o alcume?",
"domain_pill.whats_in_a_handle": "As partes do alcume?",
"domain_pill.who_they_are": "O alcume dinos quen é esa persoa e onde está, para que poidas interactuar con ela en toda a web social de <button>plataformas ActivityPub</button>.",
"domain_pill.who_you_are": "Como o teu alcume informa de quen es e onde estás, as persoas poden interactuar contigo desde toda a web social de <button>plataformas ActivityPub</button>.",
"domain_pill.your_handle": "O teu alcume:",
Expand Down
8 changes: 7 additions & 1 deletion app/javascript/mastodon/locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"account.follow_back": "לעקוב בחזרה",
"account.followers": "עוקבים",
"account.followers.empty": "אף אחד לא עוקב אחר המשתמש הזה עדיין.",
"account.followers_counter": "{count, plural,one {עוקב אחד} other {{count} עוקבים}}",
"account.following": "נעקבים",
"account.following_counter": "{count, plural,one {עוקב אחרי {count}}other {עוקב אחרי {count}}}",
"account.follows.empty": "משתמש זה עדיין לא עוקב אחרי אף אחד.",
"account.go_to_profile": "מעבר לפרופיל",
"account.hide_reblogs": "להסתיר הידהודים מאת @{name}",
Expand All @@ -61,6 +63,7 @@
"account.requested_follow": "{name} ביקשו לעקוב אחריך",
"account.share": "שתף את הפרופיל של @{name}",
"account.show_reblogs": "הצג הדהודים מאת @{name}",
"account.statuses_counter": "{count, plural, one {הודעה אחת} two {הודעותיים} many {{count} הודעות} other {{count} הודעות}}",
"account.unblock": "להסיר חסימה ל- @{name}",
"account.unblock_domain": "הסירי את החסימה של קהילת {domain}",
"account.unblock_short": "הסר חסימה",
Expand Down Expand Up @@ -693,8 +696,11 @@
"server_banner.about_active_users": "משתמשים פעילים בשרת ב־30 הימים האחרונים (משתמשים פעילים חודשיים)",
"server_banner.active_users": "משתמשים פעילים",
"server_banner.administered_by": "מנוהל ע\"י:",
"server_banner.is_one_of_many": "{domain} הוא שרת אחד משרתי מסטודון עצמאיים רבים שדרגם תוכלו להשתתף בפדיוורס (רשת חברתית מבוזרת).",
"server_banner.server_stats": "סטטיסטיקות שרת:",
"sign_in_banner.create_account": "יצירת חשבון",
"sign_in_banner.follow_anyone": "תוכלו לעקוב אחרי כל משמתמש בפדיוורס ולקרוא הכל לפי סדר הפרסום בציר הזמן. אין אלגוריתמים, פרסומות, או קליקבייט מטעם בעלי הרשת.",
"sign_in_banner.mastodon_is": "מסטודון הוא הדרך הטובה ביותר לעקוב אחרי מה שקורה.",
"sign_in_banner.sign_in": "התחברות",
"sign_in_banner.sso_redirect": "התחברות/הרשמה",
"status.admin_account": "פתח/י ממשק ניהול עבור @{name}",
Expand Down Expand Up @@ -771,7 +777,7 @@
"timeline_hint.resources.followers": "עוקבים",
"timeline_hint.resources.follows": "נעקבים",
"timeline_hint.resources.statuses": "הודעות ישנות יותר",
"trends.counter_by_accounts": "{count, plural, one {אדם {count}} other {{count} א.נשים}} {days, plural, one {מאז אתמול} two {ביומיים האחרונים} other {במשך {days} הימים האחרונים}}",
"trends.counter_by_accounts": "{count, plural, one {אדם אחד} other {{count} א.נשים}} {days, plural, one {מאז אתמול} two {ביומיים האחרונים} other {במשך {days} הימים האחרונים}}",
"trends.trending_now": "נושאים חמים",
"ui.beforeunload": "הטיוטא תאבד אם תעזבו את מסטודון.",
"units.short.billion": "{count} מליארד",
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/locales/ia.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"home.pending_critical_update.link": "Vider actualisationes",
"home.pending_critical_update.title": "Actualisation de securitate critic disponibile!",
"home.show_announcements": "Monstrar annuncios",
"interaction_modal.description.favourite": "Con un conto sur Mastodon, tu pote marcar iste message como favorite pro informar le autor que tu lo apprecia e salveguarda pro plus tarde.",
"interaction_modal.description.favourite": "Con un conto sur Mastodon, tu pote marcar iste message como favorite pro informar le autor que tu lo apprecia e lo salva pro plus tarde.",
"interaction_modal.description.follow": "Con un conto sur Mastodon, tu pote sequer {name} e reciper su messages in tu fluxo de initio.",
"interaction_modal.description.reblog": "Con un conto sur Mastodon, tu pote impulsar iste message pro condivider lo con tu proprie sequitores.",
"interaction_modal.description.reply": "Con un conto sur Mastodon, tu pote responder a iste message.",
Expand Down Expand Up @@ -764,7 +764,7 @@
"status.unmute_conversation": "Non plus silentiar conversation",
"status.unpin": "Disfixar del profilo",
"subscribed_languages.lead": "Solmente le messages in le linguas seligite apparera in tu chronologias de initio e de listas post le cambiamento. Selige necun pro reciper messages in tote le linguas.",
"subscribed_languages.save": "Salveguardar le cambiamentos",
"subscribed_languages.save": "Salvar le cambiamentos",
"subscribed_languages.target": "Cambiar le linguas subscribite pro {target}",
"tabs_bar.home": "Initio",
"tabs_bar.notifications": "Notificationes",
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/mastodon/locales/sr-Latn.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"account.follow_back": "Uzvrati praćenje",
"account.followers": "Pratioci",
"account.followers.empty": "Još uvek niko ne prati ovog korisnika.",
"account.followers_counter": "{count, plural, one {{counter} pratilac} few {{counter} pratioca} other {{counter} pratilaca}}",
"account.following": "Prati",
"account.following_counter": "{count, plural, one {{counter} prati} few {{counter} prati} other {{counter} prati}}",
"account.follows.empty": "Ovaj korisnik još uvek nikog ne prati.",
"account.go_to_profile": "Idi na profil",
"account.hide_reblogs": "Sakrij podržavanja @{name}",
Expand All @@ -61,6 +63,7 @@
"account.requested_follow": "{name} je zatražio da vas prati",
"account.share": "Podeli profil korisnika @{name}",
"account.show_reblogs": "Prikaži podržavanja od korisnika @{name}",
"account.statuses_counter": "{count, plural, one {{counter} objava} few {{counter} objave} other {{counter} objava}}",
"account.unblock": "Odblokiraj korisnika @{name}",
"account.unblock_domain": "Odblokiraj domen {domain}",
"account.unblock_short": "Odblokiraj",
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/mastodon/locales/sr.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"account.follow_back": "Узврати праћење",
"account.followers": "Пратиоци",
"account.followers.empty": "Још увек нико не прати овог корисника.",
"account.followers_counter": "{count, plural, one {{counter} пратилац} few {{counter} пратиоца} other {{counter} пратилаца}}",
"account.following": "Прати",
"account.following_counter": "{count, plural, one {{counter} прати} few {{counter} прати} other {{counter} прати}}",
"account.follows.empty": "Овај корисник још увек никог не прати.",
"account.go_to_profile": "Иди на профил",
"account.hide_reblogs": "Сакриј подржавања од @{name}",
Expand All @@ -61,6 +63,7 @@
"account.requested_follow": "{name} је затражио да вас прати",
"account.share": "Подели профил корисника @{name}",
"account.show_reblogs": "Прикажи подржавања од корисника @{name}",
"account.statuses_counter": "{count, plural, one {{counter} објава} few {{counter} објаве} other {{counter} објава}}",
"account.unblock": "Одблокирај корисника @{name}",
"account.unblock_domain": "Одблокирај домен {domain}",
"account.unblock_short": "Одблокирај",
Expand Down
2 changes: 1 addition & 1 deletion app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def distribute
def find_existing_status
status = status_from_uri(object_uri)
status ||= Status.find_by(uri: @object['atomUri']) if @object['atomUri'].present?
status
status if status&.account_id == @account.id
end

def process_status_params
Expand Down
8 changes: 5 additions & 3 deletions app/lib/application_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module ApplicationExtension
# dependent: delete_all, which means the ActiveRecord callback in
# AccessTokenExtension is not run, so instead we manually announce to
# streaming that these tokens are being deleted.
before_destroy :push_to_streaming_api, prepend: true
before_destroy :close_streaming_sessions, prepend: true
end

def confirmation_redirect_uri
Expand All @@ -29,10 +29,12 @@ def redirect_uris
redirect_uri.split
end

def push_to_streaming_api
def close_streaming_sessions(resource_owner = nil)
# TODO: #28793 Combine into a single topic
payload = Oj.dump(event: :kill)
access_tokens.in_batches do |tokens|
scope = access_tokens
scope = scope.where(resource_owner_id: resource_owner.id) unless resource_owner.nil?
scope.in_batches do |tokens|
redis.pipelined do |pipeline|
tokens.ids.each do |id|
pipeline.publish("timeline:access_token:#{id}", payload)
Expand Down
8 changes: 4 additions & 4 deletions config/locales/ia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ ia:
enabled: Activate
inbox_url: URL del repetitor
pending: Attende le approbation del repetitor
save_and_enable: Salveguardar e activar
save_and_enable: Salvar e activar
setup: Crear un connexion con un repetitor
signatures_not_enabled: Le repetitores pote non functionar correctemente durante que le modo secur o le modo de federation limitate es activate
status: Stato
Expand Down Expand Up @@ -1276,7 +1276,7 @@ ia:
other: "%{count} messages individual celate"
title: Filtros
new:
save: Salveguardar nove filtro
save: Salvar nove filtro
title: Adder nove filtro
statuses:
back_to_filter: Retro al filtro
Expand All @@ -1294,14 +1294,14 @@ ia:
one: "<strong>%{count}</strong> elemento correspondente al recerca es seligite."
other: Tote le <strong>%{count}</strong> elementos correspondente al recerca es seligite.
cancel: Cancellar
changes_saved_msg: Cambios salveguardate con successo!
changes_saved_msg: Le cambiamentos ha essite salvate!
confirm: Confirmar
copy: Copiar
delete: Deler
deselect: Deseliger toto
none: Necun
order_by: Ordinar per
save_changes: Salvar le cambios
save_changes: Salvar le cambiamentos
select_all_matching_items:
one: Selige %{count} elemento correspondente a tu recerca.
other: Selige %{count} elementos correspondente a tu recerca.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ja:
backups_retention_period: ユーザーには、後でダウンロードするために投稿のアーカイブを生成する機能があります。正の値に設定すると、これらのアーカイブは指定された日数後に自動的にストレージから削除されます。
bootstrap_timeline_accounts: これらのアカウントは、新しいユーザー向けのおすすめユーザーの一番上にピン留めされます。
closed_registrations_message: アカウント作成を停止している時に表示されます
content_cache_retention_period: 他のサーバーからのすべての投稿(ブーストや返信を含む)は、指定された日数が経過すると、ローカルユーザーとのやりとりに関係なく削除されます。これには、ローカルユーザーがブックマークやお気に入りとして登録した投稿も含まれます。異なるサーバーのユーザー間の非公開な変身も失われ、復元することは不可能です。この設定の使用は特別な目的のインスタンスのためのものであり、一般的な目的のサーバーで使用するした場合、多くのユーザーの期待を裏切ることになります。
content_cache_retention_period: 他のサーバーからのすべての投稿(ブーストや返信を含む)は、指定された日数が経過すると、ローカルユーザーとのやりとりに関係なく削除されます。これには、ローカルユーザーがブックマークやお気に入りとして登録した投稿も含まれます。異なるサーバーのユーザー間の非公開な返信も失われ、復元することは不可能です。この設定の使用は特別な目的のインスタンスのためのものであり、一般的な目的のサーバーで使用した場合、多くのユーザーの期待を裏切ることになります。
custom_css: ウェブ版のMastodonでカスタムスタイルを適用できます。
favicon: デフォルトのMastodonのブックマークアイコンを独自のアイコンで上書きします。WEBP、PNG、GIF、JPGが利用可能です。
mascot: 上級者向けWebインターフェースのイラストを上書きします。
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:

web:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.9
image: ghcr.io/mastodon/mastodon:v4.2.10
restart: always
env_file: .env.production
command: bundle exec puma -C config/puma.rb
Expand All @@ -79,7 +79,7 @@ services:

streaming:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.9
image: ghcr.io/mastodon/mastodon:v4.2.10
restart: always
env_file: .env.production
command: node ./streaming
Expand All @@ -97,7 +97,7 @@ services:

sidekiq:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.9
image: ghcr.io/mastodon/mastodon:v4.2.10
restart: always
env_file: .env.production
command: bundle exec sidekiq
Expand Down
2 changes: 1 addition & 1 deletion lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def patch
end

def default_prerelease
'alpha.4'
'alpha.5'
end

def prerelease
Expand Down
2 changes: 1 addition & 1 deletion lib/sanitize_ext/sanitize_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module Config
end

MASTODON_STRICT = freeze_config(
elements: %w(p br span a abbr del pre blockquote code b strong u sub sup i em h1 h2 h3 h4 h5 ul ol li),
elements: %w(p br span a abbr del pre blockquote code b strong u sub sup i em h1 h2 h3 h4 h5 ul ol li ruby rt rp),

attributes: {
'a' => %w(href rel class title translate),
Expand Down
Loading

0 comments on commit 05cfe04

Please sign in to comment.