about summary refs log tree commit diff stats
path: root/app/controllers/uploader_controller.rb
diff options
context:
space:
mode:
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