Skip to content

Commit

Permalink
new: Search on all redirects on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Feb 28, 2025
1 parent 6edb40e commit cb43ef1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
18 changes: 10 additions & 8 deletions website/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2240,15 +2240,17 @@ def post_table(table_name: str, value: str) -> Response:
'page': f"""<p title="{cached.title}"><a href="{url_for('tree', tree_uuid=cached.uuid)}">{cached.title}</a><p>{shorten_string(cached.url, 100, with_title=True)}""",
'capture_time': cached.timestamp.isoformat(),
}
if not cached.redirects:
to_append['redirects'] = 'No redirect'
else:
to_append['redirects'] = {'display': 'No redirect', 'filter': ''}
if cached.redirects:
display = f"""<p title="{cached.redirects[0]}">{shorten_string(cached.redirects[0], 50, with_title=True)}"""
filter_redirects = ' '.join(cached.redirects)
to_append['redirects'] = f"""<p title="{cached.redirects[0]}">{shorten_string(cached.redirects[0], 50, with_title=True)}"""
if len(cached.redirects) > 1:
for counter, r in enumerate(cached.redirects[1:]):
to_append['redirects'] += f"""<br>{"&nbsp;" * (counter + 1) * 2}{shorten_string(r, 50, with_title=True)}""" # type: ignore[operator]
to_append['redirects'] += '</p>' # type: ignore[operator]
to_append['redirects'] += f"""<a style="float: right;" href="{url_for('redirects', tree_uuid=cached.uuid)}">Download redirects</a>""" # type: ignore[operator]
display += f"""<br>{"&nbsp;" * (counter + 1) * 2}{shorten_string(r, 50, with_title=True)}""" # type: ignore[operator]
display += '</p>' # type: ignore[operator]
display += f"""<a style="float: right;" href="{url_for('redirects', tree_uuid=cached.uuid)}">Download redirects</a>""" # type: ignore[operator]
to_append['redirects'] = {'display': display, 'filter': filter_redirects}
prepared_captures.append(to_append)
return jsonify(prepared_captures)

Expand Down Expand Up @@ -2533,8 +2535,8 @@ def post_table(table_name: str, value: str) -> Response:
'time_first': record.time_first_datetime.isoformat(),
'time_last': record.time_last_datetime.isoformat(),
'rrtype': record.rrtype,
'rdata': data,
'rrname': record.rrname
'rdata': f'<span class="d-inline-block text-break">{data}</span>',
'rrname': f'<span class="d-inline-block text-break">{record.rrname}</span>'
}
prepared_records.append(to_append)
return jsonify(prepared_records)
Expand Down
2 changes: 1 addition & 1 deletion website/web/sri.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"loader.gif": "ZZKD5vLSKBWKeUpa2KI9qheUJ49iTI/UULmVU/AX28fBfH00K3lLc2v5pVJZ4qXG1BbB13LTXzRKKU35H2XfNg==",
"lookyloo.jpeg": "i6wBj8CsIM5YAQLEMQfhs3CNOSKkErF8AMqqM6ZygSwCyQgv9CU8xt94veMZhM/ufBWoz7kAXmR+yywmxsTxug==",
"redirect.png": "PAjzlPV97rEFvH55mG1ZC9wRl98be3yMeX/nENuFkJcds6/AXgSR2ig/QyPULgobSnNgiYieLVWY/oqsgeywrQ==",
"render_tables.js": "pBu3hTvXCuEPB6S/yuRAq1nCDWQIn96MN/mu1kXMJitReLB+0G5bWiGeRrIngpL4PjGBPIZY6ROoBVcVI2T44g==",
"render_tables.js": "4UhEfFnV6e+GaHKsVVARxwHPFHH91bXkKGzlylp+RDL8xHrITUWk+XriSx/3poiyrgiCudzsVzMMgYPnALD9rA==",
"secure.svg": "H8ni7t0d60nCJDVGuZpuxC+RBy/ipAjWT627D12HlZGg6LUmjSwPTQTUekm3UJupEP7TUkhXyq6WHc5gy7QBjg==",
"stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==",
"stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==",
Expand Down
2 changes: 1 addition & 1 deletion website/web/static/render_tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function renderTables() {
columns : [
{ data: 'page', width: '40%' },
{ data: 'capture_time', width: '20%', render: DataTable.render.datetime_with_tz() },
{ data: 'redirects', width: '40%' }
{ data: {_: 'redirects.display', filter: 'redirects.filter'}, width: '40%' }
],
})
}
Expand Down
12 changes: 6 additions & 6 deletions website/web/templates/hostname_popup.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends "main.html" %}

{% from 'bootstrap5/utils.html' import render_icon %}

{% from "macros.html" import known_content_details %}
{% from "macros.html" import ressource_legitimacy_details %}
{% from "macros.html" import indexed_cookies %}
Expand Down Expand Up @@ -157,19 +160,16 @@ <h5>NS record for {{hostnode.ns[0]}}:</h5>
<div class="h3" title="{{ url['url_object'].name }}">
{# HTTPs or not #}
{% if url['encrypted'] %}
<img src="/static/secure.svg" title="Encrypted request" width="21" height="21"/>
{{ render_icon('lock-fill') }}
{% else %}
<img src="/static/insecure.svg" title="Unencrypted request" width="21" height="21"/>
{{ render_icon('unlock-fill') }}
{%endif%}
{# URL #}
... /{{ shorten_string(url['url_path'], 50)}}
{# Copy full URL to clipbard #}
<button type="button" class="btn btn-default btn-copy js-copy"
data-bs-toggle="tooltip" data-bs-placement="bottom" data-copy="{{ url['url_object'].name }}" data-bs-original-title="Copy to clipboard">
<svg class="bi bi-clipboard" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
<path fill-rule="evenodd" d="M9.5 1h-3a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-1a.5.5 0 0 0-.5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
</svg>
{{ render_icon('copy') }}
</button>
</div>
{% if url['url_object'].ip_address %}
Expand Down

0 comments on commit cb43ef1

Please sign in to comment.