about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-02-26 22:07:00 -0600
committerStarfall <us@starfall.systems>2021-02-26 22:07:00 -0600
commit033b1b5b900babc9b068ddad0ae644c5f15e9ffe (patch)
tree76a4d5f8890836e855cccdf4ad7d58fd9c0159ee /app/controllers/api/v1/accounts
parent35f9f9565e142b8c8e7541549046bad679f1438d (diff)
parent4aa860b65bd796b09dc0ceffa1fdd7de31060a34 (diff)
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'app/controllers/api/v1/accounts')
-rw-r--r--app/controllers/api/v1/accounts/lookup_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/api/v1/accounts/lookup_controller.rb b/app/controllers/api/v1/accounts/lookup_controller.rb
new file mode 100644
index 000000000..aee6be18a
--- /dev/null
+++ b/app/controllers/api/v1/accounts/lookup_controller.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class Api::V1::Accounts::LookupController < Api::BaseController
+  before_action -> { authorize_if_got_token! :read, :'read:accounts' }
+  before_action :set_account
+
+  def show
+    render json: @account, serializer: REST::AccountSerializer
+  end
+
+  private
+
+  def set_account
+    @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
+  end
+end