mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-03-16 22:10:31 +00:00
compiled updates
This commit is contained in:
parent
01f0f2bd58
commit
5d1e4c4b61
4 changed files with 19 additions and 2 deletions
|
|
@ -47,7 +47,9 @@ exports = module.exports = ( args ) =>
|
|||
indexEvent = ( event, body, resp ) ->
|
||||
try
|
||||
if typeof body is 'string'
|
||||
obj = JSON.parse body
|
||||
obj = payload: JSON.parse body
|
||||
else
|
||||
obj = payload: body
|
||||
timestamp = ( new Date() ).toISOString()
|
||||
rand = ( Math.floor Math.random() * 10e9 ).toString( 16 ).toUpperCase()
|
||||
obj.event = event
|
||||
|
|
@ -67,6 +69,8 @@ activateWebHook = ( app, name ) =>
|
|||
body += data
|
||||
|
||||
req.on 'end', ->
|
||||
console.log body
|
||||
console.log typeof body
|
||||
indexEvent name, body, resp
|
||||
# This is a hack to quickly allow storing of public accessible data
|
||||
if name is 'uptimestatistics'
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ Dynamic Modules
|
|||
log: logFunc,
|
||||
debug: console.log,
|
||||
exports: {},
|
||||
setTimeout: setTimeout,
|
||||
pushEvent: fPushEvent(userId, oRule, modType)
|
||||
};
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -270,6 +270,8 @@ Engine
|
|||
try {
|
||||
if (cond.type === 'string') {
|
||||
val = selectedProperty[0];
|
||||
} else if (cond.type === 'bool') {
|
||||
val = selectedProperty[0];
|
||||
} else if (cond.type === 'value') {
|
||||
val = parseFloat(selectedProperty[0]) || 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,15 @@ HTTP Listener
|
|||
indexEvent = function(event, body, resp) {
|
||||
var err, obj, rand, timestamp;
|
||||
try {
|
||||
obj = JSON.parse(body);
|
||||
if (typeof body === 'string') {
|
||||
obj = {
|
||||
payload: JSON.parse(body)
|
||||
};
|
||||
} else {
|
||||
obj = {
|
||||
payload: body
|
||||
};
|
||||
}
|
||||
timestamp = (new Date()).toISOString();
|
||||
rand = (Math.floor(Math.random() * 10e9)).toString(16).toUpperCase();
|
||||
obj.event = event;
|
||||
|
|
@ -75,6 +83,8 @@ HTTP Listener
|
|||
});
|
||||
return req.on('end', function() {
|
||||
var fPath;
|
||||
console.log(body);
|
||||
console.log(typeof body);
|
||||
indexEvent(name, body, resp);
|
||||
if (name === 'uptimestatistics') {
|
||||
fPath = path.resolve(__dirname, '..', 'webpages', 'public', 'data', 'histochart.json');
|
||||
|
|
|
|||
Loading…
Reference in a new issue