Add protocol handler. Handle follow intents (#4511)
* Add protocol handler. Handle follow intents * Add share intent * Improve code in intents controller * Adjust share form CSS
This commit is contained in:
parent
96e9ed13de
commit
3c6503038e
12 changed files with 167 additions and 3 deletions
18
app/controllers/intents_controller.rb
Normal file
18
app/controllers/intents_controller.rb
Normal file
|
@ -0,0 +1,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
|
Loading…
Add table
Add a link
Reference in a new issue