Merge pull request #3542 from glitch-soc/glitch-soc/merge-upstream

Merge upstream changes up to a951cf3011
This commit is contained in:
Claire authored and GitHub committed 2026-06-19 23:27:05 +02:00
commit 9cfcd5384b
42 files changed
+503 -40

No files matched your search

+2
View File
@@ -231,3 +231,5 @@ gem 'hcaptcha', '~> 7.1'
gem 'mail', '~> 2.8'
gem 'vite_rails'
gem 'base58', '~> 0.2.3'
+2
View File
@@ -119,6 +119,7 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
azure-blob (0.5.9.1)
rexml
base58 (0.2.3)
base64 (0.3.0)
bcp47_spec (0.2.1)
bcrypt (3.1.22)
@@ -950,6 +951,7 @@ DEPENDENCIES
annotaterb (~> 4.13)
aws-sdk-core
aws-sdk-s3 (~> 1.123)
base58 (~> 0.2.3)
better_errors (~> 2.9)
binding_of_caller
blurhash (~> 0.1)
@@ -44,30 +44,30 @@ class ActivityPub::FeaturedCollectionsController < ApplicationController
end
def next_page_url
ap_account_featured_collections_url(@account, page: @collections.next_page) if @collections.respond_to?(:next_page)
ap_account_featured_collections_url(@account.id, page: @collections.next_page) if @collections.respond_to?(:next_page)
end
def prev_page_url
ap_account_featured_collections_url(@account, page: @collections.prev_page) if @collections.respond_to?(:prev_page)
ap_account_featured_collections_url(@account.id, page: @collections.prev_page) if @collections.respond_to?(:prev_page)
end
def collection_presenter
if page_requested?
ActivityPub::CollectionPresenter.new(
id: ap_account_featured_collections_url(@account, page: params.fetch(:page, 1)),
id: ap_account_featured_collections_url(@account.id, page: params.fetch(:page, 1)),
type: :unordered,
size: @account.collections.count,
items: @collections,
part_of: ap_account_featured_collections_url(@account),
part_of: ap_account_featured_collections_url(@account.id),
next: next_page_url,
prev: prev_page_url
)
else
ActivityPub::CollectionPresenter.new(
id: ap_account_featured_collections_url(@account),
id: ap_account_featured_collections_url(@account.id),
type: :unordered,
size: @account.collections.count,
first: ap_account_featured_collections_url(@account, page: 1)
first: ap_account_featured_collections_url(@account.id, page: 1)
)
end
end
+1
View File
@@ -4,6 +4,7 @@ module ContextHelper
NAMED_CONTEXT_MAP = {
activitystreams: 'https://www.w3.org/ns/activitystreams',
security: 'https://w3id.org/security/v1',
controlled_identifiers: 'https://www.w3.org/ns/cid/v1',
webfinger: 'https://purl.archive.org/socialweb/webfinger',
}.freeze
@@ -337,10 +337,12 @@ function useFieldOverflow() {
if (!wrapperEle) return;
const wrapperStyles = getComputedStyle(wrapperEle);
const maxWidth =
wrapperEle.offsetWidth -
(parseFloat(wrapperStyles.paddingLeft) +
parseFloat(wrapperStyles.paddingRight));
const nonContentWidth =
parseFloat(wrapperStyles.paddingLeft) +
parseFloat(wrapperStyles.paddingRight) +
parseFloat(wrapperStyles.borderLeftWidth) +
parseFloat(wrapperStyles.borderRightWidth);
const availableContentWidth = wrapperEle.offsetWidth - nonContentWidth;
const label = wrapperEle.querySelector<HTMLSpanElement>(
'dt > [data-contents]',
@@ -349,8 +351,12 @@ function useFieldOverflow() {
'dd > [data-contents]',
);
setIsLabelOverflowing(label ? label.scrollWidth > maxWidth : false);
setIsValueOverflowing(value ? value.scrollWidth > maxWidth : false);
setIsLabelOverflowing(
label ? label.scrollWidth > availableContentWidth : false,
);
setIsValueOverflowing(
value ? value.scrollWidth > availableContentWidth : false,
);
}, []);
const observer = useResizeObserver(handleRecalculate);
@@ -356,7 +356,7 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
&.fieldItem {
border-color: var(--color-border-success-soft);
padding-right: 32px; // 8px padding + 16px for the icon + 8px gap
padding-right: 30px; // 8px padding + 16px for the icon + 8px gap - 2px tolerance
}
}
@@ -1646,6 +1646,10 @@ body > [data-popper-placement] {
top: 0;
inset-inline-start: 14px + ((46px - 2px) * 0.5);
.status__wrapper:has(> .status__prepend) &:not(&--full, &--first) {
height: 50px;
}
&--full {
top: 0;
height: 100%;
@@ -1802,6 +1806,12 @@ body > [data-popper-placement] {
font-weight: 500;
color: var(--color-text-secondary);
.status__wrapper-reply & {
--thread-margin: calc(46px + 8px);
margin-inline-start: var(--thread-margin);
}
&__icon {
display: flex;
align-items: center;
@@ -337,10 +337,12 @@ function useFieldOverflow() {
if (!wrapperEle) return;
const wrapperStyles = getComputedStyle(wrapperEle);
const maxWidth =
wrapperEle.offsetWidth -
(parseFloat(wrapperStyles.paddingLeft) +
parseFloat(wrapperStyles.paddingRight));
const nonContentWidth =
parseFloat(wrapperStyles.paddingLeft) +
parseFloat(wrapperStyles.paddingRight) +
parseFloat(wrapperStyles.borderLeftWidth) +
parseFloat(wrapperStyles.borderRightWidth);
const availableContentWidth = wrapperEle.offsetWidth - nonContentWidth;
const label = wrapperEle.querySelector<HTMLSpanElement>(
'dt > [data-contents]',
@@ -349,8 +351,12 @@ function useFieldOverflow() {
'dd > [data-contents]',
);
setIsLabelOverflowing(label ? label.scrollWidth > maxWidth : false);
setIsValueOverflowing(value ? value.scrollWidth > maxWidth : false);
setIsLabelOverflowing(
label ? label.scrollWidth > availableContentWidth : false,
);
setIsValueOverflowing(
value ? value.scrollWidth > availableContentWidth : false,
);
}, []);
const observer = useResizeObserver(handleRecalculate);
@@ -356,7 +356,7 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
&.fieldItem {
border-color: var(--color-border-success-soft);
padding-right: 32px; // 8px padding + 16px for the icon + 8px gap
padding-right: 30px; // 8px padding + 16px for the icon + 8px gap - 2px tolerance
}
}
+9
View File
@@ -362,6 +362,7 @@
"closed_registrations_modal.find_another_server": "Lorg frithealaiche eile",
"closed_registrations_modal.preamble": "Tha Mastodon sgaoilte is mar sin dheth ge b’ e càit an cruthaich thu an cunntas agad, ’s urrainn dhut duine sam bith a leantainn air an fhrithealaiche seo is conaltradh leotha. ’S urrainn dhut fiù ’s frithealaiche agad fhèin òstadh!",
"closed_registrations_modal.title": "Clàradh le Mastodon",
"collection.share_modal.share_link_label": "Ceangal co-roinnidh",
"collection.share_modal.share_via_post": "Postaich air Mastodon",
"collection.share_modal.share_via_system": "Co-roinn gu…",
"collection.share_modal.title": "Co-roinn an cruinneachadh",
@@ -369,6 +370,7 @@
"collection.share_template_other": "Thoir sùil air an deagh-chruinneachadh seo:",
"collection.share_template_own": "Thoir sùil air a’ chruinneachadh ùr agam:",
"collections.account_count": "{count, plural, one {# chunntas} two {# chunntas} few {# cunntasan} other {# cunntas}}",
"collections.accounts.empty_description": "Cuir ris suas ri {count} cunntas(an) ris",
"collections.accounts.empty_editor_title": "Chan eil neach sam bith sa chruinneachadh seo fhathast",
"collections.accounts.empty_title": "Tha an an cruinneachadh seo falamh",
"collections.add_to_collection": "Cuir {name} ri cruinneachaidhean",
@@ -401,6 +403,7 @@
"collections.error_loading_collections": "Thachair mearachd nuair a dh’fheuch sinn ris na cruinneachaidhean seo a luchdadh.",
"collections.hidden_accounts_description": "Bhac no mhùch thu {count, plural, one {an cleachdaiche seo} two {na cleachdaichean seo} few {na cleachdaichean seo} other {na cleachdaichean seo}}",
"collections.hidden_accounts_link": "{count, plural, one {# chunntas falaichte} two {# chunntas falaichte} few {# cunntasan falaichte} other {# cunntas falaichte}}",
"collections.hints.accounts_counter": "{count} / {max} cunntas(an)",
"collections.last_updated_at": "An tùrachadh mu dheireadh: {date}",
"collections.list.collections_with_count": "{count, plural, one {# chruinneachadh} two {# chruinneachadh} few {# cruinneachaidhean} other {# cruinneachadh}}",
"collections.list.created_by_author": "Air a chruthachadh le {name}",
@@ -409,6 +412,7 @@
"collections.manage_accounts": "Stiùirich na cunntasan",
"collections.mark_as_sensitive": "Cuir comharra gu bheil e frionasach",
"collections.mark_as_sensitive_hint": "Falaichidh seo tuairisgeul is cunntasan a’ chruinneachaidh air cùlaibh rabhadh susbainte. Chithear ainm a’ chruinneachaidh fhathast.",
"collections.maximum_collection_count_description": "Seo an àireamh as motha de chruinneachaidhean a dh’fhaodas tu cruthachadh air an fhrithealaiche agad: {count}",
"collections.maximum_collection_count_reached": "Chruthaich thu na tha ceadaichte de chruinneachaidhean",
"collections.name_length_hint": "Crìoch de 40 caractar",
"collections.new_collection": "Cruinneachadh ùr",
@@ -557,6 +561,7 @@
"confirmations.remove_from_followers.message": "Cha lean {name} thu tuilleadh. A bheil thu cinnteach gu bheil thu airson leantainn air adhart?",
"confirmations.remove_from_followers.title": "A bheil thu airson an neach-leantainn a thoirt air falbh?",
"confirmations.revoke_collection_inclusion.confirm": "Thoir air falbh mi",
"confirmations.revoke_collection_inclusion.message": "Chan urrainn dhan neach-tasgaidh do chur ris a’ chruinneachadh seo fad 24 uair a thìde. Airson an cumail o do chur ri cruinneachadh gu buan, ’s urrainn dhut am bacadh.",
"confirmations.revoke_collection_inclusion.title": "A bheil tu airson do thoirt air falbh on chruinneachadh seo?",
"confirmations.revoke_quote.confirm": "Thoir am post air falbh",
"confirmations.revoke_quote.message": "Cha ghabh seo a neo-dhèanamh.",
@@ -584,6 +589,7 @@
"custom_homepage.administered_by": "Rianachd le",
"custom_homepage.contact": "Fios thugainn:",
"custom_homepage.latest_activity": "A’ ghnìomhachd mu dheireadh",
"custom_homepage.these_are_the_latest_posts": "Seo am 40 post mu dheireadh o chunntasan air an fhrithealaiche seo.",
"directory.federated": "On cho-shaoghal aithnichte",
"directory.local": "O {domain} a-mhàin",
"directory.new_arrivals": "Feadhainn ùra",
@@ -1132,6 +1138,9 @@
"report.categories.spam": "Spama",
"report.categories.violation": "Tha an t-susbaint a’ briseadh riaghailt no dhà an fhrithealaiche",
"report.category.subtitle": "Tagh an roghainn as iomchaidhe",
"report.category.title_account": "Innis dhuinn dè tha a’ dol leis a’ phròifil seo",
"report.category.title_collection": "Innis dhuinn dè tha a’ dol leis a’ chruinneachadh seo",
"report.category.title_status": "Innis dhuinn dè tha a’ dol leis a’ phost seo",
"report.close": "Deiseil",
"report.comment.title": "A bheil rud sam bith eile a bu toigh leat innse dhuinn?",
"report.forward": "Sìn air adhart gu {target}",
+3
View File
@@ -1138,6 +1138,9 @@
"report.categories.spam": "Spam",
"report.categories.violation": "O contido viola unha ou máis regras do servidor",
"report.category.subtitle": "Elixe a mellor coincidencia",
"report.category.title_account": "Cóntanos cal é o problema con este perfil",
"report.category.title_collection": "Cóntanos cal é o problema con esta colección",
"report.category.title_status": "Cóntanos cal é o problema con esta publicación",
"report.close": "Feito",
"report.comment.title": "Hai algo máis que creas debamos saber?",
"report.forward": "Reenviar a {target}",
+9 -6
View File
@@ -1,5 +1,5 @@
{
"about.blocks": "Siū 管制 ê 服侍器",
"about.blocks": "Siū管制ê服侍器",
"about.contact": "聯絡方法:",
"about.default_locale": "預設",
"about.disclaimer": "Mastodon是自由、開放原始碼ê軟體,mā是Mastodon GmbH ê商標。",
@@ -58,11 +58,11 @@
"account.follow_request_cancel": "取消跟tuè",
"account.follow_request_cancel_short": "取消",
"account.follow_request_short": "請求",
"account.followers": "跟tuè伊ê",
"account.followers": "跟tuè ê",
"account.followers.empty": "Tsit ê用者iáu bô lâng跟tuè。",
"account.followers_counter": "Hōo {count, plural, other {{count} ê lâng}}跟tuè",
"account.followers_you_know_counter": "Lí所知影ê {counter} ê lâng",
"account.following": "伊跟tuè ê",
"account.following": "Leh跟tuè",
"account.following_counter": "Teh跟tuè {count,plural,other {{count} ê lâng}}",
"account.follows.empty": "Tsit ê用者iáu buē跟tuè別lâng。",
"account.follows_you": "跟tuè lí",
@@ -226,7 +226,7 @@
"account_edit.profile_tab.show_media_replies.description": "若是啟用,媒體分頁展示lí ê PO文kap對別lâng ê PO文ê回應。",
"account_edit.profile_tab.show_media_replies.title": "佇媒體分頁內包含回應",
"account_edit.profile_tab.show_relations.description": "佇lí ê個人資料內底,展示lí跟tuè ê口座kap跟tuè lí ê予別lâng看。Lâng iáu是ē當看見lí敢有跟tuè伊。",
"account_edit.profile_tab.show_relations.title": "展示「跟tuè伊ê」kap「伊跟tuè ê」",
"account_edit.profile_tab.show_relations.title": "展示「跟tuè ê」kap「Leh跟tuè」",
"account_edit.profile_tab.subtitle": "自訂lí ê個人檔案顯示ê方法。",
"account_edit.profile_tab.title": "個人資料顯示設定",
"account_edit.save": "儲存",
@@ -949,7 +949,7 @@
"notification.favourite": "{name} kah意lí ê PO文",
"notification.favourite.name_and_others_with_link": "{name} kap<a>{count, plural, other {另外 # ê lâng}}</a>kah意lí ê PO文",
"notification.favourite_pm": "{name} kah意lí ê私人ê提起",
"notification.favourite_pm.name_and_others_with_link": "{name} kap<a>{count, plural, other {另外 # ê lâng}}</a>kah意lí ê私人ê提起",
"notification.favourite_pm.name_and_others_with_link": "{name} kap<a>{count, plural, other {另外 # ê lâng}}</a> kah意lí ê私人ê提起",
"notification.follow": "{name}跟tuè lí",
"notification.follow.name_and_others": "{name} kap<a>{count, plural, other {另外 # ê lâng}}</a>跟tuè lí",
"notification.follow_request": "{name} 請求跟tuè lí",
@@ -1093,7 +1093,7 @@
"privacy.direct.long": "逐位tsit篇PO文所提起ê",
"privacy.direct.short": "私人ê提起",
"privacy.private.long": "Kan-ta hōo跟tuè lí ê看",
"privacy.private.short": "跟tuè伊ê",
"privacy.private.short": "跟tuè ê",
"privacy.public.long": "逐ê lâng(無論佇Mastodon以內á是以外)",
"privacy.public.short": "公開ê",
"privacy.quote.anyone": "{visibility},允准PO文引用",
@@ -1138,6 +1138,9 @@
"report.categories.spam": "Pùn-sò訊息",
"report.categories.violation": "內容違反tsi̍t ê以上服侍器ê規則",
"report.category.subtitle": "揀上合ê選項",
"report.category.title_account": "Kā guán講tsit ê個人資料有siánn-mih代誌",
"report.category.title_collection": "Kā guán講tsit ê收藏有siánn-mih代誌",
"report.category.title_status": "Kā guán講tsit ê PO文有siánn-mih代誌",
"report.close": "完成",
"report.comment.title": "Lí敢有別ê想beh hōo guán知ê?",
"report.forward": "轉送kàu {target}",
@@ -1586,6 +1586,10 @@ body > [data-popper-placement] {
top: 0;
inset-inline-start: 16px + ((46px - 2px) * 0.5);
.status__wrapper:has(> .status__prepend) &:not(&--full, &--first) {
height: 50px;
}
&--full {
top: 0;
height: 100%;
@@ -1738,6 +1742,12 @@ body > [data-popper-placement] {
font-weight: 500;
color: var(--color-text-secondary);
.status__wrapper-reply & {
--thread-margin: calc(46px + 8px);
margin-inline-start: var(--thread-margin);
}
&__icon {
display: flex;
align-items: center;
+44
View File
@@ -0,0 +1,44 @@
# frozen_string_literal: true
class Multibase
# Multicodec uses a variable-length unsigned integer to tag
# data. We precompute here the types we are interested about.
# Registered types are available at https://github.com/multiformats/multicodec/blob/master/table.csv
MULTICODEC_PREFIXES = {
'rsa-pub': 0x1205,
'ed25519-pub': 0xED,
}.transform_values do |code|
bytes = []
while code > 127
bytes << ((code & 0x7F) | 128)
code >>= 7
end
bytes << code
bytes.pack('C*')
end.freeze
def self.decode(string)
raise ArgumentError if string.nil?
case string[0]
when 'u'
Base64.decode(string[1...])
when 'z'
Base58.base58_to_binary(string[1...], :bitcoin)
else
raise ArgumentError
end
end
def self.decode_multicodec(string)
binary = decode(string)
MULTICODEC_PREFIXES.each do |tag, prefix|
return [tag, binary[prefix.length..]] if binary.starts_with?(prefix)
end
raise ArgumentError
end
end
@@ -16,7 +16,7 @@ class ActivityPub::FetchRemoteKeyService < BaseService
@json = fetch_resource(uri, false)
raise Error, "Unable to fetch key JSON at #{uri}" if @json.nil?
raise Error, "Unsupported JSON-LD context for document #{uri}" unless supported_context?(@json) || (supported_security_context?(@json) && @json['owner'].present? && !actor_type?)
raise Error, "Unsupported JSON-LD context for document #{uri}" unless supported_context_for_type?(@json)
raise Error, "Unexpected object type for key #{uri}" unless expected_type?
return keypair_from_actor_json(@json['id'], @json) if actor_type?
@@ -35,6 +35,15 @@ class ActivityPub::FetchRemoteKeyService < BaseService
private
def supported_context_for_type?(json)
case @json['type']
when 'Multikey'
equals_or_includes?(json['@context'], 'https://www.w3.org/ns/cid/v1')
else
supported_context?(json) || (supported_security_context?(@json) && @json['owner'].present? && !actor_type?)
end
end
def keypair_from_actor_json(actor_uri, actor_json)
actor = find_actor(actor_uri, actor_json)
return if actor.nil?
@@ -65,11 +74,15 @@ class ActivityPub::FetchRemoteKeyService < BaseService
end
def public_key?
@json['publicKeyPem'].present? && @json['owner'].present?
if @json['type'] == 'Multikey'
@json['publicKeyMultibase'].present? && @json['controller'].present?
else
@json['publicKeyPem'].present? && @json['owner'].present?
end
end
def owner_uri
@owner_uri ||= value_or_id(@json['owner'])
@owner_uri ||= @json['type'] == 'Multikey' ? value_or_id(@json['controller']) : value_or_id(@json['owner'])
end
def expected_owner_type?
@@ -77,6 +90,11 @@ class ActivityPub::FetchRemoteKeyService < BaseService
end
def confirmed_owner?
value_or_id(@owner['publicKey']) == @json['id']
case @json['type']
when 'Multikey'
as_array(@owner['assertionMethod']).map { |value| value_or_id(value) }.include?(@json['id'])
else
as_array(@owner['publicKey']).map { |value| value_or_id(value) }.include?(@json['id'])
end
end
end
@@ -271,9 +271,11 @@ class ActivityPub::ProcessAccountService < BaseService
end
def public_keys
# TODO: handle FEP-521a
@public_keys ||= fep_521a_public_keys.presence || legacy_public_keys
end
@public_keys ||= as_array(@json['publicKey']).take(MAX_PUBLIC_KEYS).filter_map do |value|
def legacy_public_keys
as_array(@json['publicKey']).take(MAX_PUBLIC_KEYS).filter_map do |value|
next if value.nil?
if value.is_a?(Hash)
@@ -290,6 +292,7 @@ class ActivityPub::ProcessAccountService < BaseService
# Key is fetched without ID validation because of a GoToSocial bug
value = fetch_resource_without_id_validation(key_id)
next if value.blank?
# Special handling for GoToSocial which returns the whole actor for the key ID
value = first_of_value(value['publicKey']) if value.is_a?(Hash) && value.key?('publicKey')
@@ -301,6 +304,48 @@ class ActivityPub::ProcessAccountService < BaseService
end
end
def fep_521a_public_keys
return if @json['assertionMethod'].blank?
as_array(@json['assertionMethod']).take(MAX_PUBLIC_KEYS).filter_map do |value|
next if value.nil?
if value.is_a?(Hash)
next unless value['type'] == 'Multikey' && value['controller'] == @account.uri
key_type, key = key_from_multikey(value['publicKeyMultibase'])
next if key_type.nil?
value = value['id']
# Key is contained within the actor document, no need to fetch anything else
next { type: key_type, public_key: key, uri: value } if value.split('#').first == @account.uri
end
key_id = value
value = fetch_resource(key_id, true)
next unless value['type'] == 'Multikey' && value['controller'] == @account.uri
key_type, key = key_from_multikey(value['publicKeyMultibase'])
next if key_type.nil?
{ type: key_type, public_key: key, uri: key_id }
end
end
def key_from_multikey(value)
tag, key = Multibase.decode_multicodec(value)
case tag
when :'rsa-pub'
[:rsa, OpenSSL::PKey::RSA.new(key).to_pem]
end
rescue ArgumentError
nil
end
def url
return if @json['url'].blank?
@@ -12,6 +12,7 @@ class ActivityPub::ProcessFeaturedCollectionService
@json = json
@request_id = request_id
return if non_matching_uri_hosts?(@account.uri, @json['id'])
return unless @json['attributedTo'] == @account.uri
with_redis_lock("collection:#{@json['id']}") do
Collection.transaction do
+26
View File
@@ -0,0 +1,26 @@
# -*- encoding: utf-8 -*-
# frozen_string_literal: true
# This file generated automatically from https://www.w3.org/ns/cid/v1
require 'json/ld'
class JSON::LD::Context
add_preloaded("http://www.w3.org/ns/cid/v1") do
new(processingMode: "json-ld-1.1", term_definitions: {
"JsonWebKey" => TermDefinition.new("JsonWebKey", id: "https://w3id.org/security#JsonWebKey", context: {"@protected" => true, "id" => "@id", "type" => "@type", "controller" => {"@id" => "https://w3id.org/security#controller", "@type" => "@id"}, "revoked" => {"@id" => "https://w3id.org/security#revoked", "@type" => "http://www.w3.org/2001/XMLSchema#dateTime"}, "expires" => {"@id" => "https://w3id.org/security#expiration", "@type" => "http://www.w3.org/2001/XMLSchema#dateTime"}, "publicKeyJwk" => {"@id" => "https://w3id.org/security#publicKeyJwk", "@type" => "@json"}, "secretKeyJwk" => {"@id" => "https://w3id.org/security#secretKeyJwk", "@type" => "@json"}}, protected: true),
"Multikey" => TermDefinition.new("Multikey", id: "https://w3id.org/security#Multikey", context: {"@protected" => true, "id" => "@id", "type" => "@type", "controller" => {"@id" => "https://w3id.org/security#controller", "@type" => "@id"}, "revoked" => {"@id" => "https://w3id.org/security#revoked", "@type" => "http://www.w3.org/2001/XMLSchema#dateTime"}, "expires" => {"@id" => "https://w3id.org/security#expiration", "@type" => "http://www.w3.org/2001/XMLSchema#dateTime"}, "publicKeyMultibase" => {"@id" => "https://w3id.org/security#publicKeyMultibase", "@type" => "https://w3id.org/security#multibase"}, "secretKeyMultibase" => {"@id" => "https://w3id.org/security#secretKeyMultibase", "@type" => "https://w3id.org/security#multibase"}}, protected: true),
"alsoKnownAs" => TermDefinition.new("alsoKnownAs", id: "https://www.w3.org/ns/activitystreams#alsoKnownAs", type_mapping: "@id", protected: true),
"assertionMethod" => TermDefinition.new("assertionMethod", id: "https://w3id.org/security#assertionMethod", type_mapping: "@id", container_mapping: "@set", protected: true),
"authentication" => TermDefinition.new("authentication", id: "https://w3id.org/security#authenticationMethod", type_mapping: "@id", container_mapping: "@set", protected: true),
"capabilityDelegation" => TermDefinition.new("capabilityDelegation", id: "https://w3id.org/security#capabilityDelegationMethod", type_mapping: "@id", container_mapping: "@set", protected: true),
"capabilityInvocation" => TermDefinition.new("capabilityInvocation", id: "https://w3id.org/security#capabilityInvocationMethod", type_mapping: "@id", container_mapping: "@set", protected: true),
"controller" => TermDefinition.new("controller", id: "https://w3id.org/security#controller", type_mapping: "@id", protected: true),
"id" => TermDefinition.new("id", id: "@id", simple: true, protected: true),
"keyAgreement" => TermDefinition.new("keyAgreement", id: "https://w3id.org/security#keyAgreementMethod", type_mapping: "@id", container_mapping: "@set", protected: true),
"service" => TermDefinition.new("service", id: "https://www.w3.org/ns/did#service", type_mapping: "@id", context: {"@protected" => true, "id" => "@id", "type" => "@type", "serviceEndpoint" => {"@id" => "https://www.w3.org/ns/did#serviceEndpoint", "@type" => "@id"}}, protected: true),
"type" => TermDefinition.new("type", id: "@type", simple: true, protected: true),
"verificationMethod" => TermDefinition.new("verificationMethod", id: "https://w3id.org/security#verificationMethod", type_mapping: "@id", protected: true)
})
end
alias_preloaded("https://www.w3.org/ns/cid/v1", "http://www.w3.org/ns/cid/v1")
end
+2
View File
@@ -756,6 +756,8 @@ be:
new:
title: Стварыць новае IP правіла
no_ip_block_selected: Ніякія правілы IP не былі змененыя, таму што ні адно з іх не было выбрана
reset: Скінуць
search: Пошук
title: IP правілы
relationships:
title: Зносіны %{acct}
+2
View File
@@ -730,6 +730,8 @@ da:
new:
title: Opret ny IP-regel
no_ip_block_selected: Ingen IP-regler blev ændret (ingen var valgt)
reset: Nulstil
search: Søg
title: IP-regler
relationships:
title: "%{acct}-relationer"
+9
View File
@@ -507,11 +507,18 @@ de:
last_email: Letzte E-Mail
lead: Konten, die die Funktion aktiviert haben und abonniert wurden, werden unten angezeigt.
show:
confirm_disable_feature: E-Mail-Newsletter für %{name} deaktivieren? Für dieses Konto werden keine Neuigkeiten mehr über E-Mail versendet. Das Profil kann die Funktion in den Kontoeinstellungen weiterhin reaktivieren. Um den Zugriff auf diese Funktion dauerhaft zu entfernen, passe die Berechtigung in der Rollenverwaltung an.
confirm_remove_subscriber: "%{email} wird keine E-Mails mehr von %{name} erhalten. Die Aktion lässt sich nicht rückgängig machen."
consent: Abonnent*innen haben ausschließlich dem Erhalt von Beiträgen per E-Mail zugestimmt. Verwende diese Liste nicht zu anderen Zwecken.
date: Registrierungsdatum
disable_feature: Funktion deaktivieren
disabled: Die Funktion wurde deaktiviert und E-Mails werden nicht länger diese Liste gesendet.
email: E-Mail-Adresse
empty:
hint: Noch hat niemand dieses Konto abonniert.
no_subscribers_yet: Bisher keine Abonnent*innen
enable_feature: Funktion aktivieren
no_access_html: Dieses Konto besitzt nicht länger die erforderliche Berechtigung, um die Funktion zu aktivieren. In der <a href="%{roles_path}">Rollenverwaltung</a> kann das angepasst werden.
title: E-Mail-Newsletter von %{name}
view_account: Konto ansehen
status: Status
@@ -723,6 +730,8 @@ de:
new:
title: Neue IP-Regel erstellen
no_ip_block_selected: Keine IP-Regeln wurden geändert, weil keine ausgewählt wurde(n)
reset: Zurücksetzen
search: Suchen
title: IP-Regeln
relationships:
title: Beziehungen von %{acct}
+2
View File
@@ -730,6 +730,8 @@ el:
new:
title: Δημιουργία νέου κανόνα IP
no_ip_block_selected: Δεν άλλαξαν οι κανόνες IP καθώς κανένας δεν επιλέχθηκε
reset: Επαναφορά
search: Αναζήτηση
title: Κανόνες IP
relationships:
title: Σχέσεις του/της %{acct}
+2
View File
@@ -730,6 +730,8 @@ es-AR:
new:
title: Crear nueva regla de dirección IP
no_ip_block_selected: No se cambió ninguna regla de dirección IP, ya que no se seleccionó ninguna
reset: Restablecer
search: Buscar
title: Reglas de dirección IP
relationships:
title: Relaciones de %{acct}
+2
View File
@@ -730,6 +730,8 @@ es-MX:
new:
title: Crear nueva regla IP
no_ip_block_selected: No se modificó ninguna regla de IP, ya que no se seleccionó ninguna
reset: Restablecer
search: Buscar
title: Reglas IP
relationships:
title: Relaciones de %{acct}
+2
View File
@@ -732,6 +732,8 @@ es:
new:
title: Crear nueva regla IP
no_ip_block_selected: No se han cambiado reglas IP, ya que no se ha seleccionado ninguna
reset: Restablecer
search: Buscar
title: Reglas IP
relationships:
title: Relaciones de %{acct}
+22
View File
@@ -4,6 +4,7 @@ gd:
about_mastodon_html: 'An lìonra sòisealta dhan àm ri teachd: Gun sanasachd, gun chaithris corporra, dealbhadh beusail agus dì-mheadhanachadh! Gabh sealbh air an dàta agad fhèin le Mastodon!'
contact_missing: Cha deach a shuidheachadh
contact_unavailable: Chan eil seo iomchaidh
default_thumbnail_description: Tha dà mhastodon cartùin (seo ainmhidhean coltach ri ailbheanan) le fiamh-ghàire orra a’ sadadh plèana pàipear eatorra. Tha speur gorm ’s planaidean a’ fleòdradh mun timcheall le craobhan is barrachd mhastodonaichean orra.
hosted_on: Mastodon ’ga òstadh air %{domain}
title: Mu dhèidhinn
accounts:
@@ -526,6 +527,7 @@ gd:
last_email: Am post-d mu dheireadh
lead: Thèid na cunntasan a chuir an gleus an comas agus aig a bheil fo-sgrìobhaichean a shealltainn gu h-ìosal.
show:
confirm_disable_feature: A bheil thu airson cuairt-litrichean puist-d a chur à comas airson %{name}? Cha dèid naidheachdan a’ chunntais sin a chur air a’ post-d tuilleadh. ’S urrainn dhan chleachdaiche an gleus a chur an comas a-rithist ann an roghainnean a’ chunntais aca ge-tà. Airson an cothrom air a’ ghleus seo a thoirt air falbh gu buan, deasaich ceadan a’ chunntais sna dreuchdan.
confirm_remove_subscriber: Chan fhaigh %{email} puist-d o %{name} tuilleadh. Cha ghabh an gnìomh seo a neo-dhèanamh.
consent: Cha do ghabh na fo-sgrìobhaichean ach ri faighinn nam post air a’ phost-d. Na cleachd an liosta seo air adhbhar sam bith eile.
date: Ceann-latha a’ chlàraidh
@@ -555,6 +557,7 @@ gd:
action: Stiùirich
hint: Thèid ceangal ris a’ phoileasaidh seo a chur ri bann-coise gach puist-d
title: Poileasaidh prìobhaideachd
title: Roghainnean a’ ghèillidh
danger_zone:
disable_feature:
action: Cuir à comas
@@ -569,14 +572,18 @@ gd:
index:
disabled:
cannot_be_enabled: Cha do chuir an solaraiche teicnigeach agad an gleus seo an comas air an fhrithealaiche agad.
description: Leigidh an gleus seo le cunntasan sònraichte widget a chur ris na pròifilean aca a bheir comas do dh’aoighean aig nach eil cunntas Mastodon am postaichean fhaighinn air a’ phost-d.
get_started: Dèan toiseach-tòiseachaidh
lead: Leigidh seo le aoighean postaichean o chunntasan sònraichte air an fhrithealaiche seo fhaighinn air a’ phost-d.
title: Cuairt-litrichean puist-d
purged_msg: Thèid a h-uile dàta mu fho-sgrìobhaidhean puist-d a shuathadh bàn.
roles:
accounts: Cunntasan
edit_role: Deasaich an dreuchd
empty:
hint: Chan fhaod neach sam bith an gleus seo a chleachdadh.
no_roles_added: Cha deach dreuchd a chur ris
lead: "’S urrainn do chunntasan aig a bheil gin dhe na dreuchdan seo an gleus a chur ann comas air a’ phròifil aca."
manage_roles: Stiùirich na dreuchdan
role_name: Ainm na dreuchd
title: Dreuchdan
@@ -584,6 +591,11 @@ gd:
show:
enable_feature: Cuir an gleus an comas
important_information: Fiosrachadh cudromach
list:
1_permission_explanation: Nuair a bhios an gleus seo an comas, ’s urrainn do chunntasan leis na ceadan iomruinte foirm cruinneachadh phost-d a chur ris a’ phròifil aca.
2_feature_explanation: Nuair a chlàraicheas aoighean air duilleag pròifil cunntais ’s ma dhearbhas iad am fo-sgrìobhadh, gheibh iad naidheachd air a’ phost-d nuair a chruthaicheas an cunntas post poblach ùr.
3_privacy_policy_warning: Gheibh rianairean an fhrithealaiche cothrom air fiosrachadh a dh’aithnicheadh cò cuideigin (na puist-d) a thèid a chruinneachadh. Mar sin dheth, feumar am poileasaidh prìobhaideachd ’s teirmichean na seirbheise ùrachadh dhan fhrithealaiche mus dèid an gleus seo a chleachdadh.
4_cost_warning: Dh’fhaoidte gun cosg puist-d tàille a-rèir rèiteachadh òstadh an fhrithealaiche. Bruidhinn ri solaraiche an òstaidh agad mus cuir thu seo an comas on a dh’fhaodas an gleus seo cur ri meud nam post-d a thèid a chur on fhrithealaiche agad gu mòr.
export_domain_allows:
new:
title: Ion-phortaich àrainnean ceadaichte
@@ -744,6 +756,8 @@ gd:
new:
title: Cruthaich riaghailt IP ùr
no_ip_block_selected: Cha deach riaghailt IP sam bith atharrachadh o nach deach gin dhiubh a thaghadh
reset: Ath-shuidhich
search: Lorg
title: Riaghailtean IP
relationships:
title: Na dàimhean aig %{acct}
@@ -901,6 +915,7 @@ gd:
manage_custom_emojis: Stiùireadh nan Emojis gnàthaichte
manage_custom_emojis_description: Leigidh seo le cleachdaichean Emojis gnàthaichte a stiùireadh air an fhrithealaiche
manage_email_subscriptions: Stiùireadh fo-sgrìobhaidhean puist-d
manage_email_subscriptions_description: Leigidh seo le cleachdaidhean aig a bheil an cead seo gleus cuairt-litreach puist-d a chur an comas dhan chunntas aca
manage_federation: Stiùireadh a’ cho-nasgaidh
manage_federation_description: Leigidh seo le cleachdaichean an co-nasgadh le àrainnean eile a bhacadh no a cheadachadh agus stiùireadh dè ghabhas lìbhrigeadh
manage_invites: Stiùireadh nan cuiridhean
@@ -989,7 +1004,14 @@ gd:
disabled: Iarr dreuchd shònraichte a’ chleachdaiche
public: A h-uile duine
landing_page:
hints:
about_html: Duilleag le tuairisgeul, fiosrachadh conaltraidh, riaghailtean ’s fiosrachadh eile mun fhrithealaiche seo.
local_feed_html: Loidhne-ama bheò leis na postaichean as ùire leis na cleachdaichean air an fhrithealaiche seo.
overview_html: Duilleag a sheallas tuairisgeul an fhrithealaiche agad còmhla ris na postaichean ionadail as ùire leis na cleachdaichean air an fhrithealaiche seo.
trends_html: Duilleag a nochdas na tha fèill mhòr air air an fhrithealaiche seo an-dràsta.
values:
about: Duilleag mu dhèidhinn
local_feed: Loidhne-ama ionadail bheò
overview: Foir-shealladh
trends: A’ treandadh
registrations:
+2
View File
@@ -730,6 +730,8 @@ gl:
new:
title: Crear nova regra IP
no_ip_block_selected: Non se cambiou ningunha regra iP porque non seleccionaches ningunha
reset: Restablecer
search: Buscar
title: Regras IP
relationships:
title: Relacións de %{acct}
+3
View File
@@ -4,6 +4,7 @@ hu:
about_mastodon_html: 'A jövő közösségi hálózata: Hirdetések és céges megfigyelés nélkül, etikus dizájnnal és decentralizációval! Legyél a saját adataid ura a Mastodonnal!'
contact_missing: Nincs megadva
contact_unavailable: N/A
default_thumbnail_description: Két mosolygó rajzfilmes kinézetű masztodon (úgy néznek ki mint az elefántok) papírrepülőt dob egymásnak. Kék ég és lebegő bolygók veszik őket körbe, a bolygókon fák és további masztodonok vannak.
hosted_on: "%{domain} Mastodon-kiszolgáló"
title: Névjegy
accounts:
@@ -729,6 +730,8 @@ hu:
new:
title: Új IP szabály létrehozása
no_ip_block_selected: Nem változott meg egy IP-szabály sem, mert semmi sem volt kiválasztva
reset: Visszaállítás
search: Keresés
title: IP szabály
relationships:
title: "%{acct} kapcsolatai"
+2
View File
@@ -730,6 +730,8 @@ it:
new:
title: Crea una nuova regola IP
no_ip_block_selected: Nessuna regola IP è stata modificata poiché nessuna è stata selezionata
reset: Reset
search: Cerca
title: Regole IP
relationships:
title: Relazioni di %{acct}
+6 -6
View File
@@ -12,7 +12,7 @@ nan-TW:
followers:
other: 跟tuè ê
following:
other: 伊跟tuè ê
other: Leh跟tuè
instance_actor_flash: Tsit ê口座是虛ê,用來代表tsit臺服侍器,毋是個人用者ê。伊用來做聯邦ê路用,毋好kā伊ê權限停止。
last_active: 頂kái活動ê時間
link_verified_on: Tsit ê連結ê所有權佇 %{date} 受檢查
@@ -75,7 +75,7 @@ nan-TW:
enable_sign_in_token_auth: 啟用電子phue ê token認證
enabled: 啟用ah
enabled_msg: 成功kā %{username} ê口座退冰
followers: 跟tuè伊ê
followers: 跟tuè ê
follows: 伊跟tuè ê
header: 封面ê圖
inbox_url: 收件kheh-á ê URL
@@ -1670,7 +1670,7 @@ nan-TW:
blocking: Teh輸入封鎖ê口座
bookmarks: Teh輸入冊籤
domain_blocking: Teh輸入封鎖ê域名
following: Teh輸入leh跟tuè ê口座
following: Teh輸入跟tuè ê口座
lists: Teh輸入列單
muting: Teh輸入消音ê口座
type: 輸入類型
@@ -1681,7 +1681,7 @@ nan-TW:
blocking: 封鎖ê列單
bookmarks: 冊籤
domain_blocking: 域名封鎖列單
following: Leh跟tuè ê列單
following: Leh跟tuè ê ê列單
lists: 列單
muting: 消音ê列單
upload: 傳上去
@@ -1892,8 +1892,8 @@ nan-TW:
dormant: Teh歇睏
follow_failure: Bē當跟tuè一寡所揀ê口座。
follow_selected_followers: 跟tuè所揀ê跟tuè者
followers: 跟tuè伊ê
following: 伊跟tuè ê
followers: 跟tuè ê
following: Leh跟tuè
invited: 邀請ah
last_active: 上尾ê活動
most_recent: 最近來ê
+2
View File
@@ -730,6 +730,8 @@ nl:
new:
title: Nieuwe IP-regel aanmaken
no_ip_block_selected: Er zijn geen IP-regels veranderd, omdat er geen een was geselecteerd
reset: Opnieuw
search: Zoeken
title: IP-regels
relationships:
title: Volgrelaties van %{acct}
+2
View File
@@ -730,6 +730,8 @@ pt-BR:
new:
title: Criar nova regra de IP
no_ip_block_selected: Nenhuma regra de IP foi alterada pois nenhuma foi selecionada
reset: Redefinir
search: Buscar
title: Regras de IP
relationships:
title: Relações de %{acct}
+3
View File
@@ -325,6 +325,9 @@ gd:
trendable_by_default: Ceadaich treandaichean gun lèirmheas ro làimh
trends: Cuir na treandaichean an comas
wrapstodon: Cuir Wrapstodon an comas
form_email_subscriptions_confirmation:
agreement_email_volume: Tha mi a’ tuigsinn ma chuireas mi an comas an gleus seo, gur urrainn dha sin cur gu mòr ri meud nam post-d a thèid a chur on fhrithealaiche seo agus gu bheil cosgais sam bith a dh’èireas ’na lùib an urra rium fhìn.
agreement_privacy_and_terms: Tha mi air a’ phoileasaidh phrìobhaideachd ’s teirmichean na seirbheise ùrachadh.
interactions:
must_be_follower: Bac na brathan nach eil o luchd-leantainn
must_be_following: Bac na brathan o dhaoine nach lean thu
+2
View File
@@ -730,6 +730,8 @@ sv:
new:
title: Skapa ny IP-regel
no_ip_block_selected: Inga IP-regler ändrades då inga var valda
reset: Återställ
search: Sök
title: IP-regler
relationships:
title: "%{acct}s relationer"
+2
View File
@@ -717,6 +717,8 @@ vi:
new:
title: Chặn một IP mới
no_ip_block_selected: Bạn chưa chọn bất kỳ IP nào
reset: Đặt lại
search: Tìm kiếm
title: Những IP bị chặn
relationships:
title: Mối quan hệ của %{acct}
+2
View File
@@ -717,6 +717,8 @@ zh-CN:
new:
title: 创建新 IP 规则
no_ip_block_selected: 未选中任何 IP 规则,所以没有更改
reset: 重置
search: 搜索
title: IP 规则
relationships:
title: "%{acct} 的关系"
+2
View File
@@ -719,6 +719,8 @@ zh-TW:
new:
title: 建立新的 IP 規則
no_ip_block_selected: 因未選取任何 IP 規則,所以什麼事都沒發生
reset: 重設
search: 搜尋
title: IP 規則
relationships:
title: "%{acct} 的關係"
+1 -1
View File
@@ -124,7 +124,7 @@ Rails.application.routes.draw do
end
scope path: 'ap', as: 'ap' do
resources :accounts, path: 'users', only: [:show], param: :id, concerns: :account_resources do
resources :accounts, path: 'users', only: [:show], param: :id, concerns: :account_resources, constraints: { id: /-?\d+/ } do
resources :collections, only: [:show], constraints: { id: /\d+/ }
resources :collection_items, only: [:show]
resources :feature_authorizations, only: [:show], module: :activitypub
+17
View File
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Routes under ap/' do
it 'correctly handles numeric account ids' do
expect(get('/ap/users/1234/statuses/5678')).to route_to('statuses#show', account_id: '1234', id: '5678')
end
it 'correctly handles the instance actor id' do
expect(get('/ap/users/-99/statuses/5678')).to route_to('statuses#show', account_id: '-99', id: '5678')
end
it 'does not accept usernames' do
expect(get('/ap/users/john/statuses/5678')).to_not route_to('statuses#show', account_id: 'john', id: '5678')
end
end
@@ -81,6 +81,25 @@ RSpec.describe ActivityPub::FetchRemoteKeyService do
expect(keypair.uri).to eq public_key_id
expect(keypair.public_key).to eq public_key_pem
end
context 'when there are multiple keys' do
let(:actor_public_key) do
[
'https://example.com/unavailable-key.json',
public_key_id,
]
end
before do
stub_request(:get, 'https://example.com/unavailable-key.json').to_return(status: 404)
end
it 'returns the expected account' do
expect(keypair.account.uri).to eq 'https://example.com/alice'
expect(keypair.uri).to eq public_key_id
expect(keypair.public_key).to eq public_key_pem
end
end
end
context 'when the key and owner do not match' do
@@ -96,4 +115,113 @@ RSpec.describe ActivityPub::FetchRemoteKeyService do
end
end
end
context 'with FEP-521a' do
let(:ed25519_key_id) { 'https://example.com/alice#ed25519-key' }
let(:actor_ed25519_key) { ed25519_multikey }
let(:ed25519_multikey) do
{
id: ed25519_key_id,
type: 'Multikey',
controller: 'https://example.com/alice',
publicKeyMultibase: 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK',
}
end
let(:rsa_key_id) { 'https://example.com/alice#rsa-key' }
let(:actor_rsa_key) { rsa_multikey }
let(:rsa_multikey) do
{
id: rsa_key_id,
type: 'Multikey',
controller: 'https://example.com/alice',
publicKeyMultibase: 'z4MXj1wBzi9jUstyPMS4jQqB6KdJaiatPkAtVtGc6bQEQEEsKTic4G7Rou3iBf9vPmT5dbkm9qsZsuVNjq8HCuW1w24nhBFGkRE4cd2Uf2tfrB3N7h4mnyPp1BF3ZttHTYv3DLUPi1zMdkULiow3M1GfXkoC6DoxDUm1jmN6GBj22SjVsr6dxezRVQc7aj9TxE7JLbMH1wh5X3kA58H3DFW8rnYMakFGbca5CB2Jf6CnGQZmL7o5uJAdTwXfy2iiiyPxXEGerMhHwhjTA1mKYobyk2CpeEcmvynADfNZ5MBvcCS7m3XkFCMNUYBS9NQ3fze6vMSUPsNa6GVYmKx2x6JrdEjCk3qRMMmyjnjCMfR4pXbRMZa3i', # rubocop:disable Layout/LineLength
}
end
let(:rsa_key_pem) do
<<~TEXT
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsbX82NTV6IylxCh7MfV4
hlyvaniCajuP97GyOqSvTmoEdBOflFvZ06kR/9D6ctt45Fk6hskfnag2GG69NALV
H2o4RCR6tQiLRpKcMRtDYE/thEmfBvDzm/VVkOIYfxu+Ipuo9J/S5XDNDjczx2v+
3oDh5+CIHkU46hvFeCvpUS+L8TJSbgX0kjVk/m4eIb9wh63rtmD6Uz/KBtCo5mmR
4TEtcLZKYdqMp3wCjN+TlgHiz/4oVXWbHUefCEe8rFnX1iQnpDHU49/SaXQoud1j
CaexFn25n+Aa8f8bc5Vm+5SeRwidHa6ErvEhTvf1dz6GoNPp2iRvm+wJ1gxwWJEY
PQIDAQAB
-----END PUBLIC KEY-----
TEXT
end
let(:actor) do
{
'@context': [
'https://www.w3.org/ns/activitystreams',
'https://www.w3.org/ns/cid/v1',
],
id: 'https://example.com/alice',
type: 'Person',
preferredUsername: 'alice',
name: 'Alice',
summary: 'Foo bar',
inbox: 'http://example.com/alice/inbox',
assertionMethod: [
actor_ed25519_key,
actor_rsa_key,
],
}
end
describe '#call' do
let(:keypair) { subject.call(rsa_key_id) }
context 'when the key is a sub-object from the actor' do
before do
stub_request(:get, rsa_key_id).to_return(body: actor.to_json, headers: { 'Content-Type': 'application/activity+json' })
end
it 'returns the expected account' do
expect(keypair.account.uri).to eq 'https://example.com/alice'
expect(keypair)
.to have_attributes(
uri: rsa_key_id,
type: 'rsa',
public_key: rsa_key_pem
)
end
end
context 'when the key is a separate document' do
let(:rsa_key_id) { 'https://example.com/alice-public-key.json' }
let(:actor_rsa_key) { rsa_key_id }
before do
stub_request(:get, rsa_key_id).to_return(body: rsa_multikey.merge({ '@context': ['https://www.w3.org/ns/cid/v1'] }).to_json, headers: { 'Content-Type': 'application/activity+json' })
end
it 'returns the expected account' do
expect(keypair.account.uri).to eq 'https://example.com/alice'
expect(keypair)
.to have_attributes(
uri: rsa_key_id,
type: 'rsa',
public_key: rsa_key_pem
)
end
end
context 'when the key and owner do not match' do
let(:rsa_key_id) { 'https://example.com/fake-public-key.json' }
let(:actor_rsa_key) { 'https://example.com/alice-public-key.json' }
before do
stub_request(:get, rsa_key_id).to_return(body: rsa_multikey.merge({ '@context': ['https://www.w3.org/ns/cid/v1'] }).to_json, headers: { 'Content-Type': 'application/activity+json' })
end
it 'returns the nil' do
expect(keypair).to be_nil
end
end
end
end
end
@@ -304,6 +304,62 @@ RSpec.describe ActivityPub::ProcessAccountService do
end
end
context 'with multiple keypairs using FEP-521a' do
let(:payload) do
{
id: 'https://foo.test/actor',
type: 'Actor',
inbox: 'https://foo.test/inbox',
preferredUsername: 'alice',
assertionMethod: [
{
id: 'https://foo.test/actor#key1',
type: 'Multikey',
controller: 'https://foo.test/actor',
publicKeyMultibase: 'z4MXj1wBzi9jUstyPMS4jQqB6KdJaiatPkAtVtGc6bQEQEEsKTic4G7Rou3iBf9vPmT5dbkm9qsZsuVNjq8HCuW1w24nhBFGkRE4cd2Uf2tfrB3N7h4mnyPp1BF3ZttHTYv3DLUPi1zMdkULiow3M1GfXkoC6DoxDUm1jmN6GBj22SjVsr6dxezRVQc7aj9TxE7JLbMH1wh5X3kA58H3DFW8rnYMakFGbca5CB2Jf6CnGQZmL7o5uJAdTwXfy2iiiyPxXEGerMhHwhjTA1mKYobyk2CpeEcmvynADfNZ5MBvcCS7m3XkFCMNUYBS9NQ3fze6vMSUPsNa6GVYmKx2x6JrdEjCk3qRMMmyjnjCMfR4pXbRMZa3i', # rubocop:disable Layout/LineLength
},
{
id: 'https://foo.test/actor#key2',
type: 'Multikey',
controller: 'https://foo.test/actor',
publicKeyMultibase: 'z2MGw4gk84USotaWf4AkJ83DcnrfgGaceF86KQXRYMfQ7xqnUG81FVWa2N5inzNigXsDkm2LxpuyYSajqZr1CwHqnJbVEw1rhN25tbJSFyej6TejRh3k67CK9nTVHdXFoVKgAFxLwgiqJwCyyYWesaQKXAQfwXYqCBxPyaDjFfWkya6xeLaNuKFYGLcVzZZQjL99dnzUpNiENFPkVmJokE1wKPpHttGpLgm9sizHNDFuwHaz2ZZRnnZ6CT95FzdrMmaDXofn1ikbKBTdumuiRWSVwwZXffcXRN6Ti1a8NfhxQDdqhT7CAmM9NjQhnrqs1vss6YdcrHP5GmQN2Mz8GenQZFnyhJZK2iPxETnxq7YJRqTduN8KC8SMfjLVB8LD7rBM5d6s8dopdgJCVBpy2p', # rubocop:disable Layout/LineLength
},
],
}.with_indifferent_access
end
it 'stores the keys' do
account = subject.call('alice', 'example.com', payload)
expect(account.public_key).to eq ''
expect(account.keypairs).to contain_exactly(
have_attributes(
uri: 'https://foo.test/actor#key1',
type: 'rsa'
),
have_attributes(
uri: 'https://foo.test/actor#key2',
type: 'rsa'
)
)
end
context 'when the account was known with a legacy key' do
let!(:alice) { Fabricate(:account, uri: 'https://foo.test/actor', domain: 'example.com', username: 'alice') }
it 'invalidates the legacy key and stores the new keys' do
expect { subject.call('alice', 'example.com', payload) }
.to change { alice.reload.public_key }.to('')
.and change { alice.keypairs.to_a }.from([]).to(
contain_exactly(
have_attributes({ uri: 'https://foo.test/actor#key1', type: 'rsa' }),
have_attributes({ uri: 'https://foo.test/actor#key2', type: 'rsa' })
)
)
end
end
end
context 'with attribution domains' do
let(:payload) do
{
@@ -7,12 +7,13 @@ RSpec.describe ActivityPub::ProcessFeaturedCollectionService do
let(:account) { Fabricate(:remote_account) }
let(:summary) { '<p>A list of remote actors you should follow.</p>' }
let(:attributed_to) { account.uri }
let(:base_json) do
{
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => 'https://example.com/featured_collections/1',
'type' => 'FeaturedCollection',
'attributedTo' => account.uri,
'attributedTo' => attributed_to,
'name' => 'Good people from other servers',
'sensitive' => false,
'discoverable' => true,
@@ -41,6 +42,16 @@ RSpec.describe ActivityPub::ProcessFeaturedCollectionService do
end
end
context 'when `attributedTo` does not match the given account' do
let(:attributed_to) { 'https://example.com/random/account' }
it 'does not create a collection and returns nil' do
expect do
expect(subject.call(account, featured_collection_json)).to be_nil
end.to_not change(Collection, :count)
end
end
context 'when URIs match up' do
it 'creates a collection and queues jobs to handle its items' do
expect { subject.call(account, featured_collection_json) }.to change(account.collections, :count).by(1)