]> cat aescling's git repositories - mastodon.git/blob - app/controllers/intents_controller.rb
Fixed an error in the aliases template of the aliases controller (#11902)
[mastodon.git] / app / controllers / intents_controller.rb
1 # frozen_string_literal: true
2
3 class IntentsController < ApplicationController
4 before_action :check_uri
5
6 rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri
7
8 def show
9 if uri.scheme == 'web+mastodon'
10 case uri.host
11 when 'follow'
12 return redirect_to authorize_interaction_path(uri: uri.query_values['uri'].gsub(/\Aacct:/, ''))
13 when 'share'
14 return redirect_to share_path(text: uri.query_values['text'])
15 end
16 end
17
18 not_found
19 end
20
21 private
22
23 def check_uri
24 not_found if uri.blank?
25 end
26
27 def handle_invalid_uri
28 not_found
29 end
30
31 def uri
32 @uri ||= Addressable::URI.parse(params[:uri])
33 end
34 end
This page took 0.069635 seconds and 4 git commands to generate.