diff options
Diffstat (limited to 'rails/app/controllers')
-rw-r--r-- | rails/app/controllers/concerns/.keep | 0 | ||||
-rw-r--r-- | rails/app/controllers/lingo/application_controller.rb | 5 | ||||
-rw-r--r-- | rails/app/controllers/lingo/scores_controller.rb | 25 |
3 files changed, 0 insertions, 30 deletions
diff --git a/rails/app/controllers/concerns/.keep b/rails/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 --- a/rails/app/controllers/concerns/.keep +++ /dev/null | |||
diff --git a/rails/app/controllers/lingo/application_controller.rb b/rails/app/controllers/lingo/application_controller.rb deleted file mode 100644 index 08b728f..0000000 --- a/rails/app/controllers/lingo/application_controller.rb +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | module Lingo | ||
2 | class ApplicationController < ActionController::Base | ||
3 | protect_from_forgery with: :exception | ||
4 | end | ||
5 | end | ||
diff --git a/rails/app/controllers/lingo/scores_controller.rb b/rails/app/controllers/lingo/scores_controller.rb deleted file mode 100644 index 59bbd9d..0000000 --- a/rails/app/controllers/lingo/scores_controller.rb +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | module Lingo | ||
2 | class ScoresController < ApplicationController | ||
3 | skip_before_action :verify_authenticity_token, only: [:update] | ||
4 | |||
5 | def index | ||
6 | @scores = Score.order(score: :desc) | ||
7 | end | ||
8 | |||
9 | def update | ||
10 | if params[:secret_code] != Lingo.secret_code then | ||
11 | head :unauthorized | ||
12 | else | ||
13 | score = Score.find_or_create_by(user_id: params[:user_id]) do |score| | ||
14 | score.score = 0 | ||
15 | end | ||
16 | score.username = params[:username] | ||
17 | score.avatar_url = CGI.unescape(params[:avatar_url]) | ||
18 | score.score += 1 | ||
19 | score.save! | ||
20 | |||
21 | head :created | ||
22 | end | ||
23 | end | ||
24 | end | ||
25 | end | ||