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
8b4f9441
Commit
8b4f9441
authored
Sep 16, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add on_delivery
parent
3cd9bfde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
authhook/on_delivery.js
+31
-0
No files found.
authhook/on_delivery.js
0 → 100644
View file @
8b4f9441
function
on_delivery
(
req
,
res
,
next
)
{
var
topics
=
beDesireTopic
(
req
.
body
.
topic
)
var
response
=
{
'result'
:
'ok'
,
'modifiers'
:
{
"topic"
:
topics
}
}
res
.
send
(
response
)
}
module
.
exports
.
on_delivery
=
on_delivery
function
hasGroup
(
topics
)
{
if
(
topics
.
indexOf
(
'!'
)
>
-
1
)
{
return
true
}
else
return
false
}
function
beDesireTopic
(
topics
)
{
if
(
hasGroup
(
topics
))
{
return
joinTopic
(
topics
)
}
else
return
topics
}
function
joinTopic
(
topics
)
{
var
topic
=
topics
.
split
(
'/!'
)[
1
]
return
topics
.
split
(
'/!'
)[
0
]
+
topic
.
substring
(
topic
.
indexOf
(
'/'
),
topic
.
length
)
}
\ No newline at end of file
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