Sha256: a8e12dee568e4f1a0eeb07182440fe9b002aa367f3c2ea7b9ded2910e594bd19
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'fediverse/webfinger' module Federails module Server class WebFingerController < Federails::ServerController def find skip_authorization 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: [:jrd] end def host_meta skip_authorization render formats: [:xrd] 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.3.0 | app/controllers/federails/server/web_finger_controller.rb |