Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
d24dd439
Commit
d24dd439
authored
Sep 17, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit on_delivery to on_deliver
parent
9547c678
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
16 deletions
+8
-16
authhook/auth_on_subscribe.js
+2
-0
authhook/index.js
+2
-2
authhook/on_deliver.js
+2
-2
authhook/utils/getTopic.js
+0
-10
files/vernemq.conf
+2
-2
No files found.
authhook/auth_on_subscribe.js
View file @
d24dd439
...
...
@@ -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
...
...
authhook/index.js
View file @
d24dd439
...
...
@@ -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_deliver
y
=
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
(
'/ondeliver
y'
,
on_delivery
)
server
.
post
(
'/ondeliver
'
,
on_deliver
)
server
.
post
(
'/onpub'
,
on_publish
)
server
.
post
(
'/signRole'
,
signRole
)
...
...
authhook/on_deliver
y
.js
→
authhook/on_deliver.js
View file @
d24dd439
function
on_deliver
y
(
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_deliver
y
=
on_delivery
module
.
exports
.
on_deliver
=
on_deliver
function
hasGroup
(
topics
)
{
if
(
topics
.
indexOf
(
'!'
)
>
-
1
)
{
...
...
authhook/utils/getTopic.js
View file @
d24dd439
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
files/vernemq.conf
View file @
d24dd439
...
...
@@ -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_deliver
y
vmq_webhooks
.
webhook5
.
endpoint
=
http
://
localhost
:
40000
/
ondeliver
y
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment