Commit 8c7a1e24 by Chavee Issariyapat

fix bug

parent b4058f37
......@@ -22,12 +22,15 @@ module.exports = function(options={}) {
if (options.debug) {
console.log('on_publish-------------');
console.log(req.body);
}
var data = req.body;
if (data.topic.substring(0,5) == '$exec') {
var a = data.topic.split('/');
var p = data.payload.split(':');
var ptext = Buffer.from(data.payload, 'base64').toString();
// temp
var p = ptext.split(':');
switch (a[1]) {
case 'wf' :
......@@ -35,19 +38,17 @@ module.exports = function(options={}) {
var data = [{
"name": a[2],
"timestamp": Date.now(),
"data":data.payload,
"topic": data.topic,
"payload":ptext,
"value": p[0],
"tags":{"attr":p[1]}
"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