From 56f5841d4b9c12296cdfcaeff174b2627d59afc8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 11:49:49 -0500 Subject: Migrate to full rails app --- app/controllers/uploader_controller.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/controllers/uploader_controller.rb (limited to 'app/controllers/uploader_controller.rb') 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 @@ +class UploaderController < ApplicationController + skip_before_action :verify_authenticity_token + before_action :authenticate_user_from_token! + + def submit + ExtractSaveDataJob.perform_later params[:game].as_json + + render json: { message: "Data submitted for processing." } + end + + private + + def authenticate_user_from_token! + login = request.headers["X-User-Login"].presence + token = request.headers["X-User-Token"].presence + + # TODO: Replace this. + unless authenticate_pokeviewer(login, token) + head :unauthorized + end + end + +end -- cgit 1.4.1