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 @@

Oops.

-

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_

Uh oh.





-

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)) %>
recently

+ <% end %>
@@ -175,6 +178,31 @@
+ + <% 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)) %>
recently

- <% 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_
  • players
  • matches
  • 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_
  • players
  • matches
  • 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_
    From 2d8223d6421eb4ad54aa760da52f574e5343344f Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Fri, 13 Nov 2015 11:15:32 -0500 Subject: [PATCH 31/73] note no Archon mode --- app/views/home/replay_problems.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/home/replay_problems.html.erb b/app/views/home/replay_problems.html.erb index 63f9502..1ee3ae2 100644 --- a/app/views/home/replay_problems.html.erb +++ b/app/views/home/replay_problems.html.erb @@ -8,8 +8,8 @@

    Sorry, we had trouble reading the replays you uploaded.

    -

    If these were ordinary ladder WoL/HotS Starcraft 2 replay files, please let me know and I'll take a closer look.

    -

    LotV is not supported, but it will be in time for the official launch.

    +

    If these were ordinary ladder Starcraft 2 replay files, please let me know and I'll take a closer look.

    +

    (Note that Archon mode is not supported TT)
















    dont click hereor here
    From f60fff64ad0e1447b1b578defa6219acc4feec24 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Fri, 13 Nov 2015 11:16:16 -0500 Subject: [PATCH 32/73] note no Archon mode --- app/views/home/replay_problems.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/home/replay_problems.html.erb b/app/views/home/replay_problems.html.erb index b212ecf..1ee3ae2 100644 --- a/app/views/home/replay_problems.html.erb +++ b/app/views/home/replay_problems.html.erb @@ -8,8 +8,8 @@

    Sorry, we had trouble reading the replays you uploaded.

    -

    If these were ordinary ladder WoL/HotS Starcraft 2 replay files, please let me know and I'll take a closer look.

    -

    LotV is supported now, but there may be bugs so please let me know.

    +

    If these were ordinary ladder Starcraft 2 replay files, please let me know and I'll take a closer look.

    +

    (Note that Archon mode is not supported TT)
















    dont click hereor here
    From 3c4cf6ffa5ed7ed242af30146464b1a6ddbaae17 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 17 Nov 2015 10:11:38 -0500 Subject: [PATCH 33/73] update stats to be for LotV instead of HotS. remove desrow and WCS from main menu --- app/views/home/economy_stats.html | 2 +- app/views/home/economy_stats2.html | 2 +- app/views/layouts/application.html.erb | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/home/economy_stats.html b/app/views/home/economy_stats.html index 5ef4c3a..62098c2 100644 --- a/app/views/home/economy_stats.html +++ b/app/views/home/economy_stats.html @@ -67,7 +67,7 @@

    See more about Saturation Speed here.

    -

    All games are 1v1 HotS Ladder, vs-AI excluded, from May 8, 2013 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    +

    All games are 1v1 LotV Ladder, vs-AI excluded, from Nov 9, 2015 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    Stats are updated once per day.

    Alternate view: all matchups, one league

    diff --git a/app/views/home/economy_stats2.html b/app/views/home/economy_stats2.html index 40a25bc..05e6657 100644 --- a/app/views/home/economy_stats2.html +++ b/app/views/home/economy_stats2.html @@ -66,7 +66,7 @@

    See more about Saturation Speed here.

    -

    All games are 1v1 HotS Ladder, vs-AI excluded, from May 8, 2013 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    +

    All games are 1v1 LotV Ladder, vs-AI excluded, from Nov 9, 2015 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    Stats are updated once per day.

    Alternate view: one matchup, all leagues

    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2c40ee3..b309504 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -135,8 +135,6 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
  • Spending Skill Stats
  • Economy Stats
  • TheStaircase Benchmarks
  • -
  •  Gold Speed Ahead with desRow
  • -
  • WCS matches
  •  
  • Frequently Asked Questions
  • From f2c0084984083245e64c596868113ff3402ad877 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 17 Nov 2015 10:15:00 -0500 Subject: [PATCH 34/73] update stats to LotV. remove desrow and WCS. --- app/views/home/economy_stats.html | 2 +- app/views/home/economy_stats2.html | 2 +- app/views/layouts/application.html.erb | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/home/economy_stats.html b/app/views/home/economy_stats.html index 5ef4c3a..62098c2 100644 --- a/app/views/home/economy_stats.html +++ b/app/views/home/economy_stats.html @@ -67,7 +67,7 @@

    See more about Saturation Speed here.

    -

    All games are 1v1 HotS Ladder, vs-AI excluded, from May 8, 2013 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    +

    All games are 1v1 LotV Ladder, vs-AI excluded, from Nov 9, 2015 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    Stats are updated once per day.

    Alternate view: all matchups, one league

    diff --git a/app/views/home/economy_stats2.html b/app/views/home/economy_stats2.html index 40a25bc..05e6657 100644 --- a/app/views/home/economy_stats2.html +++ b/app/views/home/economy_stats2.html @@ -66,7 +66,7 @@

    See more about Saturation Speed here.

    -

    All games are 1v1 HotS Ladder, vs-AI excluded, from May 8, 2013 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    +

    All games are 1v1 LotV Ladder, vs-AI excluded, from Nov 9, 2015 to {{ es['PvP'][1].retrieval_time | date:'MMM d, y'}}.

    Stats are updated once per day.

    Alternate view: one matchup, all leagues

    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2c40ee3..b309504 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -135,8 +135,6 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
  • Spending Skill Stats
  • Economy Stats
  • TheStaircase Benchmarks
  • -
  •  Gold Speed Ahead with desRow
  • -
  • WCS matches
  •  
  • Frequently Asked Questions
  • From 9c9ca71de6e3989794a79593a152b0b525c91d3c Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Thu, 3 Dec 2015 16:56:06 -0500 Subject: [PATCH 35/73] hide race-macro and creep spread stuff because its broken currently --- .../stylesheets/controllers/players.css.scss | 1 + app/views/layouts/application.html.erb | 2 -- app/views/matches/show.html.erb | 26 ------------------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/assets/stylesheets/controllers/players.css.scss b/app/assets/stylesheets/controllers/players.css.scss index 410a48c..b8847dd 100644 --- a/app/assets/stylesheets/controllers/players.css.scss +++ b/app/assets/stylesheets/controllers/players.css.scss @@ -162,6 +162,7 @@ tr th, tr td { padding: 4px 4px; } + .racemacro, .creep_spread { display: none; } } #player .matches table.staircase { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b309504..4b43993 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -141,8 +141,6 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
  • Spending Skill
  • Saturation Speed
  • Auto Uploader
  • -
  • Race-Specific Macro
  • -
  • All About Larva Injects
  • FAQ in Deutsch
  •  
  • diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 98c7154..3f54b5e 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -261,33 +261,7 @@ completed to when 3x640 = 1920 minerals per minute income is achieved." data-gra bases - - - - {{ entity.identity.name }}'s inject timing ({{ entity.race_macro_pretty() }}%) - - - - - - creep spread - - - - - - {{ entity.identity.name }}'s chronoboosts
    and nexus energy maxouts ({{ entity.race_macro_pretty() }}%) -
    -
    -
    - - - - {{ entity.identity.name }}'s Orbital Command
    usage and energy maxouts ({{ entity.race_macro_pretty() }}%) -
    -
    -
    <% end %> <% if signed_in? %> From e3b3908ec7230448247ee591adcf51f7476205de Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 22 Dec 2015 20:21:11 -0500 Subject: [PATCH 36/73] update staircase for LotV --- app/views/home/econ_staircase.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/econ_staircase.html b/app/views/home/econ_staircase.html index d2c5d6a..329ab27 100644 --- a/app/views/home/econ_staircase.html +++ b/app/views/home/econ_staircase.html @@ -51,7 +51,7 @@

    See more about TheStaircase and Saturation Speed.

    -

    Games are 1v1 HotS Ladder, vs-AI excluded, from May 8, 2013 to {{ es['now'] | date:'MMM d, y'}}.

    +

    Games are 1v1 LotV Ladder, vs-AI excluded, over the past 180 days.

    Benchmarks are set by calculating the median time for the given matchup and league. The times are then adjusted to the best-fit line from Silver to Masters using a standard least-squares regression. (In the rare case when the best-fit line slopes the wrong way, we use the Masters time for all leagues)

    Stats are updated once per day.

    From 3d5d759e2455f351fa6476741f27aa8a90832cae Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Sun, 10 Jan 2016 21:50:10 -0500 Subject: [PATCH 37/73] put race macro charts back in so JP can see them which will help him debug --- app/views/matches/show.html.erb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 3f54b5e..eb31482 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -261,7 +261,33 @@ completed to when 3x640 = 1920 minerals per minute income is achieved." data-gra bases + + + + {{ entity.identity.name }}'s inject timing ({{ entity.race_macro_pretty() }}%) + + + + + + creep spread + + + + + + {{ entity.identity.name }}'s chronoboosts
    and nexus energy maxouts ({{ entity.race_macro_pretty() }}%) +
    +
    +
    + + + + {{ entity.identity.name }}'s Orbital Command
    usage and energy maxouts ({{ entity.race_macro_pretty() }}%) +
    +
    +
    <% end %> <% if signed_in? %> From 59a0b245f449ae761c44706b0078e60ddddf0633 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Mon, 11 Apr 2016 13:08:35 +0000 Subject: [PATCH 38/73] Run ggtracker in Vagrant. --- Gemfile | 2 +- Gemfile.lock | 12 +++++++++--- README.md | 13 +++++++++++++ Vagrantfile | 13 +++++++++++++ setup-vagrantbox.sh | 12 ++++++++++++ 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Vagrantfile create mode 100644 setup-vagrantbox.sh diff --git a/Gemfile b/Gemfile index f12d598..5c48fed 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'rails', '3.2.22' gem 'mysql2' -gem 'unicorn', '1.1.5' +gem 'unicorn' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index 5869570..cdc043e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,6 +157,7 @@ GEM json (1.8.3) juggernaut (2.1.1) redis + kgio (2.10.0) listen (1.1.6) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) @@ -213,6 +214,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) + raindrops (0.16.0) rake (10.4.2) rb-fsevent (0.9.3) rb-inotify (0.9.2) @@ -282,8 +284,9 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.6) - unicorn (1.1.5) - rack + unicorn (5.1.0) + kgio (~> 2.6) + raindrops (~> 0.7) uuidtools (2.1.4) vegas (0.1.11) rack (>= 1.0.0) @@ -332,4 +335,7 @@ DEPENDENCIES simplecov uglifier (>= 1.0.3) unf_ext (= 0.0.6) - unicorn (= 1.1.5) + unicorn + +BUNDLED WITH + 1.11.2 diff --git a/README.md b/README.md index 0d15bbc..0bb2c08 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,19 @@ The other repos involved in ggtracker are: used by this codebase +### Running with vagrant +You can either run ggtracker in a vagrant-controlled virtualbox or on your host operating system (described after this section). +To run with vagrant run the following commands: + + * Make sure you have vagrant+virtualbox installed on your computer + * Run `vagrant up` to create the virtual box + * Run `vagrant ssh` to ssh into the vagrant box + * Run `ssh-keygen` in the vagrant box to generate ssh-keys for github + * Upload your public keys to Github + * Clone `ggtracker` project to `vagrant` user's home directory in the vagrant box + * Run the installation and updating steps below + * The app will be on the vagrant box's ip instead of localhost. + ### Requirements * Ruby 1.9+ (get RVM: https://rvm.io/) diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..6f65c9d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,13 @@ +Vagrant.configure("2") do |config| + config.vm.box = "ubuntu/trusty64" + config.vm.network :private_network, type: "dhcp" + config.vm.hostname = "ggtracker" + + config.vm.provision "shell", path: "setup-vagrantbox.sh" + + config.vm.provider :virtualbox do |vb| + vb.memory = 1536 + vb.cpus = 2 + vb.name = "ggtracker" + end +end diff --git a/setup-vagrantbox.sh b/setup-vagrantbox.sh new file mode 100644 index 0000000..6b1e38f --- /dev/null +++ b/setup-vagrantbox.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +add-apt-repository ppa:chris-lea/redis-server -y + +apt-get update + +apt-get install -y ruby redis-server nodejs npm mysql-server git-core ruby-dev libcurl4-openssl-dev libmysqlclient-dev build-essential libxml2-dev libxslt-dev + +gem install bundler +npm install -g juggernaut From 7706245151bd92954763723fc4425520adb1af11 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 13 Apr 2016 09:04:45 -0400 Subject: [PATCH 39/73] only do setdocdomain when we have an actual hostname, not just an IP address --- app/assets/javascripts/setdocdomain.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/setdocdomain.js b/app/assets/javascripts/setdocdomain.js index 388db33..e192408 100644 --- a/app/assets/javascripts/setdocdomain.js +++ b/app/assets/javascripts/setdocdomain.js @@ -1,4 +1,8 @@ // Proxino.log("gg.js domain was " + document.domain); // weird, was ggtracker.com even though script was served via CDN -document.domain = /(\w+)(.\w+)?$/.exec(location.hostname)[0]; +if (location.hostname.match(/^[0-9.]*$/) == null) { + // only set document.domain if our location is a hostname like ggtracker.com or + // ggtracker.test. But if it's an IP address, dont bother. + document.domain = /(\w+)(.\w+)?$/.exec(location.hostname)[0]; +} // Proxino.log("now gg.js domain is " + document.domain); From e1417dca01a4bd40db539e6914a24e4976d7a341 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 13 Apr 2016 09:07:42 -0400 Subject: [PATCH 40/73] sc2ranks is long gone --- app/views/players/show.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/players/show.html.erb b/app/views/players/show.html.erb index e3763c8..4948d0f 100644 --- a/app/views/players/show.html.erb +++ b/app/views/players/show.html.erb @@ -11,7 +11,6 @@

    <%= @identity.name %>

    From 9fe1307024f1aed4b177a7bd78271bbbc15db2c2 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 29 Nov 2017 12:17:32 -0500 Subject: [PATCH 63/73] start preventing uploads with a configurable percentage of uploaders --- app/assets/javascripts/gg.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index 28ab5f7..b0e2729 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -381,6 +381,14 @@ uploadLimit = function() { } }; +blockForShutdown = function() { + var shutdownLimit = 1; + if (gg.limits) { + shutdownLimit = gg.limits[3]; + } + return (Math.random() * 100 < shutdownLimit); +} + notifyAboutUploadLimit = _.once(function() { accountDescrip = ["Anonymous", "Free", "Pro"][userLevel()]; ul = uploadLimit(); @@ -397,6 +405,10 @@ notifyAboutUploadLimit = _.once(function() { alert(apology + accountDescrip + " accounts are limited to " + uploadLimit() + " replay" + plural + " per upload. You can upload more any time you want."); }); +notifyAboutGGGReplays = _.once(function() { + alert("Hi, GGTracker is shutting down but you can upload your replays to GGGReplays.com (a GGTracker clone), or to SC2ReplayStats.com or Drop.sc."); +}); + $(function() { fuconfig = { @@ -448,6 +460,8 @@ $(function() { if (uploadScope.allreplays.length >= uploadLimit()) { notifyAboutUploadLimit(); + } else if (blockForShutdown()) { + notifyAboutGGGReplays(); } else { From e29ca4929f1b3afb4021daab181ab392cf7170c6 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 29 Nov 2017 12:25:07 -0500 Subject: [PATCH 64/73] not working perfectly yet --- app/assets/javascripts/gg.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index b0e2729..7b35917 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -459,9 +459,11 @@ $(function() { } if (uploadScope.allreplays.length >= uploadLimit()) { - notifyAboutUploadLimit(); + notifyAboutUploadLimit(); + return false; } else if (blockForShutdown()) { - notifyAboutGGGReplays(); + notifyAboutGGGReplays(); + return false; } else { From 4e234bc6da8bdd426a8469c58f4addb625284ceb Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Mon, 11 Dec 2017 09:51:28 -0500 Subject: [PATCH 65/73] GGGReplays clarification --- app/assets/javascripts/gg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index 7b35917..370bba5 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -406,7 +406,7 @@ notifyAboutUploadLimit = _.once(function() { }); notifyAboutGGGReplays = _.once(function() { - alert("Hi, GGTracker is shutting down but you can upload your replays to GGGReplays.com (a GGTracker clone), or to SC2ReplayStats.com or Drop.sc."); + alert("Hi, GGTracker is shutting down but you can upload your replays to GGGReplays.com (a GGTracker clone; note three Gs in the name), or to SC2ReplayStats.com or Drop.sc."); }); $(function() { From 0f5015b8188f1edd33a16006fc154016ee7ad637 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Mon, 11 Dec 2017 09:51:38 -0500 Subject: [PATCH 66/73] no more uploading or signing up --- app/views/layouts/application.html.erb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6891d21..51424d6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -160,17 +160,10 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_