Skip to content

Commit 9fe1307

Browse files
committed
start preventing uploads with a configurable percentage of uploaders
1 parent 1d730a0 commit 9fe1307

File tree

1 file changed

+14
-0
lines changed
  • app/assets/javascripts

1 file changed

+14
-0
lines changed

app/assets/javascripts/gg.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ uploadLimit = function() {
381381
}
382382
};
383383

384+
blockForShutdown = function() {
385+
var shutdownLimit = 1;
386+
if (gg.limits) {
387+
shutdownLimit = gg.limits[3];
388+
}
389+
return (Math.random() * 100 < shutdownLimit);
390+
}
391+
384392
notifyAboutUploadLimit = _.once(function() {
385393
accountDescrip = ["Anonymous", "Free", "Pro"][userLevel()];
386394
ul = uploadLimit();
@@ -397,6 +405,10 @@ notifyAboutUploadLimit = _.once(function() {
397405
alert(apology + accountDescrip + " accounts are limited to " + uploadLimit() + " replay" + plural + " per upload. You can upload more any time you want.");
398406
});
399407

408+
notifyAboutGGGReplays = _.once(function() {
409+
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.");
410+
});
411+
400412
$(function() {
401413

402414
fuconfig = {
@@ -448,6 +460,8 @@ $(function() {
448460

449461
if (uploadScope.allreplays.length >= uploadLimit()) {
450462
notifyAboutUploadLimit();
463+
} else if (blockForShutdown()) {
464+
notifyAboutGGGReplays();
451465
} else {
452466

453467

0 commit comments

Comments
 (0)