* FixSec: スタンプを経由してカスタム絵文字のデータを改竄できる問題 * Fix: 相乗り絵文字が受け取れない問題とテスト * Change: 相乗りスタンプは常にオリジナルの情報を参照 * Fix: uriまで偽装した場合に対応
37 lines
627 B
Ruby
37 lines
627 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
|
include RoutingHelper
|
|
|
|
context_extensions :emoji, :license, :keywords
|
|
|
|
attributes :id, :type, :name, :keywords, :is_sensitive, :updated
|
|
|
|
attribute :license, if: -> { object.license.present? }
|
|
|
|
has_one :icon, serializer: ActivityPub::ImageSerializer
|
|
|
|
def id
|
|
ActivityPub::TagManager.instance.uri_for(object)
|
|
end
|
|
|
|
def type
|
|
'Emoji'
|
|
end
|
|
|
|
def keywords
|
|
object.aliases
|
|
end
|
|
|
|
def icon
|
|
object.image
|
|
end
|
|
|
|
def updated
|
|
object.updated_at.iso8601
|
|
end
|
|
|
|
def name
|
|
":#{object.shortcode}:"
|
|
end
|
|
end
|