Commit 8c7a1e24 by Chavee Issariyapat

fix bug

parent b4058f37
......@@ -22,32 +22,33 @@ module.exports = function(options={}) {
if (options.debug) {
console.log('on_publish-------------');
console.log(req.body);
}
var data = req.body;
var data = req.body;
if (data.topic.substring(0,5) == '$exec') {
var a = data.topic.split('/');
var ptext = Buffer.from(data.payload, 'base64').toString();
if (data.topic.substring(0,5) == '$exec') {
var a = data.topic.split('/');
var p = data.payload.split(':');
// temp
var p = ptext.split(':');
switch (a[1]) {
case 'wf' :
case 'writefeed' :
var data = [{
"name": a[2],
"timestamp": Date.now(),
"data":data.payload,
"value": p[0],
"tags":{"attr":p[1]}
}];
break;
}
}
switch (a[1]) {
case 'wf' :
case 'writefeed' :
var data = [{
"name": a[2],
"timestamp": Date.now(),
"topic": data.topic,
"payload":ptext,
"value": p[0], // temp
"tags":{"attr":p[1]} // temp
}];
break;
}
}
var topic = req.body.topic;
var cachekey = 'pub:'+req.body.client_id +':'+ req.body.username+':'+topic;
var authstatus = cache.get(cachekey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment