From 13706ed9f52a84b617f7de89ec6ccbe1b0365a27 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Thu, 21 Aug 2014 11:24:12 -0400
Subject: [PATCH 01/73] no more ESDB report, DJ don't look at it anyway
---
lib/tasks/ggtracker.rake | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/tasks/ggtracker.rake b/lib/tasks/ggtracker.rake
index 68ffc4f..f6e2105 100644
--- a/lib/tasks/ggtracker.rake
+++ b/lib/tasks/ggtracker.rake
@@ -2,6 +2,5 @@ namespace :gg do
desc "Emails DJ about how its going out there."
task :report => :environment do
ReportMailer.simple_report.deliver
- ReportMailer.esdb_report.deliver
end
end
From 518641ac097e363e51a717438d2c4a1d314123eb Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Wed, 27 Aug 2014 12:09:54 -0400
Subject: [PATCH 02/73] remove implication that we are being notified about
website problems
---
app/views/application/esdb_exception.html.erb | 2 +-
app/views/application/exception.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/application/esdb_exception.html.erb b/app/views/application/esdb_exception.html.erb
index 8a02f0f..4742f4a 100644
--- a/app/views/application/esdb_exception.html.erb
+++ b/app/views/application/esdb_exception.html.erb
@@ -1,5 +1,5 @@
-
Something is wrong with this <%= object_name %>. We're on it.
+
Something is wrong with this <%= object_name %>.
(500)
diff --git a/app/views/application/exception.html.erb b/app/views/application/exception.html.erb
index 19a5322..f1a61f0 100644
--- a/app/views/application/exception.html.erb
+++ b/app/views/application/exception.html.erb
@@ -21,7 +21,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
- Something has gone wrong. We have been notified about it.
+ Something has gone wrong. Badly wrong.
From 67f80f35a1cb01adb46082cb9948c5fefcf24d87 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 29 Aug 2014 10:07:25 -0400
Subject: [PATCH 03/73] make all tests pass hooray
---
spec/controllers/replays_controller_spec.rb | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/spec/controllers/replays_controller_spec.rb b/spec/controllers/replays_controller_spec.rb
index 6108cfc..5e538cf 100644
--- a/spec/controllers/replays_controller_spec.rb
+++ b/spec/controllers/replays_controller_spec.rb
@@ -25,7 +25,7 @@
pending("can't test this without configuring Amazon S3")
end
- post :drop, :replay => Rack::Test::UploadedFile.new(@replay_file)
+ post :drop, :replays => [ Rack::Test::UploadedFile.new(@replay_file) ]
response.status.should == 201 # created
response.body.should_not be_empty
@@ -34,24 +34,6 @@
replay.should_not == nil
end
- # We want to create replays with 100% initial progress to indicate that
- # the upload has been a success and inform the user we're not waiting to
- # process the replay.
- it 'should create the replay with 100% progress' do
- if Rails.configuration.s3['replays']['access_key_id'] == 'YOUR_ACCESS_KEY'
- pending("can't test this without configuring Amazon S3")
- end
-
- post :drop, :replay => Rack::Test::UploadedFile.new(@replay_file)
-
- response.status.should == 201 # created
- response.body.should_not be_empty
-
- replay = Replay.where(:replay_file_name => File.basename(@replay_file.path)).first
- replay.should_not == nil
- replay.progress.should == 100
- end
-
it 'should create the replay via s3 drop' do
fname = "01b5b19019ac34499ecbc60ce980b26a.SC2Replay"
post :s3_drop, :file_name => fname, :s3_key => fname, :channel => "testchannel"
From 173ba984dc04dd9be9df1eefa48f9e3f83b6d64a Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 29 Aug 2014 10:07:36 -0400
Subject: [PATCH 04/73] remove unused and misleading function
---
app/models/account.rb | 8 --------
1 file changed, 8 deletions(-)
diff --git a/app/models/account.rb b/app/models/account.rb
index 35928d3..baced81 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -252,14 +252,6 @@ def url
esdb_id.present? ? "/players/#{esdb_id}/#{name}" : ''
end
- def destroy_all_matches!
- ident = ESDB::Identity.find(params[:id])
- not_found and return if !ident
-
- response = @match.userdelete(current_user.id)
-
- end
-
# Return Jbuilder for serialization
def to_builder(builder = nil)
builder ||= Jbuilder.new
From 11fc1e0fb446cd96e37d6203233225f2307101d0 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 29 Aug 2014 10:07:49 -0400
Subject: [PATCH 05/73] document how the DESTROY ALL MATCHES button works
---
app/assets/javascripts/angular/directives/account.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/app/assets/javascripts/angular/directives/account.js b/app/assets/javascripts/angular/directives/account.js
index cff13b8..6597c32 100644
--- a/app/assets/javascripts/angular/directives/account.js
+++ b/app/assets/javascripts/angular/directives/account.js
@@ -38,6 +38,14 @@ gg.directive('uaccount', ['Account', function(Account) {
error: function() {
alert("Sorry, your matches could not be deleted for some reason. Please contact hello@ggtracker.com and we will beat the person responsible.");
}
+
+ # next steps through the code:
+ #
+ # ggtracker: app/controllers/accounts_controller.rb destroy_all_matches
+ # gg: lib/esdb/identity.rb destroy_all_matches
+ # esdb: esdb/api/identities.rb post ':id/destroy_all_matches'
+ # esdb: esdb/jobs/sc2/identity/delete_all_matches.rb
+ # esdb: esdb/games/sc2/identity.rb destroy_all_matches!
});
}
}
From a1ea3ec4dce45366de3149d6b01e21a2652dd730 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Sat, 30 Aug 2014 19:18:30 -0400
Subject: [PATCH 06/73] fix javascript comment formatting. add outrageous hack
for someone who wanted to see their 3rd-base saturation speed
---
.../javascripts/angular/directives/account.js | 16 +++++------
.../javascripts/angular/directives/matches.js | 2 ++
app/views/players/show.html.erb | 28 +++++++++++++++++++
3 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/app/assets/javascripts/angular/directives/account.js b/app/assets/javascripts/angular/directives/account.js
index 6597c32..80fd849 100644
--- a/app/assets/javascripts/angular/directives/account.js
+++ b/app/assets/javascripts/angular/directives/account.js
@@ -39,13 +39,13 @@ gg.directive('uaccount', ['Account', function(Account) {
alert("Sorry, your matches could not be deleted for some reason. Please contact hello@ggtracker.com and we will beat the person responsible.");
}
- # next steps through the code:
- #
- # ggtracker: app/controllers/accounts_controller.rb destroy_all_matches
- # gg: lib/esdb/identity.rb destroy_all_matches
- # esdb: esdb/api/identities.rb post ':id/destroy_all_matches'
- # esdb: esdb/jobs/sc2/identity/delete_all_matches.rb
- # esdb: esdb/games/sc2/identity.rb destroy_all_matches!
+ // next steps through the code:
+ //
+ // ggtracker: app/controllers/accounts_controller.rb destroy_all_matches
+ // gg: lib/esdb/identity.rb destroy_all_matches
+ // esdb: esdb/api/identities.rb post ':id/destroy_all_matches'
+ // esdb: esdb/jobs/sc2/identity/delete_all_matches.rb
+ // esdb: esdb/games/sc2/identity.rb destroy_all_matches!
});
}
}
@@ -63,7 +63,7 @@ gg.directive('uaccount', ['Account', function(Account) {
// instantiation should also be moved away..)
account = new Account({id: scope.account.id, account: scope.account});
- // Note: there was a way to bind this in the resource, but @id doesn#t
+ // Note: there was a way to bind this in the resource, but @id doesnt
// work anymore.. figure out what they changed it to.
account.$save({id: account.id});
diff --git a/app/assets/javascripts/angular/directives/matches.js b/app/assets/javascripts/angular/directives/matches.js
index 22d3797..f683341 100644
--- a/app/assets/javascripts/angular/directives/matches.js
+++ b/app/assets/javascripts/angular/directives/matches.js
@@ -126,8 +126,10 @@ gg.directive('matches', ['Match', function(Match) {
'saturation_skill(avg:[<'+iid+'])',
'sat_1_skill(avg:[<'+iid+'])',
'sat_2_skill(avg:[<'+iid+'])',
+ 'sat_3_skill(avg:[<'+iid+'])',
'sat_1_skill(mavg:[<'+iid+'])',
'sat_2_skill(mavg:[<'+iid+'])',
+ 'sat_3_skill(mavg:[<'+iid+'])',
'win(mavg:[<'+iid+'])',
'win(count:[<'+iid+'])',
'loss(count:[<'+iid+'])',
diff --git a/app/views/players/show.html.erb b/app/views/players/show.html.erb
index 7cc5aab..5353293 100644
--- a/app/views/players/show.html.erb
+++ b/app/views/players/show.html.erb
@@ -111,6 +111,8 @@
recently
+
+ <% if !([22, 99055].include?(@identity.id)) %>
+ <% end %>
+
+ <% if [22, 99055].include?(@identity.id) %>
+
+
+
+
+
+ 3rd base sat speed
+
+ recently
+
+
+
+ <% end %>
+
Date: Mon, 1 Sep 2014 15:44:43 -0400
Subject: [PATCH 07/73] let him see all four charts in staircase mode
---
app/views/players/show.html.erb | 2 --
1 file changed, 2 deletions(-)
diff --git a/app/views/players/show.html.erb b/app/views/players/show.html.erb
index 5353293..e3763c8 100644
--- a/app/views/players/show.html.erb
+++ b/app/views/players/show.html.erb
@@ -112,7 +112,6 @@
- <% if !([22, 99055].include?(@identity.id)) %>
- <% end %>
From 79517defa98db4b0b0da5a7d56d27d24b108f04e Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Tue, 23 Sep 2014 16:29:52 -0400
Subject: [PATCH 08/73] sound the alarm
---
app/views/layouts/application.html.erb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 2c40ee3..b7aeaf6 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -129,7 +129,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
-
+
From aff34a5595bd8b699aa551619a9e34f496dc308f Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Tue, 23 Sep 2014 17:35:13 -0400
Subject: [PATCH 09/73] 2.1.4 now works, hooray, take away alert msg
---
app/views/layouts/application.html.erb | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index b7aeaf6..2c40ee3 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -129,7 +129,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
-
+
From 7945b6ea93f409dbe4d8188db518392aec2d0bd6 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Thu, 13 Nov 2014 15:07:52 -0500
Subject: [PATCH 10/73] new Rails to deal with security thing yet again
---
Gemfile | 2 +-
Gemfile.lock | 56 ++++++++++++++++++++++++++--------------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/Gemfile b/Gemfile
index ee020d8..4c69d70 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
ruby '1.9.3'
-gem 'rails', '3.2.19'
+gem 'rails', '3.2.20'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
diff --git a/Gemfile.lock b/Gemfile.lock
index cceeea4..048f8fd 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -46,12 +46,12 @@ GEM
remote: https://rubygems.org/
specs:
aasm (3.0.23)
- actionmailer (3.2.19)
- actionpack (= 3.2.19)
+ actionmailer (3.2.20)
+ actionpack (= 3.2.20)
mail (~> 2.5.4)
- actionpack (3.2.19)
- activemodel (= 3.2.19)
- activesupport (= 3.2.19)
+ actionpack (3.2.20)
+ activemodel (= 3.2.20)
+ activesupport (= 3.2.20)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -70,18 +70,18 @@ GEM
json (~> 1.7)
money (< 6.0.0)
nokogiri (~> 1.4)
- activemodel (3.2.19)
- activesupport (= 3.2.19)
+ activemodel (3.2.20)
+ activesupport (= 3.2.20)
builder (~> 3.0.0)
- activerecord (3.2.19)
- activemodel (= 3.2.19)
- activesupport (= 3.2.19)
+ activerecord (3.2.20)
+ activemodel (= 3.2.20)
+ activesupport (= 3.2.20)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.19)
- activemodel (= 3.2.19)
- activesupport (= 3.2.19)
- activesupport (3.2.19)
+ activeresource (3.2.20)
+ activemodel (= 3.2.20)
+ activesupport (= 3.2.20)
+ activesupport (3.2.20)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
@@ -141,7 +141,7 @@ GEM
hashie (3.2.0)
hike (1.2.3)
hirb (0.7.1)
- i18n (0.6.9)
+ i18n (0.6.11)
jbuilder (1.5.2)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
@@ -191,17 +191,17 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.19)
- actionmailer (= 3.2.19)
- actionpack (= 3.2.19)
- activerecord (= 3.2.19)
- activeresource (= 3.2.19)
- activesupport (= 3.2.19)
+ rails (3.2.20)
+ actionmailer (= 3.2.20)
+ actionpack (= 3.2.20)
+ activerecord (= 3.2.20)
+ activeresource (= 3.2.20)
+ activesupport (= 3.2.20)
bundler (~> 1.0)
- railties (= 3.2.19)
- railties (3.2.19)
- actionpack (= 3.2.19)
- activesupport (= 3.2.19)
+ railties (= 3.2.20)
+ railties (3.2.20)
+ actionpack (= 3.2.20)
+ activesupport (= 3.2.20)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -255,7 +255,7 @@ GEM
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
- sprockets (2.2.2)
+ sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
@@ -267,7 +267,7 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.39)
+ tzinfo (0.3.42)
uglifier (2.3.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -311,7 +311,7 @@ DEPENDENCIES
newrelic_rpm
paperclip
paperclip-aws
- rails (= 3.2.19)
+ rails (= 3.2.20)
rails-dev-boost!
resque
rspec
From 21170f9563371d947826f8005c6ad3b4175ab1cb Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Tue, 18 Nov 2014 16:53:04 -0500
Subject: [PATCH 11/73] security patch of the day
---
Gemfile | 2 +-
Gemfile.lock | 50 +++++++++++++++++++++++++-------------------------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/Gemfile b/Gemfile
index 4c69d70..ef26391 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
ruby '1.9.3'
-gem 'rails', '3.2.20'
+gem 'rails', '3.2.21'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
diff --git a/Gemfile.lock b/Gemfile.lock
index 048f8fd..d086960 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -46,12 +46,12 @@ GEM
remote: https://rubygems.org/
specs:
aasm (3.0.23)
- actionmailer (3.2.20)
- actionpack (= 3.2.20)
+ actionmailer (3.2.21)
+ actionpack (= 3.2.21)
mail (~> 2.5.4)
- actionpack (3.2.20)
- activemodel (= 3.2.20)
- activesupport (= 3.2.20)
+ actionpack (3.2.21)
+ activemodel (= 3.2.21)
+ activesupport (= 3.2.21)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -70,18 +70,18 @@ GEM
json (~> 1.7)
money (< 6.0.0)
nokogiri (~> 1.4)
- activemodel (3.2.20)
- activesupport (= 3.2.20)
+ activemodel (3.2.21)
+ activesupport (= 3.2.21)
builder (~> 3.0.0)
- activerecord (3.2.20)
- activemodel (= 3.2.20)
- activesupport (= 3.2.20)
+ activerecord (3.2.21)
+ activemodel (= 3.2.21)
+ activesupport (= 3.2.21)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.20)
- activemodel (= 3.2.20)
- activesupport (= 3.2.20)
- activesupport (3.2.20)
+ activeresource (3.2.21)
+ activemodel (= 3.2.21)
+ activesupport (= 3.2.21)
+ activesupport (3.2.21)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
@@ -191,17 +191,17 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.20)
- actionmailer (= 3.2.20)
- actionpack (= 3.2.20)
- activerecord (= 3.2.20)
- activeresource (= 3.2.20)
- activesupport (= 3.2.20)
+ rails (3.2.21)
+ actionmailer (= 3.2.21)
+ actionpack (= 3.2.21)
+ activerecord (= 3.2.21)
+ activeresource (= 3.2.21)
+ activesupport (= 3.2.21)
bundler (~> 1.0)
- railties (= 3.2.20)
- railties (3.2.20)
- actionpack (= 3.2.20)
- activesupport (= 3.2.20)
+ railties (= 3.2.21)
+ railties (3.2.21)
+ actionpack (= 3.2.21)
+ activesupport (= 3.2.21)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -311,7 +311,7 @@ DEPENDENCIES
newrelic_rpm
paperclip
paperclip-aws
- rails (= 3.2.20)
+ rails (= 3.2.21)
rails-dev-boost!
resque
rspec
From ebf48cd88621b074060c0ec9c5ea21ec3c566b05 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 21 Nov 2014 21:55:12 -0500
Subject: [PATCH 12/73] rate limiting and block asshole IP
---
Gemfile | 2 ++
Gemfile.lock | 3 +++
config.ru | 2 ++
3 files changed, 7 insertions(+)
diff --git a/Gemfile b/Gemfile
index ef26391..8bb32e7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -142,3 +142,5 @@ gem 'curb'
#gem 'aws-s3'
gem 'activemerchant'
+
+gem 'rack-attack'
diff --git a/Gemfile.lock b/Gemfile.lock
index d086960..e3717ff 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -183,6 +183,8 @@ GEM
paperclip (>= 2.5.0)
polyglot (0.3.5)
rack (1.4.5)
+ rack-attack (4.2.0)
+ rack
rack-cache (1.2)
rack (>= 0.4)
rack-protection (1.5.1)
@@ -311,6 +313,7 @@ DEPENDENCIES
newrelic_rpm
paperclip
paperclip-aws
+ rack-attack
rails (= 3.2.21)
rails-dev-boost!
resque
diff --git a/config.ru b/config.ru
index 05317ca..9322a05 100644
--- a/config.ru
+++ b/config.ru
@@ -2,3 +2,5 @@
require ::File.expand_path('../config/environment', __FILE__)
run Ggtracker::Application
+
+use Rack::Attack
From c0ed9b722364d331c17e6f7f62bbcbefd46c56af Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 21 Nov 2014 21:55:24 -0500
Subject: [PATCH 13/73] rate limiting and block asshole IP
---
config/initializers/rack-attack.rb | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 config/initializers/rack-attack.rb
diff --git a/config/initializers/rack-attack.rb b/config/initializers/rack-attack.rb
new file mode 100644
index 0000000..50508f3
--- /dev/null
+++ b/config/initializers/rack-attack.rb
@@ -0,0 +1,13 @@
+# In config/initializers/rack-attack.rb
+class Rack::Attack
+
+ throttle('req/ip', :limit => 300, :period => 5.minutes) do |req|
+ req.ip # unless req.path.starts_with?('/assets')
+ end
+
+
+end
+
+Rack::Attack.blacklist('block 98.163.122.235') do |req|
+ '98.163.122.235' == req.ip
+end
From c2c1fbcd98d93dded1f1450a9ad0ce2d45f0ccbe Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 21 Nov 2014 23:17:28 -0500
Subject: [PATCH 14/73] log exceptions
---
app/controllers/application_controller.rb | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 27d6d17..0c12b86 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -60,6 +60,12 @@ def not_found(exception = nil)
# The idea here is to not remove the user from the website entirely just
# because esdb has failed.
def esdb_exception(exception = nil)
+ if exception
+ Rails.logger.error "YO ITS AN ESDB EXCEPTION"
+ Rails.logger.error exception.message
+ st = exception.backtrace.join("\n")
+ Rails.logger.error st
+ end
object_name = case self
when PlayersController then 'player'
when MatchesController then 'match'
@@ -72,6 +78,12 @@ def esdb_exception(exception = nil)
# The exception template has a minimal layout for itself to avoid triggering
# the exception it was rendered for again.
def exception(exception = nil)
+ if exception
+ Rails.logger.error "YO ITS AN EXCEPTION"
+ Rails.logger.error exception.message
+ st = exception.backtrace.join("\n")
+ Rails.logger.error st
+ end
render 'exception', locals: {exception: exception}, status: 500, layout: false
end
From 96c97c7042ca82d0352ab92204fe118329c4d372 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Sat, 21 Feb 2015 10:26:16 -0500
Subject: [PATCH 15/73] wtf
---
config/routes.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/routes.rb b/config/routes.rb
index 196800e..3986ad4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -138,4 +138,5 @@
# 404
match "*path" => 'application#not_found'
+ match "foo" => 'bar'
end
From eb337b579da2a39af15599540b25bece9546ce83 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Tue, 3 Mar 2015 14:16:21 -0500
Subject: [PATCH 16/73] keep IP cache in memory rather than on disk
---
config/initializers/rack-attack.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/config/initializers/rack-attack.rb b/config/initializers/rack-attack.rb
index 50508f3..dc588ae 100644
--- a/config/initializers/rack-attack.rb
+++ b/config/initializers/rack-attack.rb
@@ -1,6 +1,8 @@
# In config/initializers/rack-attack.rb
class Rack::Attack
+ Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
+
throttle('req/ip', :limit => 300, :period => 5.minutes) do |req|
req.ip # unless req.path.starts_with?('/assets')
end
From e990ea22fa322be50c53ca4152b42fef11811032 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Thu, 26 Mar 2015 17:05:27 -0400
Subject: [PATCH 17/73] update for rest-client vulnerability
---
Gemfile.lock | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index e3717ff..28c8a64 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -119,6 +119,8 @@ GEM
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.4)
+ domain_name (0.5.23)
+ unf (>= 0.0.5, < 1.0.0)
ejs (1.1.1)
erubis (2.7.0)
execjs (2.0.2)
@@ -141,6 +143,8 @@ GEM
hashie (3.2.0)
hike (1.2.3)
hirb (0.7.1)
+ http-cookie (1.0.2)
+ domain_name (~> 0.5)
i18n (0.6.11)
jbuilder (1.5.2)
activesupport (>= 3.0.0)
@@ -168,7 +172,7 @@ GEM
multipart-post (2.0.0)
mysql2 (0.3.13)
net-http-spy (0.2.1)
- netrc (0.7.7)
+ netrc (0.10.3)
newrelic_rpm (3.9.1.236)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
@@ -225,7 +229,8 @@ GEM
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
- rest-client (1.7.2)
+ rest-client (1.8.0)
+ http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (2.14.1)
@@ -273,6 +278,9 @@ GEM
uglifier (2.3.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
+ unf (0.1.4)
+ unf_ext
+ unf_ext (0.0.6)
unicorn (1.1.5)
rack
uuidtools (2.1.4)
From 757ac379ce67f23affe8d4ed7254d2a6a01287f4 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 19 Jun 2015 17:23:45 -0400
Subject: [PATCH 18/73] security update yay
---
Gemfile | 2 +-
Gemfile.lock | 62 ++++++++++++++++++++++++++--------------------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8bb32e7..b5cd3de 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
ruby '1.9.3'
-gem 'rails', '3.2.21'
+gem 'rails', '3.2.22'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
diff --git a/Gemfile.lock b/Gemfile.lock
index 28c8a64..5a42e31 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -46,12 +46,12 @@ GEM
remote: https://rubygems.org/
specs:
aasm (3.0.23)
- actionmailer (3.2.21)
- actionpack (= 3.2.21)
+ actionmailer (3.2.22)
+ actionpack (= 3.2.22)
mail (~> 2.5.4)
- actionpack (3.2.21)
- activemodel (= 3.2.21)
- activesupport (= 3.2.21)
+ actionpack (3.2.22)
+ activemodel (= 3.2.22)
+ activesupport (= 3.2.22)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -70,18 +70,18 @@ GEM
json (~> 1.7)
money (< 6.0.0)
nokogiri (~> 1.4)
- activemodel (3.2.21)
- activesupport (= 3.2.21)
+ activemodel (3.2.22)
+ activesupport (= 3.2.22)
builder (~> 3.0.0)
- activerecord (3.2.21)
- activemodel (= 3.2.21)
- activesupport (= 3.2.21)
+ activerecord (3.2.22)
+ activemodel (= 3.2.22)
+ activesupport (= 3.2.22)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.21)
- activemodel (= 3.2.21)
- activesupport (= 3.2.21)
- activesupport (3.2.21)
+ activeresource (3.2.22)
+ activemodel (= 3.2.22)
+ activesupport (= 3.2.22)
+ activesupport (3.2.22)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
@@ -153,7 +153,7 @@ GEM
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
- json (1.8.1)
+ json (1.8.3)
juggernaut (2.1.1)
redis
listen (1.1.6)
@@ -168,7 +168,7 @@ GEM
money (5.1.1)
i18n (~> 0.6.0)
mono_logger (1.1.0)
- multi_json (1.10.1)
+ multi_json (1.11.1)
multipart-post (2.0.0)
mysql2 (0.3.13)
net-http-spy (0.2.1)
@@ -186,7 +186,7 @@ GEM
aws-sdk (>= 1.2.0)
paperclip (>= 2.5.0)
polyglot (0.3.5)
- rack (1.4.5)
+ rack (1.4.7)
rack-attack (4.2.0)
rack
rack-cache (1.2)
@@ -195,24 +195,24 @@ GEM
rack
rack-ssl (1.3.4)
rack
- rack-test (0.6.2)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (3.2.21)
- actionmailer (= 3.2.21)
- actionpack (= 3.2.21)
- activerecord (= 3.2.21)
- activeresource (= 3.2.21)
- activesupport (= 3.2.21)
+ rails (3.2.22)
+ actionmailer (= 3.2.22)
+ actionpack (= 3.2.22)
+ activerecord (= 3.2.22)
+ activeresource (= 3.2.22)
+ activesupport (= 3.2.22)
bundler (~> 1.0)
- railties (= 3.2.21)
- railties (3.2.21)
- actionpack (= 3.2.21)
- activesupport (= 3.2.21)
+ railties (= 3.2.22)
+ railties (3.2.22)
+ actionpack (= 3.2.22)
+ activesupport (= 3.2.22)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- rake (10.3.2)
+ rake (10.4.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
@@ -274,7 +274,7 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.42)
+ tzinfo (0.3.44)
uglifier (2.3.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
@@ -322,7 +322,7 @@ DEPENDENCIES
paperclip
paperclip-aws
rack-attack
- rails (= 3.2.21)
+ rails (= 3.2.22)
rails-dev-boost!
resque
rspec
From 60517c6819643e977603413bef17bfe550d9c1f6 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Fri, 17 Jul 2015 17:20:35 -0400
Subject: [PATCH 19/73] enable "remember me" because some users just like it
---
app/assets/stylesheets/ui/dialogs.css.scss | 9 ++++++++-
app/views/dialogs/_join_aio.html.erb | 6 +++++-
config/initializers/devise.rb | 2 +-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/app/assets/stylesheets/ui/dialogs.css.scss b/app/assets/stylesheets/ui/dialogs.css.scss
index 8d25a7d..7ea8ad2 100644
--- a/app/assets/stylesheets/ui/dialogs.css.scss
+++ b/app/assets/stylesheets/ui/dialogs.css.scss
@@ -146,9 +146,16 @@ $dialog-inner-width: $dialog-width - $dialog-padding * 2;
}
}
+ #remember {
+ font-size: 12px;
+ display: inline-block;
+ word-spacing: 0px;
+ vertical-align: bottom;
+ }
+
li.action {
// width: ($dialog-inner-width * 0.30);
- width: 30%;
+ // width: 20px;
button {
@include button2(lighten(desaturate(green, 15%), 35%), black);
diff --git a/app/views/dialogs/_join_aio.html.erb b/app/views/dialogs/_join_aio.html.erb
index d566f88..b5bc1ee 100644
--- a/app/views/dialogs/_join_aio.html.erb
+++ b/app/views/dialogs/_join_aio.html.erb
@@ -23,7 +23,11 @@
<% end %>
<%= f.inputs do %>
- <%= f.input :password, :label => false, :input_html => {:placeholder => 'Password'} %>
+ <%= f.input :password, :label => false, :input_html => {:placeholder => 'Password'} %>
+
+ <%= f.check_box :remember_me, :label => :remember_me %>
+ Remember me
+
<%= f.action :submit, :as => :button, :label => 'login' %>
<% end %>
<% end %>
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index f5f225d..5916315 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -105,7 +105,7 @@
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
- # config.remember_for = 2.weeks
+ config.remember_for = 90.days
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
From 122e0bab1c35291e3f27668f0692b14b0b1faec4 Mon Sep 17 00:00:00 2001
From: eric-hu
Date: Wed, 22 Jul 2015 19:11:10 +0700
Subject: [PATCH 20/73] Simplify "basic installation" notes
Use the Rails-provided rake task for creating the dev database.
Change database-schema loading instructions, which is more future-proof. Running migrations on the latest build resulted in this schema.rb difference:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: ../db/schema.rb
no changes added to commit (use "git add" and/or "git commit -a")
$ cd ..
$ git diff
diff --git a/db/schema.rb b/db/schema.rb
index 6c263e3..904a869 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -95,7 +95,6 @@ ActiveRecord::Schema.define(:version => 20131101180159) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "handle"
- t.boolean "anonymous", :default => false
t.boolean "guest", :default => false
t.datetime "processing_timestamp"
t.string "access_token"
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index b0bd96a..9462591 100644
--- a/README.md
+++ b/README.md
@@ -32,8 +32,8 @@ On Mac OSX, you can use homebrew as package manager: http://mxcl.github.com/home
* Copy and adjust database configuration (`cp config/database.yml.example config/database.yml`)
* Copy secrets configuration (`cp config/secrets.yml.example config/secrets.yml`)
* Copy s3 configuration (`cp config/s3.yml.example config/s3.yml`)
- * Create the database ggtracker needs (`mysql -u root` and then `create database ggtracker_development;` and then `quit`)
- * Run migrations (`bundle exec rake db:migrate`)
+ * Create the database ggtracker needs (`rake db:create`)
+ * Load the latest database schema (`bundle exec rake db:schema:load`)
If you want to be able to upload replays, you'll need to have an
Amazon S3 account. After setting that up, edit your config/s3.yml
From fefac70c107268575c7937ae60ad15b4e874c4d5 Mon Sep 17 00:00:00 2001
From: eric-hu
Date: Wed, 22 Jul 2015 19:48:18 +0700
Subject: [PATCH 21/73] Simplify test preparation notes
---
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 9462591..0d15bbc 100644
--- a/README.md
+++ b/README.md
@@ -68,9 +68,7 @@ find each other correctly.
#### Ruby (rspec)
The first time you run tests, set up the test database with:
- * `mysql -u root`
- ** `create database ggtracker_test;`
- ** `quit`
+ * `rake db:create`
* `rake db:test:prepare`
To run tests: `bundle exec rspec`
From b0fdd28ecca64156893ae92e2a405c4510d1b990 Mon Sep 17 00:00:00 2001
From: David Joerg
Date: Wed, 22 Jul 2015 09:24:40 -0400
Subject: [PATCH 22/73] user model should not have an anonymous field, it is
unused
---
db/schema.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/db/schema.rb b/db/schema.rb
index 6c263e3..904a869 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -95,7 +95,6 @@
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "handle"
- t.boolean "anonymous", :default => false
t.boolean "guest", :default => false
t.datetime "processing_timestamp"
t.string "access_token"
From 90b7c529482e7a1a8ed5df38a8b4ea9b23d8bc72 Mon Sep 17 00:00:00 2001
From: Eric Hu
Date: Wed, 22 Jul 2015 19:35:53 +0700
Subject: [PATCH 23/73] Configure simplecov to ignore spec folder
Reduce noise in code coverage output. All spec files are run 100% in
the test suite. This lowers the overall code coverage number...sorry :D
---
spec/spec_helper.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a2df784..1db7861 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,9 @@
# SimpleCov is ..rcov for 1.9+
# https://github.com/colszowka/simplecov
require 'simplecov'
-SimpleCov.start
+SimpleCov.start do
+ add_filter "/spec/"
+end
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
From c9e3560e61d89bb10f3a221313d0ffa77cb53ed1 Mon Sep 17 00:00:00 2001
From: Eric Hu
Date: Mon, 3 Aug 2015 20:08:00 +0700
Subject: [PATCH 24/73] Add unit display on timeline for AI (1v1 only)
---
app/assets/javascripts/angular/resources/match.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js
index 7d51600..983948a 100644
--- a/app/assets/javascripts/angular/resources/match.js
+++ b/app/assets/javascripts/angular/resources/match.js
@@ -245,6 +245,8 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
this.entityIds = [];
this.teams = {};
+ var twoPlayerMatch = this.playerCount === 2;
+
for(var ei in this.entities) {
// console.log("ei", ei, this.armies_by_frame, this.entities, this.entities[ei].identity.name);
if (this.armies_by_frame && this.entities[ei].identity) {
@@ -255,6 +257,8 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
} else if (this.entities[ei].identity.id in this.armies_by_frame) {
entityArmy = this.armies_by_frame[this.entities[ei].identity.id];
// console.log("got abf for ei by id", ei, entityArmy);
+ } else if (this.entities[ei].identity.name.match(/A.I./) && twoPlayerMatch) {
+ entityArmy = this.armies_by_frame[0];
}
this.entities[ei].armies_by_frame = entityArmy;
}
From 6017b9db5c9d00b7bf02470134a40227b888a4e2 Mon Sep 17 00:00:00 2001
From: dsjoerg
Date: Wed, 7 Oct 2015 12:01:26 -0400
Subject: [PATCH 25/73] disable upload for now
---
app/views/layouts/application.html.erb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 2c40ee3..2807bf7 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -168,12 +168,17 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_