diff --git a/app/controllers/well_known/host_meta_controller.rb b/app/controllers/well_known/host_meta_controller.rb index 5fb70288..d185a600 100644 --- a/app/controllers/well_known/host_meta_controller.rb +++ b/app/controllers/well_known/host_meta_controller.rb @@ -2,18 +2,8 @@ module WellKnown class HostMetaController < ActionController::Base - include RoutingHelper - - before_action { response.headers['Vary'] = 'Accept' } - def show - @webfinger_template = "#{webfinger_url}?resource={uri}" - - respond_to do |format| - format.xml { render content_type: 'application/xrd+xml' } - end - - expires_in(3.days, public: true) + raise GabSocial::NotPermittedError end end end diff --git a/app/controllers/well_known/keybase_proof_config_controller.rb b/app/controllers/well_known/keybase_proof_config_controller.rb index eb41e586..0661bbe4 100644 --- a/app/controllers/well_known/keybase_proof_config_controller.rb +++ b/app/controllers/well_known/keybase_proof_config_controller.rb @@ -3,7 +3,7 @@ module WellKnown class KeybaseProofConfigController < ActionController::Base def show - render json: {}, serializer: ProofProvider::Keybase::ConfigSerializer + render json: {}, status: 404 end end end diff --git a/app/controllers/well_known/webfinger_controller.rb b/app/controllers/well_known/webfinger_controller.rb index 28654b61..dcb3ed10 100644 --- a/app/controllers/well_known/webfinger_controller.rb +++ b/app/controllers/well_known/webfinger_controller.rb @@ -2,43 +2,8 @@ module WellKnown class WebfingerController < ActionController::Base - include RoutingHelper - - before_action { response.headers['Vary'] = 'Accept' } - def show - @account = Account.find_local!(username_from_resource) - - respond_to do |format| - format.any(:json, :html) do - render json: @account, serializer: WebfingerSerializer, content_type: 'application/jrd+json' - end - - format.xml do - render content_type: 'application/xrd+xml' - end - end - - expires_in(3.days, public: true) - rescue ActiveRecord::RecordNotFound - head 404 - end - - private - - def username_from_resource - resource_user = resource_param - - username, domain = resource_user.split('@') - if Rails.configuration.x.alternate_domains.include?(domain) - resource_user = "#{username}@#{Rails.configuration.x.local_domain}" - end - - WebfingerResource.new(resource_user).username - end - - def resource_param - params.require(:resource) + raise GabSocial::NotPermittedError end end end diff --git a/config/routes.rb b/config/routes.rb index d92c5fce..6870425d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,7 +22,7 @@ Rails.application.routes.draw do tokens: 'oauth/tokens' end - get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' } + get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger get '.well-known/change-password', to: redirect('/auth/edit') get '.well-known/keybase-proof-config', to: 'well_known/keybase_proof_config#show'