From 2d8223d6421eb4ad54aa760da52f574e5343344f Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Fri, 13 Nov 2015 11:15:32 -0500 Subject: [PATCH 01/33] 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 3c4cf6ffa5ed7ed242af30146464b1a6ddbaae17 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 17 Nov 2015 10:11:38 -0500 Subject: [PATCH 02/33] 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 7706245151bd92954763723fc4425520adb1af11 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 13 Apr 2016 09:04:45 -0400 Subject: [PATCH 03/33] 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 a3ae4ff35bccddff79d0ff5c7c00f39e3fabca1c Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Sat, 16 Apr 2016 00:14:25 +0200 Subject: [PATCH 04/33] Fix time on lotv army chart. --- .../javascripts/angular/controllers/match.js | 2 +- .../javascripts/angular/directives/armychart.js | 4 ++-- app/assets/javascripts/angular/helpers/sc2.js | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/angular/controllers/match.js b/app/assets/javascripts/angular/controllers/match.js index fbc359a..e3737d2 100644 --- a/app/assets/javascripts/angular/controllers/match.js +++ b/app/assets/javascripts/angular/controllers/match.js @@ -44,7 +44,7 @@ function($scope, $window, $route, $location, $element, Match) { // console.log("matchscope", $scope); $scope.$watch('current_frame', function(v) { if(v) { - $scope.current_time = Sc2.frameToTime(v); + $scope.current_time = Sc2.frameToTime(v, $scope.match.expansion); $scope.time_has_been_set = true } }); diff --git a/app/assets/javascripts/angular/directives/armychart.js b/app/assets/javascripts/angular/directives/armychart.js index ea790bd..fc01823 100644 --- a/app/assets/javascripts/angular/directives/armychart.js +++ b/app/assets/javascripts/angular/directives/armychart.js @@ -115,7 +115,7 @@ gg.directive('armychart', ['$location', '$timeout', function($location, $timeout scope.freeze = function(frame, updateURL) { switch(typeof frame) { case "number": frame = frame; break; - case "string": frame = Sc2.timeToFrame(frame); break; + case "string": frame = Sc2.timeToFrame(frame, scope.match.expansion); break; default: return false; } @@ -162,7 +162,7 @@ gg.directive('armychart', ['$location', '$timeout', function($location, $timeout if(typeof e == "number") { frame = e; } else if(typeof e == "string") { - frame = Sc2.timeToFrame(e); + frame = Sc2.timeToFrame(e, scope.match.expansion); } else { // If clicked on the background, we have xAxis on the event, if clicked // on a series, we'll have the point. diff --git a/app/assets/javascripts/angular/helpers/sc2.js b/app/assets/javascripts/angular/helpers/sc2.js index e9e4233..0a27c9a 100644 --- a/app/assets/javascripts/angular/helpers/sc2.js +++ b/app/assets/javascripts/angular/helpers/sc2.js @@ -258,9 +258,13 @@ for (var expansion_tag in Sc2.armyUnits) { // I'd rather stuff these here, than in Match -Sc2.frameToTime = function(frame) { - minute = Math.floor(frame / (60 * 16)); - second = Math.floor((frame / 16) % 60).toString(); +Sc2.frameToTime = function(frame, expansion) { + fps = 16; + if (expansion >= 2) { + fps *= 1.4; + } + minute = Math.floor(frame / (60 * fps)); + second = Math.floor((frame / fps) % 60).toString(); if (second.length < 2) { second = "0" + second; } @@ -271,7 +275,11 @@ Sc2.timeToFrame = function(time) { parts = time.split(':'); seconds = parseInt(parts[parts.length-1]); minutes = parseInt(parts[parts.length-2]); - frame = ((minutes*60) + seconds) * 16; + fps = 16; + if (expansion >= 2) { + fps *= 1.4; + } + frame = ((minutes*60) + seconds) * fps; return frame; } From fb5cdfd203ae3f1503fcbcfd47e13bb25c8a4089 Mon Sep 17 00:00:00 2001 From: Jonathan Gravel Date: Tue, 12 Apr 2016 16:59:47 -0400 Subject: [PATCH 05/33] Use git protocol rather than ssh for cloning --- Gemfile | 4 ++-- Gemfile.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index ee01535..6e8ae15 100644 --- a/Gemfile +++ b/Gemfile @@ -75,7 +75,7 @@ gem 'compass-rails', :git => 'git://github.com/Compass/compass-rails.git' # GG! # Don't commit the :path! -gem 'gg', :git => 'git@github.com:dsjoerg/gg.git', :ref => 'b58ed5e12c2d201b368980e74090987d2050f321' +gem 'gg', :git => 'git://github.com/dsjoerg/gg.git', :ref => 'b58ed5e12c2d201b368980e74090987d2050f321' # gem 'gg', :path => '/Users/mr/dev/ruby/gems/gg' #gem 'gg', :path => '/Users/david/Dropbox/Programming/gg' @@ -107,7 +107,7 @@ gem 'gon' # create our own (it's a simple Nokogiri based scraper..) # Forked it and added portraits to profile scraping -gem 'bnet_scraper', :git => 'git@github.com:ggtracker/bnet_scraper.git', :ref => 'battlenetify' +gem 'bnet_scraper', :git => 'git://github.com/ggtracker/bnet_scraper.git', :ref => 'battlenetify' #gem 'bnet_scraper', :path => '/Users/david/Dropbox/Programming/bnet_scraper/' diff --git a/Gemfile.lock b/Gemfile.lock index 31759a0..410f5bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,15 +16,7 @@ GIT sass (~> 3.3.0.rc.1) GIT - remote: git://github.com/thedarkone/rails-dev-boost.git - revision: 1e0cc0e1a3f6e51820b908d7de1f3e160ec2af0d - specs: - rails-dev-boost (0.2.1) - listen (>= 0.5) - railties (>= 3.0) - -GIT - remote: git@github.com:dsjoerg/gg.git + remote: git://github.com/dsjoerg/gg.git revision: b58ed5e12c2d201b368980e74090987d2050f321 ref: b58ed5e12c2d201b368980e74090987d2050f321 specs: @@ -35,7 +27,7 @@ GIT yajl-ruby GIT - remote: git@github.com:ggtracker/bnet_scraper.git + remote: git://github.com/ggtracker/bnet_scraper.git revision: 624e28dddbdbafba9fc5a48693ef1aa86ae8ca9f ref: battlenetify specs: @@ -43,6 +35,14 @@ GIT faraday nokogiri +GIT + remote: git://github.com/thedarkone/rails-dev-boost.git + revision: 1e0cc0e1a3f6e51820b908d7de1f3e160ec2af0d + specs: + rails-dev-boost (0.2.1) + listen (>= 0.5) + railties (>= 3.0) + GEM remote: https://rubygems.org/ specs: From f86d0d6a2a7c768ba1bab7b66f1b50b3a94a829b Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Sun, 17 Apr 2016 15:01:59 -0400 Subject: [PATCH 06/33] fix time handling for the below-charts that come from periodic tracker events --- app/assets/javascripts/angular/helpers/sc2.js | 19 ++++++++++++++----- .../javascripts/angular/resources/match.js | 6 +++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/angular/helpers/sc2.js b/app/assets/javascripts/angular/helpers/sc2.js index e9e4233..dcc36bd 100644 --- a/app/assets/javascripts/angular/helpers/sc2.js +++ b/app/assets/javascripts/angular/helpers/sc2.js @@ -256,11 +256,15 @@ for (var expansion_tag in Sc2.armyUnits) { } } -// I'd rather stuff these here, than in Match +Sc2.LOTV_SPEEDUP = 1.4; -Sc2.frameToTime = function(frame) { - minute = Math.floor(frame / (60 * 16)); - second = Math.floor((frame / 16) % 60).toString(); +Sc2.frameToTime = function(frame, expansion) { + fps = 16; + if (expansion >= 2) { + fps *= Sc2.LOTV_SPEEDUP; + } + minute = Math.floor(frame / (60 * fps)); + second = Math.floor((frame / fps) % 60).toString(); if (second.length < 2) { second = "0" + second; } @@ -271,7 +275,11 @@ Sc2.timeToFrame = function(time) { parts = time.split(':'); seconds = parseInt(parts[parts.length-1]); minutes = parseInt(parts[parts.length-2]); - frame = ((minutes*60) + seconds) * 16; + fps = 16; + if (expansion >= 2) { + fps *= Sc2.LOTV_SPEEDUP; + } + frame = ((minutes*60) + seconds) * fps; return frame; } @@ -282,3 +290,4 @@ Sc2.armyInfo = function(expansion_tag, unitname, infonum) { Sc2.isArmyUnit = function(unitname) { return (unitname in Sc2.armyUnits['LotV']); } + diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js index 7a795d1..3826be5 100644 --- a/app/assets/javascripts/angular/resources/match.js +++ b/app/assets/javascripts/angular/resources/match.js @@ -568,10 +568,14 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc statx = function(statarray) { result = []; + seconds_between_stat_updates = 10.0; + if (this.expansion_tag == 'LotV') { + seconds_between_stat_updates /= Sc2.LOTV_SPEEDUP; + } now_seconds = 0; _.each(statarray, function(stat) { result.push([now_seconds / 60.0, stat]); - now_seconds = now_seconds + 10.0; + now_seconds = now_seconds + seconds_between_stat_updates; }); // console.log("statarray", result); return result; From 43df33edcc7eaf4c50f98871a02dbc251ba19fc9 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 19 Apr 2016 09:30:22 -0400 Subject: [PATCH 07/33] update descrip of econ stats --- 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 25d1704f2c435dc3486de55174ce917cd6b12878 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Wed, 20 Apr 2016 13:44:07 +0200 Subject: [PATCH 08/33] Fix engagements on stat charts. --- app/assets/javascripts/angular/directives/chart.js | 8 ++++++-- .../javascripts/angular/directives/macrochart.js | 11 ++++++++--- .../javascripts/angular/directives/protosschart.js | 13 +++++++++---- .../javascripts/angular/directives/terranchart.js | 13 +++++++++---- app/assets/javascripts/angular/resources/match.js | 6 +++++- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/angular/directives/chart.js b/app/assets/javascripts/angular/directives/chart.js index 2fdcec4..c644839 100644 --- a/app/assets/javascripts/angular/directives/chart.js +++ b/app/assets/javascripts/angular/directives/chart.js @@ -125,11 +125,15 @@ gg.directive('chart', ['$compile', function($compile) { if (scope.$parent.match.engagements) { options.xAxis.plotBands = []; + speed_multiplier = 1; + if (scope.$parent.match.expansion_tag == 'LotV') { + speed_multiplier = 1.4; + } _.each(scope.$parent.match.engagements, function(engagement) { options.xAxis.plotBands.push({ color: 'rgba(150, 50, 50, 0.10)', - from: engagement[0] / 960.0, - to: engagement[1] / 960.0, + from: engagement[0] / 960.0 / speed_multiplier, + to: engagement[1] / 960.0 / speed_multiplier, zIndex: 10 }); }); diff --git a/app/assets/javascripts/angular/directives/macrochart.js b/app/assets/javascripts/angular/directives/macrochart.js index a4168f8..bd87cb0 100644 --- a/app/assets/javascripts/angular/directives/macrochart.js +++ b/app/assets/javascripts/angular/directives/macrochart.js @@ -73,13 +73,18 @@ gg.directive('macrochart', [function() { }; + speed_multiplier = 1; + if (scope.$parent.match.expansion_tag == 'LotV') { + speed_multiplier = 1.4; + } + if (scope.$parent.match.engagements) { options.yAxis.plotBands = []; _.each(scope.$parent.match.engagements, function(engagement) { options.yAxis.plotBands.push({ color: 'rgba(150, 50, 50, 0.1)', - from: engagement[0] / 960.0, - to: engagement[1] / 960.0, + from: engagement[0] / 960.0 / speed_multiplier, + to: engagement[1] / 960.0 / speed_multiplier, zIndex: 10 }); }); @@ -105,7 +110,7 @@ gg.directive('macrochart', [function() { for (i=0; i Date: Wed, 20 Apr 2016 15:59:54 +0200 Subject: [PATCH 09/33] Use speedup constant instead of raw values so it can be changed later. --- app/assets/javascripts/angular/directives/chart.js | 2 +- app/assets/javascripts/angular/directives/macrochart.js | 2 +- app/assets/javascripts/angular/directives/protosschart.js | 2 +- app/assets/javascripts/angular/directives/terranchart.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/angular/directives/chart.js b/app/assets/javascripts/angular/directives/chart.js index c644839..20b1f16 100644 --- a/app/assets/javascripts/angular/directives/chart.js +++ b/app/assets/javascripts/angular/directives/chart.js @@ -127,7 +127,7 @@ gg.directive('chart', ['$compile', function($compile) { options.xAxis.plotBands = []; speed_multiplier = 1; if (scope.$parent.match.expansion_tag == 'LotV') { - speed_multiplier = 1.4; + speed_multiplier = Sc2.LOTV_SPEEDUP; } _.each(scope.$parent.match.engagements, function(engagement) { options.xAxis.plotBands.push({ diff --git a/app/assets/javascripts/angular/directives/macrochart.js b/app/assets/javascripts/angular/directives/macrochart.js index bd87cb0..3e4397c 100644 --- a/app/assets/javascripts/angular/directives/macrochart.js +++ b/app/assets/javascripts/angular/directives/macrochart.js @@ -75,7 +75,7 @@ gg.directive('macrochart', [function() { speed_multiplier = 1; if (scope.$parent.match.expansion_tag == 'LotV') { - speed_multiplier = 1.4; + speed_multiplier = Sc2.LOTV_SPEEDUP; } if (scope.$parent.match.engagements) { diff --git a/app/assets/javascripts/angular/directives/protosschart.js b/app/assets/javascripts/angular/directives/protosschart.js index 2dccafa..4f47e8b 100644 --- a/app/assets/javascripts/angular/directives/protosschart.js +++ b/app/assets/javascripts/angular/directives/protosschart.js @@ -76,7 +76,7 @@ gg.directive('protosschart', [function() { speed_multiplier = 1; if (scope.$parent.match.expansion_tag == 'LotV') { - speed_multiplier = 1.4; + speed_multiplier = Sc2.LOTV_SPEEDUP; } nametoshow = scope.$parent.entity.identity.name; diff --git a/app/assets/javascripts/angular/directives/terranchart.js b/app/assets/javascripts/angular/directives/terranchart.js index 1417569..e08b61e 100644 --- a/app/assets/javascripts/angular/directives/terranchart.js +++ b/app/assets/javascripts/angular/directives/terranchart.js @@ -76,7 +76,7 @@ gg.directive('terranchart', [function() { speed_multiplier = 1; if (scope.$parent.match.expansion_tag == 'LotV') { - speed_multiplier = 1.4; + speed_multiplier = Sc2.LOTV_SPEEDUP; } nametoshow = scope.$parent.entity.identity.name; From 29995cb9bb8ec0543d982dcfa1b22125b4383d42 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Wed, 20 Apr 2016 16:10:19 +0200 Subject: [PATCH 10/33] Also fix minimap engagements. --- app/assets/javascripts/angular/directives/matchmap.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/directives/matchmap.js b/app/assets/javascripts/angular/directives/matchmap.js index 2dac1c1..05b4c87 100644 --- a/app/assets/javascripts/angular/directives/matchmap.js +++ b/app/assets/javascripts/angular/directives/matchmap.js @@ -44,7 +44,12 @@ gg.directive('matchmap', [function() { scope.context.lineWidth = 2; - nowIndex = Math.floor(999.0 * v / (scope.match.duration_seconds * 16)); + speed_multiplier = 1; + if (scope.$parent.match.expansion_tag == 'LotV') { + speed_multiplier = Sc2.LOTV_SPEEDUP; + } + + nowIndex = Math.floor(999.0 * v / (scope.match.duration_seconds * 16 * speed_multiplier)); if (!scope.match.camera) return; cameraInfo = scope.match.camera[0]; if (scope.match.locations) From 67aba1c4a2cffaf44e9c9675578b1046d5c5b3cf Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 20 Apr 2016 12:16:04 -0400 Subject: [PATCH 11/33] add link to ggtrackerstack, and acknowledge @anickelsen and @gravelweb --- app/views/home/developers.html | 2 +- app/views/home/faq.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/home/developers.html b/app/views/home/developers.html index f919cc8..c7abd02 100644 --- a/app/views/home/developers.html +++ b/app/views/home/developers.html @@ -9,7 +9,7 @@

    Hello fellow developer!

    -

    Source code is available. Contributions welcome.

    +

    Source code is available. Contributions welcome.

    Also there is an API.

    diff --git a/app/views/home/faq.html b/app/views/home/faq.html index 49ce775..f6bb65e 100644 --- a/app/views/home/faq.html +++ b/app/views/home/faq.html @@ -51,6 +51,7 @@

    Frequently Asked Questions

  • Bernat Fortet design
  • Marian Rudzynski developer and mad scientist
  • AndrĂ¡s Belicza created the auto-uploader and the incredible sc2gears
  • +
  • Anders Nickelsen built ggtrackerstack and initiated active development for the LotV era, with additional contributions from Jonathan Gravel (@gravelweb on github)
  • Doug Copestake built the SC2Gears auto-uploader plugin
  • Jonathan Chung built the creep spread calculations
  • Leafs apologist William "Grandmaster Wannabee" Lang
  • From be09707389df9bf685fff87d239fc4e60391e2a2 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Thu, 21 Apr 2016 21:22:14 +0200 Subject: [PATCH 12/33] Rescale APM series to show it correctly in LotV replays. --- .../javascripts/angular/resources/match.js | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js index c9b8ba2..540383e 100644 --- a/app/assets/javascripts/angular/resources/match.js +++ b/app/assets/javascripts/angular/resources/match.js @@ -570,6 +570,30 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc return _.zip(_bases_x_minutes, _series_y); }; + // Rescale series to a point per game minute + statxminutes = function(statarray) { + // Don't rescale the series if it is all zeros, since it will show up even as zero when rescaled + var sum = 0; + $.each(statarray, function(){ + sum += this + }); + if (sum == 0) { + return statarray; + } + + result = []; + seconds_between_stat_updates = 60.0 + if (this.expansion_tag == 'LotV') { + seconds_between_stat_updates /= Sc2.LOTV_SPEEDUP; + } + now_seconds = seconds_between_stat_updates; + _.each(statarray, function(stat) { + result.push([now_seconds / 60.0, stat]); + now_seconds = now_seconds + seconds_between_stat_updates; + }); + return result; + } + statx = function(statarray) { result = []; seconds_between_stat_updates = 10.0; @@ -630,9 +654,9 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc } if(entity.data) { - this._series.apm.entities[_entity] = $.extend({data: entity.data.apm, pointStart: 1}, base_series); - this._series.wpm.entities[_entity] = $.extend({data: entity.data.wpm, pointStart: 1}, base_series); - this._series.creep_spread.entities[_entity] = $.extend({data: entity.data.creep_spread, pointStart: 1}, base_series); + this._series.apm.entities[_entity] = $.extend({data: statxminutes(entity.data.apm), pointStart: 1}, base_series); + this._series.wpm.entities[_entity] = $.extend({data: statxminutes(entity.data.wpm), pointStart: 1}, base_series); + this._series.creep_spread.entities[_entity] = $.extend({data: statxminutes(entity.data.creep_spread), pointStart: 1}, base_series); } if (this.num_bases) { From 98172d84348e607e756e3c77595bbeaf5fd14303 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Thu, 28 Apr 2016 14:11:04 -0400 Subject: [PATCH 13/33] update copyright --- app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4b43993..f7feb85 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -214,7 +214,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
      -
    • © 2012-2014 GGTracker
    • +
    • © 2012-2016 GGTracker
    • Powered by sc2reader
    • Made in NYC
    • Terms of Use
    • From e81860a887dfe814b0d24ab540291dae47eb58fc Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Fri, 20 May 2016 09:49:02 -0400 Subject: [PATCH 14/33] log more error info about S3 problems, trying to diagnose the sporadic problem where match pages are missing most of the needed info --- app/controllers/matches_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 3833be7..4fc6db9 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -8,6 +8,10 @@ def show begin blob_response = Curl.get(blob_url) rescue Exception => e + Rails.logger.error "YO EXCEPTION WHILE HITTING S3" + Rails.logger.error e.message + st = e.backtrace.join("\n") + Rails.logger.error st # sometimes there are random problems retrieving from S3. we # dont need to hear about each one. # TODO complain if there are too many consecutive failures @@ -49,8 +53,8 @@ def show gon.match = @match.to_hash if blob_response && blob_response.status[0] == '2' gon.matchblob = blob_response.body_str -# else -# Rails.logger.warn("Got blob response status #{blob_response.status} for match #{@match.id}") + else + Rails.logger.warn("Got blob response status #{blob_response.status} for match #{@match.id}") end end From 2ed5b95ab30e6e85c00ba17f1e6355ef17c08776 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Thu, 6 Oct 2016 17:37:13 +0200 Subject: [PATCH 15/33] Update saturation benchmarks for LotV. --- app/views/home/econ_staircase.html | 12 ++++++------ app/views/home/economy_stats.html | 12 ++++++------ app/views/home/economy_stats2.html | 12 ++++++------ app/views/home/saturation_speed.html | 6 +++--- app/views/matches/show.html.erb | 14 +++++++------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/views/home/econ_staircase.html b/app/views/home/econ_staircase.html index 329ab27..317ae81 100644 --- a/app/views/home/econ_staircase.html +++ b/app/views/home/econ_staircase.html @@ -22,13 +22,13 @@ Saturation Speed - - 1 Base Mineral Income (640){{ es[league + key + '_mineral_saturation_1'][metric()] | minutes_seconds }} + + 1 Base Mineral Income (870){{ es[league + key + '_mineral_saturation_1'][metric()] | minutes_seconds }} - Time from 2nd Base Complete to 2 Base Mineral Income (1280) +completed, to when 2x870 = 1740 minerals per minute income is achieved." data-gravity="s"> + Time from 2nd Base Complete to 2 Base Mineral Income (1740) {{ es[league + key + '_mdelta2'][metric()] | minutes_seconds }} @@ -36,8 +36,8 @@ - Time from 3rd Base Complete to 3 Base Mineral Income (1920) +completed to when 3x870 = 2610 minerals per minute income is achieved." data-gravity="s"> + Time from 3rd Base Complete to 3 Base Mineral Income (2610) {{ es[league + key + '_mdelta3'][metric()] | minutes_seconds }} diff --git a/app/views/home/economy_stats.html b/app/views/home/economy_stats.html index 62098c2..61560ab 100644 --- a/app/views/home/economy_stats.html +++ b/app/views/home/economy_stats.html @@ -38,13 +38,13 @@ {{ es[key][league].miningbase_3 | minutes_seconds}} Saturation Speed - - 1 Base Mineral Income (640){{ es[key][league].mineral_saturation_1 | minutes_seconds }} + + 1 Base Mineral Income (870){{ es[key][league].mineral_saturation_1 | minutes_seconds }} - Time from 2nd Base Complete to 2 Base Mineral Income (1280) +completed, to when 2x870 = 1740 minerals per minute income is achieved." data-gravity="s"> + Time from 2nd Base Complete to 2 Base Mineral Income (1740) {{ es[key][league].mdelta2 | minutes_seconds }} @@ -52,8 +52,8 @@ - Time from 3rd Base Complete to 3 Base Mineral Income (1920) +completed to when 3x870 = 2610 minerals per minute income is achieved." data-gravity="s"> + Time from 3rd Base Complete to 3 Base Mineral Income (2610) {{ es[key][league].mdelta3 | minutes_seconds }} diff --git a/app/views/home/economy_stats2.html b/app/views/home/economy_stats2.html index 05e6657..2a95679 100644 --- a/app/views/home/economy_stats2.html +++ b/app/views/home/economy_stats2.html @@ -37,13 +37,13 @@ {{ es[matchup][league].miningbase_3 | minutes_seconds}} Saturation Speed - - 1 Base Mineral Income (640){{ es[matchup][league].mineral_saturation_1 | minutes_seconds }} + + 1 Base Mineral Income (870){{ es[matchup][league].mineral_saturation_1 | minutes_seconds }} - Time from 2nd Base Complete to 2 Base Mineral Income (1280) +completed, to when 2x870 = 1740 minerals per minute income is achieved." data-gravity="s"> + Time from 2nd Base Complete to 2 Base Mineral Income (1740) {{ es[matchup][league].mdelta2 | minutes_seconds }} @@ -51,8 +51,8 @@ - Time from 3rd Base Complete to 3 Base Mineral Income (1920) +completed to when 3x870 = 2610 minerals per minute income is achieved." data-gravity="s"> + Time from 3rd Base Complete to 3 Base Mineral Income (2610) {{ es[matchup][league].mdelta3 | minutes_seconds }} diff --git a/app/views/home/saturation_speed.html b/app/views/home/saturation_speed.html index be4654c..b71995d 100644 --- a/app/views/home/saturation_speed.html +++ b/app/views/home/saturation_speed.html @@ -8,9 +8,9 @@

      What is Saturation Speed?

      Saturation Speed measures how quickly you can ramp up your economy. Higher-league players tend to be faster than lower-league players. Although there are strategic reasons in particular games why you might delay your economy, on average higher-league players do get their economy up faster. You can use Saturation Speed to keep tabs on the economic side of your game.

      -

      Your 1st Base Saturation Speed measures how quickly you can get to 640 mineral income. That's the income you get from 16 workers mining minerals. After the 16th worker, any additional workers do not mine as quickly.

      -

      Your 2nd Base Saturation Speed measures how quickly you can go from having your 2nd base complete, and in mining position, to having 1280 (2x640) mineral income.

      -

      Your 3rd Base Saturation Speed measures how quickly you can go from having your 3rd base complete, and in mining position, to having 1920 (3x640) mineral income.

      +

      Your 1st Base Saturation Speed measures how quickly you can get to 870 mineral income. That's the income you get from 16 workers mining minerals. After the 16th worker, any additional workers do not mine as quickly.

      +

      Your 2nd Base Saturation Speed measures how quickly you can go from having your 2nd base complete, and in mining position, to having 1740 (2x870) mineral income.

      +

      Your 3rd Base Saturation Speed measures how quickly you can go from having your 3rd base complete, and in mining position, to having 2610 (3x870) mineral income.


      How Can I See My Saturation Speed?

      On any match page, click on the Economy button:

      diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 8024f89..2856fe6 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -177,8 +177,8 @@ - - 1 Base Mineral Income (640) + + 1 Base Mineral Income (870) {{ entity.stats.mineral_saturation_1 | minutes_seconds }} @@ -187,8 +187,8 @@ - Time from 2nd Base Complete to 2 Base Mineral Income (1280) +completed, to when 2x870 = 1760 minerals per minute income is achieved." data-gravity="s"> + Time from 2nd Base Complete to 2 Base Mineral Income (1760) {{ entity.mdelta2() | minutes_seconds }} @@ -197,8 +197,8 @@ completed, to when 2x640 = 1280 minerals per minute income is achieved." data-gr - Time from 3rd Base Complete to 3 Base Mineral Income (1920) +completed to when 3x870 = 2610 minerals per minute income is achieved." data-gravity="s"> + Time from 3rd Base Complete to 3 Base Mineral Income (2610) {{ entity.mdelta3() | minutes_seconds }} @@ -258,7 +258,7 @@ completed to when 3x640 = 1920 minerals per minute income is achieved." data-gra <% if @match.replays_count > 0 %> - bases + bases From 5d80f0cc454ebc2b187b1f0ed86c50f2c4fe7e1f Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Fri, 7 Oct 2016 07:20:03 +0200 Subject: [PATCH 16/33] Adjust resource collection rates and graphs for LotV game speed. --- .../javascripts/angular/resources/match.js | 16 +++++++++++++--- app/views/matches/show.html.erb | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js index 540383e..3081285 100644 --- a/app/assets/javascripts/angular/resources/match.js +++ b/app/assets/javascripts/angular/resources/match.js @@ -622,6 +622,11 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc is_team: false } + speed_multiplier = 1 + if (this.expansion_tag == 'LotV') { + speed_multiplier = Sc2.LOTV_SPEEDUP + } + // Income and army graphs from summary // Graph data is already prepared currently, so we just have to add it if(entity.summary) { @@ -633,11 +638,16 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc if (entity.summary.upgradespendinggraph) { this._series.summary_upgradespending.entities[_entity] = $.extend({data: entity.summary.upgradespendinggraph}, base_series); } + + entity.summary.resource_collection_rate_adjusted = Math.round(entity.summary.resource_collection_rate*speed_multiplier) } - if(this.MineralsCurrent) { - this._series.replayincome.entities[_entity] = $.extend({data: statx(this.MineralsCollectionRate[entity.identity.id])}, base_series); - this._series.replaygasincome.entities[_entity] = $.extend({data: statx(this.VespeneCollectionRate[entity.identity.id])}, base_series); + if(this.MineralsCurrent && this.MineralsCurrent[entity.identity.id]) { + function getResourceCollectionRate(x) { + return x*speed_multiplier + } + this._series.replayincome.entities[_entity] = $.extend({data: statx(this.MineralsCollectionRate[entity.identity.id].map(getResourceCollectionRate))}, base_series); + this._series.replaygasincome.entities[_entity] = $.extend({data: statx(this.VespeneCollectionRate[entity.identity.id].map(getResourceCollectionRate))}, base_series); this._series.replaylost.entities[_entity] = $.extend({data: statx(this.Lost[entity.identity.id])}, base_series); this._series.replayminerals.entities[_entity] = $.extend({data: statx(this.MineralsCurrent[entity.identity.id])}, base_series); this._series.replaygas.entities[_entity] = $.extend({data: statx(this.VespeneCurrent[entity.identity.id])}, base_series); diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 2856fe6..343be75 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -137,7 +137,7 @@ {{ entity.summary.workers_created }} {{ entity.summary.structures_built }} - {{ entity.summary.resource_collection_rate }} + {{ entity.summary.resource_collection_rate_adjusted }} {{ entity.summary.average_unspent_resources }} {{ entity.summary.units_trained }} From ba79405ec24783245d63ec021d82478fd879f5d7 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Fri, 14 Oct 2016 07:11:32 +0200 Subject: [PATCH 17/33] Display base completion and saturation times on LotV time-scale. --- .../javascripts/angular/resources/match.js | 28 +++++++++++++++---- app/views/matches/show.html.erb | 6 ++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js index 3081285..bfa5047 100644 --- a/app/assets/javascripts/angular/resources/match.js +++ b/app/assets/javascripts/angular/resources/match.js @@ -103,20 +103,20 @@ Entity.prototype.race_macro_pretty = function() { Entity.prototype.mdelta2 = function() { if (this.stats == null || - this.stats.mineral_saturation_2 == null || - this.stats.miningbase_2 == null) { + this.stats.mineral_saturation_2_adjusted == null || + this.stats.miningbase_2_adjusted == null) { return null; } - return Math.max(0, this.stats.mineral_saturation_2 - this.stats.miningbase_2); + return Math.max(0, this.stats.mineral_saturation_2_adjusted - this.stats.miningbase_2_adjusted); } Entity.prototype.mdelta3 = function() { if (this.stats == null || - this.stats.mineral_saturation_3 == null || - this.stats.miningbase_3 == null) { + this.stats.mineral_saturation_3_adjusted == null || + this.stats.miningbase_3_adjusted == null) { return null; } - return Math.max(0, this.stats.mineral_saturation_3 - this.stats.miningbase_3); + return Math.max(0, this.stats.mineral_saturation_3_adjusted - this.stats.miningbase_3_adjusted); } Entity.prototype.color_style = function() { @@ -640,6 +640,22 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc } entity.summary.resource_collection_rate_adjusted = Math.round(entity.summary.resource_collection_rate*speed_multiplier) + if (entity.stats.mineral_saturation_1 != null) { + entity.stats.mineral_saturation_1_adjusted = Math.round(entity.stats.mineral_saturation_1/speed_multiplier) + } + if (entity.stats.mineral_saturation_2 != null) { + entity.stats.mineral_saturation_2_adjusted = Math.round(entity.stats.mineral_saturation_2/speed_multiplier) + } + if (entity.stats.mineral_saturation_3 != null) { + entity.stats.mineral_saturation_3_adjusted = Math.round(entity.stats.mineral_saturation_3/speed_multiplier) + } + + if (entity.stats.miningbase_2 != null) { + entity.stats.miningbase_2_adjusted = Math.round(entity.stats.miningbase_2/speed_multiplier) + } + if (entity.stats.miningbase_3 != null) { + entity.stats.miningbase_3_adjusted = Math.round(entity.stats.miningbase_3/speed_multiplier) + } } if(this.MineralsCurrent && this.MineralsCurrent[entity.identity.id]) { diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 343be75..8af259a 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -164,12 +164,12 @@ 2nd Mining Base Complete - {{ entity.stats.miningbase_2 | minutes_seconds }} + {{ entity.stats.miningbase_2_adjusted | minutes_seconds }} 3rd Mining Base Complete - {{ entity.stats.miningbase_3 | minutes_seconds}} + {{ entity.stats.miningbase_3_adjusted | minutes_seconds}} Saturation Speed {{ entity.identity.name }} @@ -181,7 +181,7 @@ 1 Base Mineral Income (870) - {{ entity.stats.mineral_saturation_1 | minutes_seconds }} + {{ entity.stats.mineral_saturation_1_adjusted | minutes_seconds }} From daa00e5a542b6413eda857351cd6dd8b2dfbde8b Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 28 Feb 2017 17:03:08 -0500 Subject: [PATCH 18/33] adjust LotV time multiplier to 1.36 to be consistent with ggpyjobs --- app/assets/javascripts/angular/helpers/sc2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/helpers/sc2.js b/app/assets/javascripts/angular/helpers/sc2.js index 7e96edb..9955c33 100644 --- a/app/assets/javascripts/angular/helpers/sc2.js +++ b/app/assets/javascripts/angular/helpers/sc2.js @@ -256,7 +256,7 @@ for (var expansion_tag in Sc2.armyUnits) { } } -Sc2.LOTV_SPEEDUP = 1.4; +Sc2.LOTV_SPEEDUP = 1.36; Sc2.frameToTime = function(frame, expansion) { fps = 16; From 1aa622d99593022b8a427befa9d814d73c6e4a90 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Tue, 28 Feb 2017 17:03:38 -0500 Subject: [PATCH 19/33] adjust LotV time multiplier to 1.36 to be consistent with ggpyjobs --- app/assets/javascripts/angular/helpers/sc2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/helpers/sc2.js b/app/assets/javascripts/angular/helpers/sc2.js index 7e96edb..9955c33 100644 --- a/app/assets/javascripts/angular/helpers/sc2.js +++ b/app/assets/javascripts/angular/helpers/sc2.js @@ -256,7 +256,7 @@ for (var expansion_tag in Sc2.armyUnits) { } } -Sc2.LOTV_SPEEDUP = 1.4; +Sc2.LOTV_SPEEDUP = 1.36; Sc2.frameToTime = function(frame, expansion) { fps = 16; From cbe0ca49444b0d883d3a8ff2b826b7d0418aa499 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Sat, 29 Jul 2017 12:16:18 -0400 Subject: [PATCH 20/33] implement recaptcha. its ugly as hell but it works and this way we can keep emailing --- Gemfile | 1 + Gemfile.lock | 14 +++++++++++++- app/controllers/users_controller.rb | 10 ++++++++++ app/views/devise/registrations/new.html.erb | 18 +++++++++++++++++- config/initializers/recaptcha.rb | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 config/initializers/recaptcha.rb diff --git a/Gemfile b/Gemfile index 6e8ae15..16ef52b 100644 --- a/Gemfile +++ b/Gemfile @@ -147,3 +147,4 @@ gem 'rack-attack' gem 'unf_ext', '0.0.6' gem 'foreman' +gem "recaptcha", :git => 'git://github.com/brendon/recaptcha.git', :ref => 'remove-ruby-restriction', require: "recaptcha/rails" diff --git a/Gemfile.lock b/Gemfile.lock index 410f5bc..cfd390e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,14 @@ GIT compass-rails (2.0.alpha.0) compass (>= 0.12.2, < 0.14) +GIT + remote: git://github.com/brendon/recaptcha.git + revision: 21473e536b93c0237ec02edcc78cf4f7a547a221 + ref: remove-ruby-restriction + specs: + recaptcha (1.3.0) + json + GIT remote: git://github.com/chriseppstein/compass.git revision: 0a74e91931e53fb798323cd8684198c38a2b76b8 @@ -331,6 +339,7 @@ DEPENDENCIES rack-attack rails (= 3.2.22) rails-dev-boost! + recaptcha! resque rspec rspec-rails @@ -340,5 +349,8 @@ DEPENDENCIES unf_ext (= 0.0.6) unicorn +RUBY VERSION + ruby 1.9.3p484 + BUNDLED WITH - 1.11.2 + 1.15.3 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fa9844b..e8b2b46 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,6 @@ class UsersController < Devise::RegistrationsController before_filter :authenticate_user!, :except => [:auth] + prepend_before_filter :check_captcha, only: [:create] # Change this to be any actions you want to protect. respond_to :html, :json, :xml # Overriding devise helpers @@ -38,4 +39,13 @@ def update current_user.update_attributes(params[:user]) render :text => "OK" end + + private + def check_captcha + unless verify_recaptcha + self.resource = resource_class.new sign_up_params + respond_with_navigational(resource) { render :new } + else + end + end end diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 66879f5..a68de3c 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1 +1,17 @@ -<%= render 'devise/aio' %> \ No newline at end of file +

      Sign up

      + +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + <%= flash[:recaptcha_error] %> + +
      <%= f.label :email %>
      + <%= f.email_field :email, :autofocus => true %>
      + +
      <%= f.label :password %>
      + <%= f.password_field :password %>
      + +
      + <%= recaptcha_tags(stoken: false, ajax: true) %> +
      +
      <%= f.submit "Sign up" %>
      +<% end %> diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb new file mode 100644 index 0000000..35132d2 --- /dev/null +++ b/config/initializers/recaptcha.rb @@ -0,0 +1,4 @@ +Recaptcha.configure do |config| + config.public_key = '6Lcg3SkUAAAAAO4yYqDriPdh-er7islVavz1m-X2' + config.private_key = '6Lcg3SkUAAAAAEKwJT0Xy-U8XRC8_Qhc1w6FlZRv' +end From 5b2b1b6b12b527128beb06a446f76e4bd4be135a Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Sat, 29 Jul 2017 12:36:33 -0400 Subject: [PATCH 21/33] dont expose secret key for recaptcha --- config/initializers/recaptcha.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb index 35132d2..62e06e9 100644 --- a/config/initializers/recaptcha.rb +++ b/config/initializers/recaptcha.rb @@ -1,4 +1,4 @@ Recaptcha.configure do |config| - config.public_key = '6Lcg3SkUAAAAAO4yYqDriPdh-er7islVavz1m-X2' - config.private_key = '6Lcg3SkUAAAAAEKwJT0Xy-U8XRC8_Qhc1w6FlZRv' + config.public_key = '6Lc35yoUAAAAACUODLMbUxj4pC7NfUt5s-i76Z7D' + config.private_key = Rails.application.secret('recaptcha_secret') end From 1d730a07eb37a315251242a3ffc2ebb5be3f38f2 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Fri, 27 Oct 2017 13:31:49 -0400 Subject: [PATCH 22/33] remove go_pro --- app/views/layouts/application.html.erb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f7feb85..6891d21 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -149,11 +149,7 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_
    • Scelight
    - <% if signed_in? && !current_user.pro? %> -
  • go pro
  • - <% else %> -
  • tour
  • - <% end %> +
  • tour
  • From 9fe1307024f1aed4b177a7bd78271bbbc15db2c2 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Wed, 29 Nov 2017 12:17:32 -0500 Subject: [PATCH 23/33] 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 24/33] 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 25/33] 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 26/33] 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_
    - - <% if !controller.is_a?(HomeController) %> From 85d3e264c6cd0da6ccd1208c42616404812a120c Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Thu, 15 Mar 2018 14:05:40 -0400 Subject: [PATCH 31/33] try and more directly tell people about GGGReplays --- app/assets/javascripts/gg.js | 145 +---------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index 370bba5..9ebae92 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -411,150 +411,7 @@ notifyAboutGGGReplays = _.once(function() { $(function() { - fuconfig = { - url: 'https://' + gon.global.replays_bucket + '.s3.amazonaws.com', - type: 'POST', - autoUpload: true, - dataType: 'xml', - add: function(e, data) { -// console.log("add!", data.files.length); - - if (gg.state.iecompat) { - alert("Our apologies, but this browser can't upload replays to GGTracker. To upload replays, you can use Internet Explorer 10, Google Chrome, Firefox or Safari."); - return false; - } - - uploadScope = angular.element($('.uploads')).scope(); - - if (_.isUndefined(rootScope.creplays) || rootScope.creplays.length == 0) { - // creplays are the replays that are still being uploaded/processed. - // allreplays has all of the replays that were uploaded for this upload, regardless of their state - uploadScope.creplays = [] - uploadScope.allreplays = [] - // console.log("clearing arrays!"); - - $('#uploads') - .dialog({ - modal: true, - draggable: false, - resizable: false, - dialogClass: 'dialog-uploads', - width: 'auto', - position: { my: 'top', at: 'top+75' }, - collision: 'none', - show: 'slide' - }). - addClass('uploads-expanded'); - - $(window).bind('beforeunload', function () { - // console.log("beforeunload!", $('.button-upload input'), $('.button-upload input').data('fileupload'), uploadScope); - // return 'Foo!'; - if ($('.button-upload input').data('fileupload')._active > 0 && - uploadScope.creplays.length > 0) { - - // console.log("Not leaving yet", $('#upload input').data('fileupload'), $('#upload input').data('fileupload')._active); - return 'Leaving now will cancel your uploads in progress.'; - } - }); - } - - if (uploadScope.allreplays.length >= uploadLimit()) { - notifyAboutUploadLimit(); - return false; - } else if (blockForShutdown()) { - notifyAboutGGGReplays(); - return false; - } else { - - - replay = { - progress: 0, - status: '-', - state: '-', - replay_file_name: data.files[0].name - }; - uploadScope.creplays.push(replay); - uploadScope.allreplays.push(replay); - throttledUploadDigest(); - - $.ajax({ - url: "/signed_urls", - type: 'GET', - dataType: 'json', - data: {doc: {title: data.files[0].name}}, // send the file name to the server so it can generate the key param - async: false, - success: function(ajaxdata) { - data.formData = { - key: ajaxdata.key, - AWSAccessKeyId: gon.global.replays_access_key, - acl: 'public-read', - policy: ajaxdata.policy, - signature: ajaxdata.signature, - success_action_status: '201' - }; - data.submit(); - } - }); - } - }, - - send: function(e, data) { - uploadScope = angular.element($('.uploads')).scope(); - $.each(data.files, function(i, file) { - replay = _.find(uploadScope.creplays, function(rep) { return rep.replay_file_name == file.name }) - if (! _.isUndefined(replay)) { - replay.status = 'Uploading'; - setState(replay, 'Uploading'); - } - }); - throttledUploadDigest(); - }, - - drop: function(e, data) { - }, - - change: function(e, data) { - }, - - progress: function (e, data) { - // console.log("progress"); - - var progress = parseInt(data.loaded / data.total * 100, 10); - - uploadScope = angular.element($('.uploads')).scope(); - replay = _.find(uploadScope.creplays, function(rep) { return rep.replay_file_name == data.files[0].name }) - - if(! _.isUndefined(replay)) { - replay.progress = progress; - if(progress == 100) { - replay.status = 'Waiting to be processed'; - setState(replay, 'processing'); - } - } else { - // console.log('NNAYITS1238', data.files[0].name, rootScope.creplays, replay); - } - - throttledUploadDigest(); - }, - - done: function(e, data) { - // console.log("done! ", $(data.result.getElementsByTagName("Location")[0]).text(), data.files[0].name); - - $.ajax({ - url: '/replays/s3_drop', - type: 'POST', - data: { - file_name: data.files[0].name, - s3_key: $(data.result.getElementsByTagName("Key")[0]).text(), - channel: gg.settings.replay_channel - }, - async: true, - }); - } - }; // fuconfig - - $('.button-upload input[name="file"]').fileupload(fuconfig); - $('.button-upload input[name="differentname"]').fileupload(fuconfig); + $('.button-upload').click(notifyAboutGGGReplays); join = function(which_one) { From fcd87e70349667a2c6a57a8350d8b61683d4dba0 Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Thu, 15 Mar 2018 14:26:44 -0400 Subject: [PATCH 32/33] yell about gggreplays --- app/assets/javascripts/gg.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/gg.js b/app/assets/javascripts/gg.js index 9ebae92..e5e63e4 100644 --- a/app/assets/javascripts/gg.js +++ b/app/assets/javascripts/gg.js @@ -405,9 +405,9 @@ 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() { +notifyAboutGGGReplays = function() { 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 676b485fa615c2d7d651607e3814ca6bed65438c Mon Sep 17 00:00:00 2001 From: dsjoerg Date: Thu, 15 Mar 2018 14:28:02 -0400 Subject: [PATCH 33/33] try to prevent uploading from happening --- app/views/layouts/application.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 65d205c..9afc1d9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -161,7 +161,6 @@ _\%_____/\%_____/\%_____/\%_/ /\%___fx/\%_____/\__/ /\%_____/\__/ /.com_