diff --git a/notification.py b/notification.py index 1a5ee50..5502b65 100644 --- a/notification.py +++ b/notification.py @@ -8,6 +8,14 @@ import config from urllib.parse import parse_qs +VERBOSE_MODE = False + + +def set_verbose_mode(enabled: bool): + global VERBOSE_MODE + VERBOSE_MODE = enabled + + def get_notifications() -> list[dict]: return list(db.NOTIFICATION_MESSAGES) @@ -125,8 +133,12 @@ def get_scope_action_from_url(url) -> Union[str, None]: def is_accepted_notification(notification) -> bool: + global VERBOSE_MODE + if notification['user_agent'] == 'misp-exercise-dashboard': # Ignore message generated from this app return False + if VERBOSE_MODE: + return True if '@' not in notification['user']: # Ignore message from system return False diff --git a/server.py b/server.py index 4348016..2fc3af5 100755 --- a/server.py +++ b/server.py @@ -73,6 +73,10 @@ def reset_all_exercise_progress(sid): def get_diagnostic(sid): return getDiagnostic() +@sio.event +def toggle_verbose_mode(sid, payload): + return notification_model.set_verbose_mode(payload['verbose']) + @sio.on('*') def any_event(event, sid, data={}): print('>> Unhandled event', event) diff --git a/src/components/TheLiveLogs.vue b/src/components/TheLiveLogs.vue index 293e248..271cc52 100644 --- a/src/components/TheLiveLogs.vue +++ b/src/components/TheLiveLogs.vue @@ -1,9 +1,16 @@