about summary refs log tree commit diff
path: root/app/controllers/intents_controller.rb
blob: 504befd1f13112f097f1011e30c6378d37360264 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class IntentsController < ApplicationController
  def show
    uri = Addressable::URI.parse(params[:uri])

    if uri.scheme == 'web+mastodon'
      case uri.host
      when 'follow'
        return redirect_to authorize_follow_path(acct: uri.query_values['uri'].gsub(/\Aacct:/, ''))
      when 'share'
        return redirect_to share_path(text: uri.query_values['text'])
      end
    end

    not_found
  end
end