PENGIN PI! A CRM with the back bone of a feature light ERP system. Utilitarian in design, easy to extend, customize, and deploy. Made by a community, supported by Tobu Pengin.
GNU General Public License v3.0
9
stars
1
forks
source link
[TASK] app init before_task function for chat_bool toggle #413
Description
We need to setup a toggle mechanism in a route function with the @app.before_task() decorator to ensure the function is run before the endpoint.
Details
This can live in the routes/message.py or the app init.
Will look kind of like:
#might need to include endpoint for chat routes to better handle chat_bool processing
@app.before_request()
def chat_messenger_activater(ID):
if app.context_processor(chat_bool):
if request.method == "POST":
if ID == "chat_btn":
chat_bool == False
#ensure the javascript deletes or hides the overlay
#alternative is using endpoints in routes, and this simply toggles chat_bool
else:
if request.method == "POST":
if ID == "chat_btn":
chat_bool = True
#javascript sending post, gets html response, and dynamically loads chat
#alternative is using endpoints in routes, and this simply toggles chat_bool
return "append / forcefully return html template"
Additional
[ ] We need to also lock down the function with login_required and/or user role.
[ ] We may also want to put limiter on there to restrict how fast people can turn on and off the button, but, maybe not black list the IP? Just once per 2 or 3 seconds is fine.
Description We need to setup a toggle mechanism in a route function with the
@app.before_task()
decorator to ensure the function is run before the endpoint.Details This can live in the routes/message.py or the app init.
Will look kind of like:
Additional
[ ] We need to also lock down the function with login_required and/or user role.
[ ] We may also want to put limiter on there to restrict how fast people can turn on and off the button, but, maybe not black list the IP? Just once per 2 or 3 seconds is fine.