Commit d24dd439 by zCaesar

edit on_delivery to on_deliver

parent 9547c678
......@@ -31,6 +31,8 @@ module.exports = function (options = {}) {
var cachekey = 'sub:' + req.body.client_id + ':' + req.body.username + ':' + topic;
var authstatus = cache.get(cachekey);
// checkRole
var role = require('./checkClientRole')
// Set Response
var getGroupID = require('./utils/getGroupID').getGroupID
getGroupID(req.body.username, req.body.client_id, (_id) => { // get groupID
......
......@@ -11,7 +11,7 @@ var auth_on_register = require('./auth_on_register')({ debug: auth_on_register_d
var auth_on_publish = require('./auth_on_publish')({ debug: auth_on_publish_debug });
var auth_on_subscribe = require('./auth_on_subscribe')({ debug: auth_on_subscribe_debug });
var on_publish = require('./on_publish')({ debug: on_publish_debug });
var on_delivery = require('./on_delivery').on_delivery
var on_deliver = require('./on_deliver').on_deliver
var signRole = require('./checkClientRole').signRole
const server = restify.createServer({
......@@ -35,7 +35,7 @@ server.get('/about', function (req, res, next) {
server.post('/authreg', auth_on_register);
server.post('/authpub', auth_on_publish);
server.post('/authsub', auth_on_subscribe);
server.post('/ondelivery', on_delivery)
server.post('/ondeliver', on_deliver)
server.post('/onpub', on_publish)
server.post('/signRole', signRole)
......
function on_delivery(req, res, next) {
function on_deliver(req, res, next) {
var topics = beDesireTopic(req.body.topic)
var response = {
'result': 'ok',
......@@ -8,7 +8,7 @@ function on_delivery(req, res, next) {
}
res.send(response)
}
module.exports.on_delivery = on_delivery
module.exports.on_deliver = on_deliver
function hasGroup(topics) {
if (topics.indexOf('!') > -1) {
......
function getTopic(topic, id) {
if (!checkWildCard(topic)) {
var _topic = classifiedTopic(topic) + '/!' + id + topic.split(classifiedTopic(topic))[1]
return _topic
}
else return topic
}
module.exports.getTopic = getTopic
......@@ -20,8 +17,3 @@ function classifiedTopic(topic) {
return '@client'
}
}
\ No newline at end of file
function checkWildCard(topic) {
if (topic.indexOf('#') > -1) return true
else return false
}
\ No newline at end of file
......@@ -814,8 +814,8 @@ vmq_webhooks.webhook3.endpoint = http://localhost:40000/authpub
vmq_webhooks.webhook4.hook = on_publish
vmq_webhooks.webhook4.endpoint = http://localhost:41000/onpub
vmq_webhooks.webhook5.hook = on_delivery
vmq_webhooks.webhook5.endpoint = http://localhost:40000/ondelivery
vmq_webhooks.webhook5.hook = on_deliver
vmq_webhooks.webhook5.endpoint = http://localhost:40000/ondeliver
## Specify the address and port of the bridge to connect to. Several
## bridges can configured by using different bridge names (e.g. br0). If the
......
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