mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-18 16:36:13 +00:00
chg: [dashboard] filter submission tags
This commit is contained in:
parent
9dde795c12
commit
feabe9f5df
2 changed files with 8 additions and 5 deletions
|
@ -28,6 +28,8 @@ r_tags = config_loader.get_db_conn("Kvrocks_Tags")
|
|||
r_cache = config_loader.get_redis_conn("Redis_Cache")
|
||||
config_loader = None
|
||||
|
||||
TAGS_TO_EXCLUDE_FROM_DASHBOARD = {'infoleak:submission="crawler"', 'infoleak:submission="manual"'}
|
||||
|
||||
#### CORE FUNCTIONS ####
|
||||
|
||||
# # # # UNSAFE TAGS # # # #
|
||||
|
@ -712,6 +714,7 @@ def add_object_tag(tag, obj_type, obj_id, subtype=''):
|
|||
# STATS
|
||||
r_tags.hincrby(f'daily_tags:{datetime.date.today().strftime("%Y%m%d")}', tag, 1)
|
||||
mess = f'{int(time.time())}:{obj_type}:{subtype}:{obj_id}'
|
||||
if tag not in TAGS_TO_EXCLUDE_FROM_DASHBOARD:
|
||||
r_tags.lpush('dashboard:tags', mess)
|
||||
r_tags.ltrim('dashboard:tags', 0, 19)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
The Tags Module
|
||||
================================
|
||||
|
||||
This module add tags to an item.
|
||||
This module add tags to an object.
|
||||
|
||||
"""
|
||||
|
||||
|
@ -36,11 +36,11 @@ class Tags(AbstractModule):
|
|||
self.logger.info(f'Module {self.module_name} initialized')
|
||||
|
||||
def compute(self, message):
|
||||
item = self.obj
|
||||
obj = self.obj
|
||||
tag = message
|
||||
|
||||
# Create a new tag
|
||||
item.add_tag(tag)
|
||||
obj.add_tag(tag)
|
||||
print(f'{self.obj.get_global_id()}: Tagged {tag}')
|
||||
|
||||
# Forward message to channel
|
||||
|
|
Loading…
Add table
Reference in a new issue