Skip to content

Commit

Permalink
Changes for new HTTP request header x-api-key: assume new runtime par…
Browse files Browse the repository at this point in the history
…ameter is named "x_api_key_header".
  • Loading branch information
U-OREGANO\sewall authored and U-OREGANO\sewall committed Feb 23, 2019
1 parent 15e7398 commit 7228b4b
Show file tree
Hide file tree
Showing 7 changed files with 1,486 additions and 1,094 deletions.
2,532 changes: 1,444 additions & 1,088 deletions HTML/Assets/ctat.min.js
100644 → 100755

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions HTML/Assets/mail-worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var process_transactions_url = null;
var process_detectors_url = null;
var x_api_key_header = null;
var authenticity_token = "";
var txAssembler = null;
var detectors = [];
Expand Down Expand Up @@ -36,6 +37,7 @@ self.onmessage = function ( e ) {
case "process_transactions_url":
process_transactions_url = e.data.process_transactions_url;
process_detectors_url = e.data.process_detectors_url;
x_api_key_header = e.data.x_api_key_header;
authenticity_token = e.data.authenticity_token;
break;
case "connectTransactionAssembler":
Expand Down Expand Up @@ -74,6 +76,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(trans) );
xhttp.open("POST", process_transactions_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(trans) );
}
else{
Expand All @@ -99,6 +102,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(detect) );
xhttp.open("POST", process_detectors_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(detect) );
}
else{
Expand Down
4 changes: 4 additions & 0 deletions HTML/Assets/networking_for_replay/mail-worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var process_transactions_url = null;
var process_detectors_url = null;
var x_api_key_header = null;
var authenticity_token = "";
var txAssembler = null;
var detectors = [];
Expand Down Expand Up @@ -43,6 +44,7 @@ self.onmessage = function ( e ) {
case "process_transactions_url":
process_transactions_url = e.data.process_transactions_url;
process_detectors_url = e.data.process_detectors_url;
x_api_key_header = e.data.x_api_key_header;
authenticity_token = e.data.authenticity_token;
break;
case "connectTransactionAssembler":
Expand Down Expand Up @@ -81,6 +83,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(trans) );
xhttp.open("POST", process_transactions_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(trans) );
}
else{
Expand All @@ -106,6 +109,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(detect) );
xhttp.open("POST", process_detectors_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(detect) );

}
Expand Down
12 changes: 10 additions & 2 deletions HTML/Assets/networking_for_replay/transaction_mailer_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TransactionMailerUsers =
var init = "";


TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer)
TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer, xApiKeyHeader)
{

console.log("TransactionMailerUsers.create(): at entry, init", init );
Expand All @@ -33,10 +33,18 @@ TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authTo
parent.parent.initWorker.port.postMessage(["newDetectorResult", e.data]);
}, false);

TransactionMailerUsers.mailer.postMessage({ command: "process_transactions_url", "process_transactions_url": txDestURL, "process_detectors_url": scriptsDestURL, "authenticity_token": authToken});
TransactionMailerUsers.process_transactions_url = txDestURL;
TransactionMailerUsers.authenticity_token = authToken;
TransactionMailerUsers.process_detectors_url = scriptsDestURL;
TransactionMailerUsers.x_api_key_header = (xApiKeyHeader? xApiKeyHeader : "");

TransactionMailerUsers.mailer.postMessage({
command: "process_transactions_url",
process_transactions_url: TransactionMailerUsers.process_transactions_url,
process_detectors_url: TransactionMailerUsers.process_detectors_url,
x_api_key_header: TransactionMailerUsers.x_api_key_header,
authenticity_token: TransactionMailerUsers.authenticity_token
});

var channel = new MessageChannel();
TransactionMailerUsers.mailer.postMessage(
Expand Down
12 changes: 10 additions & 2 deletions HTML/Assets/transaction_mailer_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@ TransactionMailerUsers =
active: []
};

TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer)
TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer, xApiKeyHeader)
{
console.log("TransactionMailerUsers.create(): at entry, scriptsInitzer ", scriptsInitzer );

TransactionMailerUsers.mailer = new Worker(path+'/'+TransactionMailerUsers.mailerURL);

TransactionMailerUsers.mailer.postMessage({ command: "process_transactions_url", "process_transactions_url": txDestURL, "process_detectors_url": scriptsDestURL, "authenticity_token": authToken});
TransactionMailerUsers.process_transactions_url = txDestURL;
TransactionMailerUsers.authenticity_token = authToken;
TransactionMailerUsers.process_detectors_url = scriptsDestURL;
TransactionMailerUsers.x_api_key_header = (xApiKeyHeader? xApiKeyHeader : "");

TransactionMailerUsers.mailer.postMessage({
command: "process_transactions_url",
process_transactions_url: TransactionMailerUsers.process_transactions_url,
process_detectors_url: TransactionMailerUsers.process_detectors_url,
x_api_key_header: TransactionMailerUsers.x_api_key_header,
authenticity_token: TransactionMailerUsers.authenticity_token
});

var channel = new MessageChannel();
TransactionMailerUsers.mailer.postMessage(
Expand Down
4 changes: 4 additions & 0 deletions HTML/Assets/tutor_adaptivity/mail-worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var process_transactions_url = null;
var process_detectors_url = null;
var x_api_key_header = null;
var authenticity_token = "";
var txAssembler = null;
var detectors = [];
Expand Down Expand Up @@ -36,6 +37,7 @@ self.onmessage = function ( e ) {
case "process_transactions_url":
process_transactions_url = e.data.process_transactions_url;
process_detectors_url = e.data.process_detectors_url;
x_api_key_header = e.data.x_api_key_header;
authenticity_token = e.data.authenticity_token;
break;
case "connectTransactionAssembler":
Expand Down Expand Up @@ -74,6 +76,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(trans) );
xhttp.open("POST", process_transactions_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(trans) );
}
else{
Expand All @@ -99,6 +102,7 @@ setInterval(function()
//xhttp.send( JSON.stringify(detect) );
xhttp.open("POST", process_detectors_url, true); // fake_server.php
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("x-api-key", x_api_key_header);
xhttp.send( JSON.stringify(detect) );
}
else{
Expand Down
12 changes: 10 additions & 2 deletions HTML/Assets/tutor_adaptivity/transaction_mailer_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ TransactionMailerUsers =
active: []
};

TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer)
TransactionMailerUsers.create = function(path, txDestURL, scriptsDestURL, authToken, scriptsInitzer, xApiKeyHeader)
{
console.log("TransactionMailerUsers.create(): at entry, scriptsInitzer ", scriptsInitzer );

TransactionMailerUsers.mailer = new Worker(path+'/'+TransactionMailerUsers.mailerURL);

TransactionMailerUsers.mailer.postMessage({ command: "process_transactions_url", "process_transactions_url": txDestURL, "process_detectors_url": scriptsDestURL, "authenticity_token": authToken});
TransactionMailerUsers.process_transactions_url = txDestURL;
TransactionMailerUsers.authenticity_token = authToken;
TransactionMailerUsers.process_detectors_url = scriptsDestURL;
TransactionMailerUsers.x_api_key_header = (xApiKeyHeader? xApiKeyHeader : "");

TransactionMailerUsers.mailer.postMessage({
command: "process_transactions_url",
process_transactions_url: TransactionMailerUsers.process_transactions_url,
process_detectors_url: TransactionMailerUsers.process_detectors_url,
x_api_key_header: TransactionMailerUsers.x_api_key_header,
authenticity_token: TransactionMailerUsers.authenticity_token
});

var channel = new MessageChannel();
TransactionMailerUsers.mailer.postMessage(
Expand Down

0 comments on commit 7228b4b

Please sign in to comment.