Allow to launch RS apps from dashboard
This commit is contained in:
@@ -95,13 +95,6 @@ class Rs::OauthController < ApplicationController
|
||||
allow_other_host: true
|
||||
end
|
||||
|
||||
# GET /rs/oauth/token/:id/launch_app
|
||||
def launch_app
|
||||
auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||
|
||||
redirect_to app_auth_url(auth), allow_other_host: true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_signed_in_with_username
|
||||
@@ -111,12 +104,6 @@ class Rs::OauthController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def app_auth_url(auth)
|
||||
url = "#{auth.url}#remotestorage=#{current_user.address}"
|
||||
url += "&access_token=#{auth.token}"
|
||||
url
|
||||
end
|
||||
|
||||
def hostname_of(uri)
|
||||
uri.gsub(/http(s)?:\/\//, "").split(":")[0].split("/")[0]
|
||||
end
|
||||
|
||||
@@ -5,8 +5,8 @@ class Services::RsAuthsController < Services::BaseController
|
||||
# before_action :require_service_enabled
|
||||
|
||||
def destroy
|
||||
if @rs_auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||
@rs_auth.destroy!
|
||||
if auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||
auth.destroy!
|
||||
else
|
||||
http_status :not_found
|
||||
end
|
||||
@@ -20,6 +20,13 @@ class Services::RsAuthsController < Services::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def launch_app
|
||||
auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||
launch_url = "#{auth.url}#remotestorage=#{current_user.address}&access_token=#{auth.token}"
|
||||
|
||||
redirect_to launch_url, allow_other_host: true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_feature_enabled
|
||||
|
||||
Reference in New Issue
Block a user