fix: Use default_public for all capture, including if submitted via the API

pull/281/head
Raphaël Vinot 2021-11-02 14:58:31 -07:00
parent c11e9d8110
commit bfb1e6b181
1 changed files with 8 additions and 2 deletions

View File

@ -51,14 +51,20 @@ class AsyncCapture(AbstractManager):
to_capture: Dict[str, str] = self.redis.hgetall(uuid) to_capture: Dict[str, str] = self.redis.hgetall(uuid)
if get_config('generic', 'default_public'):
# By default, the captures are on the index, unless the user mark them as un-listed
listing = False if ('listing' in to_capture and to_capture['listing'].lower() in ['false', '0', '']) else True
else:
# By default, the captures are not on the index, unless the user mark them as listed
listing = True if ('listing' in to_capture and to_capture['listing'].lower() in ['true', '1']) else False
self.logger.info(f'Capturing {to_capture["url"]} - {uuid}') self.logger.info(f'Capturing {to_capture["url"]} - {uuid}')
success, error_message = self._capture( success, error_message = self._capture(
to_capture['url'], to_capture['url'],
perma_uuid=uuid, perma_uuid=uuid,
cookies_pseudofile=to_capture.get('cookies', None), cookies_pseudofile=to_capture.get('cookies', None),
depth=int(to_capture.get('depth', 1)), depth=int(to_capture.get('depth', 1)),
# By default, the captures are on the index, unless the user mark them as un-listed listing=listing,
listing=False if ('listing' in to_capture and to_capture['listing'].lower() in ['false', '0', '']) else True,
user_agent=to_capture.get('user_agent', None), user_agent=to_capture.get('user_agent', None),
referer=to_capture.get('referer', None), referer=to_capture.get('referer', None),
proxy=to_capture.get('proxy', None), proxy=to_capture.get('proxy', None),