about summary refs log tree commit diff stats
path: root/app/controllers/uploader_controller.rb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 11:49:49 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 11:49:49 -0500
commit56f5841d4b9c12296cdfcaeff174b2627d59afc8 (patch)
tree4f7da4ebbe5ee15a1594b26466ed78e2cf10de35 /app/controllers/uploader_controller.rb
parentc1b0443ba2aebdbd39291ddab0c189f3f4831320 (diff)
downloadpokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.tar.gz
pokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.tar.bz2
pokeviewer-56f5841d4b9c12296cdfcaeff174b2627d59afc8.zip
Migrate to full rails app
Diffstat (limited to 'app/controllers/uploader_controller.rb')
-rw-r--r--app/controllers/uploader_controller.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/uploader_controller.rb b/app/controllers/uploader_controller.rb new file mode 100644 index 0000000..72d4c2e --- /dev/null +++ b/app/controllers/uploader_controller.rb
@@ -0,0 +1,23 @@
1class UploaderController < ApplicationController
2 skip_before_action :verify_authenticity_token
3 before_action :authenticate_user_from_token!
4
5 def submit
6 ExtractSaveDataJob.perform_later params[:game].as_json
7
8 render json: { message: "Data submitted for processing." }
9 end
10
11 private
12
13 def authenticate_user_from_token!
14 login = request.headers["X-User-Login"].presence
15 token = request.headers["X-User-Token"].presence
16
17 # TODO: Replace this.
18 unless authenticate_pokeviewer(login, token)
19 head :unauthorized
20 end
21 end
22
23end