-
Notifications
You must be signed in to change notification settings - Fork 0
/
gethashesaction.js
48 lines (41 loc) · 1.41 KB
/
gethashesaction.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require('./actions');
require('./action');
require('./base');
GetHashesAction = function(req, res) {
goog.base(this, req, res);
};
goog.inherits(GetHashesAction, Action);
GetHashesAction.RE_ = /^\/GetHashes\/([^\/.]+)\/([^\/.]+)/;
GetHashesAction.LEAGUE_MATE_RE_ = /\/LeagueMate\/([^\/.]+)/;
GetHashesAction.prototype.handleRequest = function(data) {
var m = GetHashesAction.RE_.exec(this.req.url);
var name = decodeURIComponent(m[1]).toString();
var code = decodeURIComponent(m[2]).toString();
var leagueMateMatch = GetHashesAction.LEAGUE_MATE_RE_.exec(this.req.url);
if (leagueMateMatch && leagueMateMatch.length == 2) {
var leagueMateRank = leagueMateMatch[1];
console.log("Received league_mate_match_history work: ",
name, code, leagueMateRank);
Actions.workPool.push({
'action': this,
'cmd': {
'type': 'league_mate_match_history',
'characterString': name + '#' + code,
'leagueMateRank': leagueMateRank,
'id': 'league_mate_match_history:' + name + '#' + code +
':' + leagueMateRank
}
});
} else {
console.log("Received match_history work: ", name, code);
Actions.workPool.push({
'action': this,
'cmd': {
'type': 'match_history',
'characterString': name + '#' + code,
'id': 'match_history:' + name + '#' + code
}
});
}
};
Actions.register(GetHashesAction.RE_, GetHashesAction);