mirror of https://github.com/CIRCL/lookyloo
chg: Avoid captures without url(s) or document
parent
33d30a3f4c
commit
5cd8169735
|
@ -77,16 +77,18 @@ class Archiver(AbstractManager):
|
|||
def _update_all_capture_indexes(self):
|
||||
'''Run that after the captures are in the proper directories'''
|
||||
# Recent captures
|
||||
self.logger.info('Update recent indexes')
|
||||
directories_to_index = {capture_dir.parent.parent for capture_dir in get_captures_dir().rglob('uuid')}
|
||||
for directory_to_index in directories_to_index:
|
||||
self.logger.info(f'Updating index for {directory_to_index}')
|
||||
self.logger.debug(f'Updating index for {directory_to_index}')
|
||||
self._update_index(directory_to_index)
|
||||
self.logger.info('Recent indexes updated')
|
||||
|
||||
# Archived captures
|
||||
self.logger.info('Update archives indexes')
|
||||
directories_to_index = {capture_dir.parent.parent for capture_dir in self.archived_captures_dir.rglob('uuid')}
|
||||
for directory_to_index in directories_to_index:
|
||||
self.logger.info(f'Updating index for {directory_to_index}')
|
||||
self.logger.debug(f'Updating index for {directory_to_index}')
|
||||
self._update_index(directory_to_index)
|
||||
self.logger.info('Archived indexes updated')
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<div class="row input-group mb-3">
|
||||
<label for="url" class="col-sm-1 col-form-label">URL:</label>
|
||||
<input type="text" class="form-control col-auto" name="url" id=singleCaptureField
|
||||
placeholder="URL to capture" value="{{predefined_url_to_capture}}">
|
||||
placeholder="URL to capture" value="{{predefined_url_to_capture}}" required>
|
||||
|
||||
<textarea class="form-control col-auto d-none" placeholder="URLs to capture, one per line"
|
||||
name="urls" id=multipleCapturesField></textarea>
|
||||
|
@ -298,17 +298,35 @@
|
|||
<script src='{{ url_for('static', filename='capture.js') }}'
|
||||
integrity="{{get_sri('static', 'capture.js')}}"
|
||||
crossorigin="anonymous"></script>
|
||||
<script>
|
||||
$('#nav-url-tab').on('click', function(e) {
|
||||
document.getElementById("singleCaptureField").required = true;
|
||||
document.getElementById("document").required = false;
|
||||
$("#singleCaptureField").removeClass("d-none");
|
||||
document.getElementById('multipleCaptures').checked = false;
|
||||
$("#multipleCapturesField").addClass("d-none");
|
||||
});
|
||||
$('#nav-doc-tab').on('click', function(e) {
|
||||
document.getElementById("document").required = true;
|
||||
document.getElementById("multipleCapturesField").required = false;
|
||||
document.getElementById("singleCaptureField").required = false;
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$('#multipleCaptures').on('click', function(e) {
|
||||
if (document.getElementById('multipleCaptures').checked == true) {
|
||||
document.getElementById('singleCaptureField').value = '';
|
||||
$("#singleCaptureField").addClass("d-none");
|
||||
document.getElementById("singleCaptureField").required = false;
|
||||
$("#multipleCapturesField").removeClass("d-none");
|
||||
document.getElementById("multipleCapturesField").required = true;
|
||||
}
|
||||
else {
|
||||
document.getElementById('multipleCapturesField').value = '';
|
||||
$("#singleCaptureField").removeClass("d-none");
|
||||
document.getElementById("singleCaptureField").required = true;
|
||||
$("#multipleCapturesField").addClass("d-none");
|
||||
document.getElementById("multipleCapturesField").required = false;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue