Sha256: 5d4cc17dd0f25ceeef63e11af04a1ba56241f2f0f798dd39e3283b0372fb3f21
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'fediverse/webfinger' module Federails module Server class WebFingerController < ServerController def find resource = params.require(:resource) case resource when %r{^https?://.+} @user = Federails::Actor.find_by_federation_url(resource)&.entity when /^acct:.+/ Federails::Configuration.entity_types.each_value do |entity| @user ||= entity[:class].find_by(entity[:username_field] => username) end end raise ActiveRecord::RecordNotFound if @user.nil? render formats: [:json] end def host_meta render content_type: 'application/xrd+xml', formats: [:xml] end # TODO: complete missing endpoints private def username account = Fediverse::Webfinger.split_resource_account params.require(:resource) # Fail early if user don't _seems_ local raise ActiveRecord::RecordNotFound unless account && Fediverse::Webfinger.local_user?(account) account[:username] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
federails-0.1.0 | app/controllers/federails/server/web_finger_controller.rb |