The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

26 行
842 B

  1. # frozen_string_literal: true
  2. class WebfingerSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. attributes :subject, :aliases, :links
  5. def subject
  6. object.to_webfinger_s
  7. end
  8. def aliases
  9. [short_account_url(object), account_url(object)]
  10. end
  11. def links
  12. [
  13. { rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: short_account_url(object) },
  14. { rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(object, format: 'atom') },
  15. { rel: 'self', type: 'application/activity+json', href: account_url(object) },
  16. { rel: 'magic-public-key', href: "data:application/magic-public-key,#{object.magic_key}" },
  17. { rel: 'http://ostatus.org/schema/1.0/subscribe', template: "#{authorize_interaction_url}?uri={uri}" },
  18. ]
  19. end
  20. end