Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
communications-backbone
Commits
7c6c1d16
Unverified
Commit
7c6c1d16
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
refactor: change send notify to parse posted json
parent
40590158
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
endpoints/notify.py
endpoints/notify.py
+5
-4
endpoints/send.py
endpoints/send.py
+6
-5
No files found.
endpoints/notify.py
View file @
7c6c1d16
...
...
@@ -17,18 +17,19 @@ class Notify(Resource):
self
.
clients
=
json
.
load
(
clients_file
)
def
post
(
self
):
errors
=
self
.
schema
.
validate
(
request
.
args
)
args
=
request
.
get_json
()
errors
=
self
.
schema
.
validate
(
args
)
if
errors
:
abort
(
400
,
message
=
str
(
errors
))
messages
=
[]
allow
=
False
body
=
request
.
args
.
get
(
"body"
)
client_id
=
request
.
args
.
get
(
"client_id"
)
body
=
args
.
get
(
"body"
)
client_id
=
args
.
get
(
"client_id"
)
notify_queue
=
client_id
+
"-notify"
if
client_id
in
self
.
clients
:
client
=
self
.
clients
.
get
(
client_id
)
if
request
.
args
.
get
(
"secret"
)
==
client
.
get
(
"secret"
):
if
args
.
get
(
"secret"
)
==
client
.
get
(
"secret"
):
allow
=
True
if
allow
:
...
...
This diff is collapsed.
Click to expand it.
endpoints/send.py
View file @
7c6c1d16
...
...
@@ -18,19 +18,20 @@ class Send(Resource):
self
.
clients
=
json
.
load
(
clients_file
)
def
post
(
self
):
errors
=
self
.
schema
.
validate
(
request
.
args
)
args
=
request
.
get_json
()
errors
=
self
.
schema
.
validate
(
args
)
if
errors
:
abort
(
400
,
message
=
str
(
errors
))
messages
=
[]
allow
=
False
body
=
request
.
args
.
get
(
"body"
)
topic
=
request
.
args
.
get
(
"topic"
)
client_id
=
request
.
args
.
get
(
"client_id"
)
body
=
args
.
get
(
"body"
)
topic
=
args
.
get
(
"topic"
)
client_id
=
args
.
get
(
"client_id"
)
outbox_queue
=
client_id
+
"-outbox"
if
client_id
in
self
.
clients
:
client
=
self
.
clients
.
get
(
client_id
)
if
request
.
args
.
get
(
"secret"
)
==
client
.
get
(
"secret"
):
if
args
.
get
(
"secret"
)
==
client
.
get
(
"secret"
):
allow
=
True
if
allow
:
...
...
This diff is collapsed.
Click to expand it.
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