Test service worker and shared worker store
This commit is contained in:
@@ -22,6 +22,10 @@ define([], function () {
|
||||
|
||||
var unBencode = function (str) { return str.replace(/^\d+:/, ''); };
|
||||
|
||||
var removeCp = function (str) {
|
||||
return str.replace(/^cp\|([A-Za-z0-9+\/=]{0,20}\|)?/, '');
|
||||
};
|
||||
|
||||
var start = function (conf) {
|
||||
var channel = conf.channel;
|
||||
var validateKey = conf.validateKey;
|
||||
@@ -72,7 +76,7 @@ define([], function () {
|
||||
// at the beginning of each message on the server.
|
||||
// We have to make sure our regex ignores this nonce using {0,20} (our IDs
|
||||
// should only be 8 characters long)
|
||||
return msg.replace(/^cp\|([A-Za-z0-9+\/=]{0,20}\|)?/, '');
|
||||
return removeCp(msg);
|
||||
};
|
||||
|
||||
var msgOut = function (msg) {
|
||||
@@ -124,6 +128,8 @@ define([], function () {
|
||||
|
||||
|
||||
lastKnownHash = msg.slice(0,64);
|
||||
|
||||
var isCp = /^cp\|/.test(msg);
|
||||
var message = msgIn(peer, msg);
|
||||
|
||||
verbose(message);
|
||||
@@ -134,7 +140,7 @@ define([], function () {
|
||||
message = unBencode(message);//.slice(message.indexOf(':[') + 1);
|
||||
|
||||
// pass the message into Chainpad
|
||||
onMessage(peer, message, validateKey);
|
||||
onMessage(peer, message, validateKey, isCp);
|
||||
//sframeChan.query('Q_RT_MESSAGE', message, function () { });
|
||||
};
|
||||
|
||||
@@ -260,7 +266,8 @@ define([], function () {
|
||||
};
|
||||
|
||||
return {
|
||||
start: start
|
||||
start: start,
|
||||
removeCp: removeCp
|
||||
/*function (config) {
|
||||
config.sframeChan.whenReg('EV_RT_READY', function () {
|
||||
start(config);
|
||||
|
||||
Reference in New Issue
Block a user