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