fix: layout improvement after merge
This commit is contained in:
@@ -30,7 +30,7 @@ def get_templates() -> Jinja2Templates:
|
|||||||
return _templates
|
return _templates
|
||||||
|
|
||||||
|
|
||||||
def _format_ts(value):
|
def _format_ts(value, time_only=False):
|
||||||
"""Custom Jinja2 filter for formatting ISO timestamps."""
|
"""Custom Jinja2 filter for formatting ISO timestamps."""
|
||||||
if not value:
|
if not value:
|
||||||
return "N/A"
|
return "N/A"
|
||||||
@@ -39,6 +39,8 @@ def _format_ts(value):
|
|||||||
value = datetime.fromisoformat(value)
|
value = datetime.fromisoformat(value)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
return value
|
return value
|
||||||
|
if time_only:
|
||||||
|
return value.strftime("%H:%M:%S")
|
||||||
if value.date() == datetime.now().date():
|
if value.date() == datetime.now().date():
|
||||||
return value.strftime("%H:%M:%S")
|
return value.strftime("%H:%M:%S")
|
||||||
return value.strftime("%m/%d/%Y %H:%M:%S")
|
return value.strftime("%m/%d/%Y %H:%M:%S")
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
hx-target="#search-results-container"
|
hx-target="#search-results-container"
|
||||||
hx-swap="innerHTML"
|
hx-swap="innerHTML"
|
||||||
hx-indicator="#search-spinner" />
|
hx-indicator="#search-spinner" />
|
||||||
<span id="search-spinner" class="htmx-indicator search-spinner">↻</span>
|
<span id="search-spinner" class="htmx-indicator search-spinner"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="search-results-container"></div>
|
<div id="search-results-container"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -64,23 +64,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ip-info-section">
|
<div class="ip-info-section">
|
||||||
<h3>Location</h3>
|
<h3>Geo & Network</h3>
|
||||||
{% if stats.city %}
|
{% if stats.city or stats.country %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">City:</span>
|
<span class="stat-label-sm">Location:</span>
|
||||||
<span class="stat-value-sm">{{ stats.city | e }}</span>
|
<span class="stat-value-sm">{{ stats.city | default('') | e }}{% if stats.city and stats.country %}, {% endif %}{{ stats.country | default(stats.country_code | default('')) | e }}</span>
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if stats.region_name %}
|
|
||||||
<div class="stat-row">
|
|
||||||
<span class="stat-label-sm">Region:</span>
|
|
||||||
<span class="stat-value-sm">{{ stats.region_name | e }}</span>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if stats.country %}
|
|
||||||
<div class="stat-row">
|
|
||||||
<span class="stat-label-sm">Country:</span>
|
|
||||||
<span class="stat-value-sm">{{ stats.country | e }} ({{ stats.country_code | default('') | e }})</span>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.timezone %}
|
{% if stats.timezone %}
|
||||||
@@ -89,10 +77,6 @@
|
|||||||
<span class="stat-value-sm">{{ stats.timezone | e }}</span>
|
<span class="stat-value-sm">{{ stats.timezone | e }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ip-info-section">
|
|
||||||
<h3>Network</h3>
|
|
||||||
{% if stats.isp %}
|
{% if stats.isp %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">ISP:</span>
|
<span class="stat-label-sm">ISP:</span>
|
||||||
@@ -120,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ip-info-section">
|
<div class="ip-info-section">
|
||||||
<h3>Flags & Reputation</h3>
|
<h3>Reputation</h3>
|
||||||
{% set flags = [] %}
|
{% set flags = [] %}
|
||||||
{% if stats.is_proxy %}{% set _ = flags.append('Proxy') %}{% endif %}
|
{% if stats.is_proxy %}{% set _ = flags.append('Proxy') %}{% endif %}
|
||||||
{% if stats.is_hosting %}{% set _ = flags.append('Hosting') %}{% endif %}
|
{% if stats.is_hosting %}{% set _ = flags.append('Hosting') %}{% endif %}
|
||||||
@@ -136,16 +120,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.reputation_score is not none %}
|
{% if stats.reputation_score is not none %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">Reputation:</span>
|
<span class="stat-label-sm">Score:</span>
|
||||||
<span class="stat-value-sm reputation-score {% if stats.reputation_score <= 30 %}bad{% elif stats.reputation_score <= 60 %}medium{% else %}good{% endif %}">
|
<span class="stat-value-sm reputation-score {% if stats.reputation_score <= 30 %}bad{% elif stats.reputation_score <= 60 %}medium{% else %}good{% endif %}">
|
||||||
{{ stats.reputation_score }}/100
|
{{ stats.reputation_score }}/100
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.blocklist_memberships %}
|
{% if stats.blocklist_memberships %}
|
||||||
<div class="stat-row" style="flex-direction: column; align-items: flex-start; gap: 8px;">
|
<div class="stat-row" style="flex-direction: column; align-items: flex-start; gap: 6px;">
|
||||||
<span class="stat-label-sm">Listed On:</span>
|
<span class="stat-label-sm">Listed On:</span>
|
||||||
<div style="display: flex; flex-wrap: wrap; gap: 6px;">
|
<div class="blocklist-badges">
|
||||||
{% for bl in stats.blocklist_memberships %}
|
{% for bl in stats.blocklist_memberships %}
|
||||||
<span class="reputation-badge">{{ bl | e }}</span>
|
<span class="reputation-badge">{{ bl | e }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -184,7 +168,7 @@
|
|||||||
{% if stats.category_history %}
|
{% if stats.category_history %}
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<h2>Behavior Timeline</h2>
|
<h2>Behavior Timeline</h2>
|
||||||
<div class="timeline">
|
<div class="timeline ip-timeline-scroll">
|
||||||
{% for entry in stats.category_history %}
|
{% for entry in stats.category_history %}
|
||||||
<div class="timeline-item">
|
<div class="timeline-item">
|
||||||
<div class="timeline-marker {{ entry.new_category | default('unknown') | replace('_', '-') }}"></div>
|
<div class="timeline-marker {{ entry.new_category | default('unknown') | replace('_', '-') }}"></div>
|
||||||
@@ -240,7 +224,7 @@
|
|||||||
const scores = {{ stats.category_scores | tojson }};
|
const scores = {{ stats.category_scores | tojson }};
|
||||||
const container = document.getElementById('ip-radar-chart');
|
const container = document.getElementById('ip-radar-chart');
|
||||||
if (container && typeof generateRadarChart === 'function') {
|
if (container && typeof generateRadarChart === 'function') {
|
||||||
container.innerHTML = generateRadarChart(scores, 220, true);
|
container.innerHTML = generateRadarChart(scores, 220, true, 'side');
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -48,23 +48,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ip-info-section">
|
<div class="ip-info-section">
|
||||||
<h3>Location</h3>
|
<h3>Geo & Network</h3>
|
||||||
{% if stats.city %}
|
{% if stats.city or stats.country %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">City:</span>
|
<span class="stat-label-sm">Location:</span>
|
||||||
<span class="stat-value-sm">{{ stats.city | e }}</span>
|
<span class="stat-value-sm">{{ stats.city | default('') | e }}{% if stats.city and stats.country %}, {% endif %}{{ stats.country | default(stats.country_code | default('')) | e }}</span>
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if stats.region_name %}
|
|
||||||
<div class="stat-row">
|
|
||||||
<span class="stat-label-sm">Region:</span>
|
|
||||||
<span class="stat-value-sm">{{ stats.region_name | e }}</span>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if stats.country %}
|
|
||||||
<div class="stat-row">
|
|
||||||
<span class="stat-label-sm">Country:</span>
|
|
||||||
<span class="stat-value-sm">{{ stats.country | e }} ({{ stats.country_code | default('') | e }})</span>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.timezone %}
|
{% if stats.timezone %}
|
||||||
@@ -73,10 +61,6 @@
|
|||||||
<span class="stat-value-sm">{{ stats.timezone | e }}</span>
|
<span class="stat-value-sm">{{ stats.timezone | e }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ip-info-section">
|
|
||||||
<h3>Network</h3>
|
|
||||||
{% if stats.isp %}
|
{% if stats.isp %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">ISP:</span>
|
<span class="stat-label-sm">ISP:</span>
|
||||||
@@ -104,7 +88,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ip-info-section">
|
<div class="ip-info-section">
|
||||||
<h3>Flags & Reputation</h3>
|
<h3>Reputation</h3>
|
||||||
{% set flags = [] %}
|
{% set flags = [] %}
|
||||||
{% if stats.is_proxy %}{% set _ = flags.append('Proxy') %}{% endif %}
|
{% if stats.is_proxy %}{% set _ = flags.append('Proxy') %}{% endif %}
|
||||||
{% if stats.is_hosting %}{% set _ = flags.append('Hosting') %}{% endif %}
|
{% if stats.is_hosting %}{% set _ = flags.append('Hosting') %}{% endif %}
|
||||||
@@ -120,16 +104,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.reputation_score is not none %}
|
{% if stats.reputation_score is not none %}
|
||||||
<div class="stat-row">
|
<div class="stat-row">
|
||||||
<span class="stat-label-sm">Reputation:</span>
|
<span class="stat-label-sm">Score:</span>
|
||||||
<span class="stat-value-sm reputation-score {% if stats.reputation_score <= 30 %}bad{% elif stats.reputation_score <= 60 %}medium{% else %}good{% endif %}">
|
<span class="stat-value-sm reputation-score {% if stats.reputation_score <= 30 %}bad{% elif stats.reputation_score <= 60 %}medium{% else %}good{% endif %}">
|
||||||
{{ stats.reputation_score }}/100
|
{{ stats.reputation_score }}/100
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if stats.blocklist_memberships %}
|
{% if stats.blocklist_memberships %}
|
||||||
<div class="stat-row" style="flex-direction: column; align-items: flex-start; gap: 8px;">
|
<div class="stat-row" style="flex-direction: column; align-items: flex-start; gap: 6px;">
|
||||||
<span class="stat-label-sm">Listed On:</span>
|
<span class="stat-label-sm">Listed On:</span>
|
||||||
<div style="display: flex; flex-wrap: wrap; gap: 6px;">
|
<div class="blocklist-badges">
|
||||||
{% for bl in stats.blocklist_memberships %}
|
{% for bl in stats.blocklist_memberships %}
|
||||||
<span class="reputation-badge">{{ bl | e }}</span>
|
<span class="reputation-badge">{{ bl | e }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -163,7 +147,7 @@
|
|||||||
{% if stats.category_history %}
|
{% if stats.category_history %}
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<h2>Behavior Timeline</h2>
|
<h2>Behavior Timeline</h2>
|
||||||
<div class="timeline">
|
<div class="timeline ip-timeline-scroll">
|
||||||
{% for entry in stats.category_history %}
|
{% for entry in stats.category_history %}
|
||||||
<div class="timeline-item">
|
<div class="timeline-item">
|
||||||
<div class="timeline-marker {{ entry.new_category | default('unknown') | replace('_', '-') }}"></div>
|
<div class="timeline-marker {{ entry.new_category | default('unknown') | replace('_', '-') }}"></div>
|
||||||
@@ -208,7 +192,7 @@
|
|||||||
const scores = {{ stats.category_scores | tojson }};
|
const scores = {{ stats.category_scores | tojson }};
|
||||||
const container = document.getElementById('insight-radar-chart');
|
const container = document.getElementById('insight-radar-chart');
|
||||||
if (container && typeof generateRadarChart === 'function') {
|
if (container && typeof generateRadarChart === 'function') {
|
||||||
container.innerHTML = generateRadarChart(scores, 220, true);
|
container.innerHTML = generateRadarChart(scores, 220, true, 'side');
|
||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>ISP / ASN</th>
|
<th>ISP / ASN</th>
|
||||||
<th>Last Seen</th>
|
<th>Last Seen</th>
|
||||||
|
<th style="width: 40px;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
<td>{{ ip.total_requests }}</td>
|
<td>{{ ip.total_requests }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if ip.category %}
|
{% if ip.category %}
|
||||||
<span class="category-badge category-{{ ip.category | default('unknown') | replace(' ', '-') | lower }}">
|
<span class="category-badge category-{{ ip.category | default('unknown') | replace('_', '-') | lower }}">
|
||||||
{{ ip.category | e }}
|
{{ ip.category | e }}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -50,9 +51,14 @@
|
|||||||
<td>{{ ip.city | default('') | e }}{% if ip.city and ip.country_code %}, {% endif %}{{ ip.country_code | default('N/A') | e }}</td>
|
<td>{{ ip.city | default('') | e }}{% if ip.city and ip.country_code %}, {% endif %}{{ ip.country_code | default('N/A') | e }}</td>
|
||||||
<td>{{ ip.isp | default(ip.asn_org | default('N/A')) | e }}</td>
|
<td>{{ ip.isp | default(ip.asn_org | default('N/A')) | e }}</td>
|
||||||
<td>{{ ip.last_seen | format_ts }}</td>
|
<td>{{ ip.last_seen | format_ts }}</td>
|
||||||
|
<td>
|
||||||
|
<button class="inspect-btn" @click="openIpInsight('{{ ip.ip | e }}')" title="Inspect IP">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"/></svg>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="ip-stats-row" style="display: none;">
|
<tr class="ip-stats-row" style="display: none;">
|
||||||
<td colspan="7" class="ip-stats-cell">
|
<td colspan="8" class="ip-stats-cell">
|
||||||
<div class="ip-stats-dropdown">
|
<div class="ip-stats-dropdown">
|
||||||
<div class="loading">Loading stats...</div>
|
<div class="loading">Loading stats...</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
{% for item in items %}
|
{% for item in items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="rank">{{ loop.index + (pagination.page - 1) * pagination.page_size }}</td>
|
<td class="rank">{{ loop.index + (pagination.page - 1) * pagination.page_size }}</td>
|
||||||
<td style="font-size: 11px; word-break: break-all; max-width: 400px;">{{ item.user_agent | e }}</td>
|
<td>{{ item.user_agent | e }}</td>
|
||||||
<td>{{ item.count }}</td>
|
<td>{{ item.count }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@@ -274,14 +274,15 @@ tbody {
|
|||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
.radar-legend {
|
.radar-legend {
|
||||||
margin-top: 10px;
|
margin-top: 0;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.radar-legend-item {
|
.radar-legend-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
margin: 3px 0;
|
margin: 4px 0;
|
||||||
}
|
}
|
||||||
.radar-legend-color {
|
.radar-legend-color {
|
||||||
width: 12px;
|
width: 12px;
|
||||||
@@ -445,6 +446,119 @@ tbody {
|
|||||||
.timeline-marker.bad-crawler { background: #f0883e; }
|
.timeline-marker.bad-crawler { background: #f0883e; }
|
||||||
.timeline-marker.regular-user { background: #58a6ff; }
|
.timeline-marker.regular-user { background: #58a6ff; }
|
||||||
.timeline-marker.unknown { background: #8b949e; }
|
.timeline-marker.unknown { background: #8b949e; }
|
||||||
|
|
||||||
|
/* ── IP Insight Page Layout ─────────────────────── */
|
||||||
|
.ip-insight-content {
|
||||||
|
animation: fadeIn 0.3s ease-in;
|
||||||
|
}
|
||||||
|
.ip-page-header {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
.ip-page-header h1 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 0 0 4px 0;
|
||||||
|
}
|
||||||
|
.ip-address-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #e6edf3;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
.ip-location-subtitle {
|
||||||
|
color: #8b949e;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 4px 0 0 0;
|
||||||
|
}
|
||||||
|
.ip-page-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 3fr 2fr;
|
||||||
|
gap: 20px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
.ip-page-left,
|
||||||
|
.ip-page-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
.ip-info-card h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.ip-info-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
.ip-info-section {
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-right: 1px solid #21262d;
|
||||||
|
}
|
||||||
|
.ip-info-section:last-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.ip-info-section h3 {
|
||||||
|
color: #58a6ff;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
border-bottom: 1px solid #21262d;
|
||||||
|
}
|
||||||
|
.ip-info-section .stat-row {
|
||||||
|
padding: 3px 0;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.blocklist-badges {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 5px;
|
||||||
|
max-height: 120px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.ip-flag {
|
||||||
|
display: inline-block;
|
||||||
|
background: #1c2128;
|
||||||
|
border: 1px solid #30363d;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #f0883e;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
.reputation-score {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.reputation-score.bad { color: #f85149; }
|
||||||
|
.reputation-score.medium { color: #f0883e; }
|
||||||
|
.reputation-score.good { color: #3fb950; }
|
||||||
|
.radar-chart-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
.ip-timeline-scroll {
|
||||||
|
max-height: 280px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.ip-page-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
.ip-info-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
.ip-info-section {
|
||||||
|
border-right: none;
|
||||||
|
border-bottom: 1px solid #21262d;
|
||||||
|
}
|
||||||
|
.ip-info-section:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tabs-container {
|
.tabs-container {
|
||||||
border-bottom: 1px solid #30363d;
|
border-bottom: 1px solid #30363d;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
@@ -1222,6 +1336,27 @@ tbody {
|
|||||||
background: #30363d;
|
background: #30363d;
|
||||||
border-color: #58a6ff;
|
border-color: #58a6ff;
|
||||||
}
|
}
|
||||||
|
.inspect-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 4px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: #8b949e;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: color 0.2s, background 0.2s;
|
||||||
|
}
|
||||||
|
.inspect-btn svg {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
fill: currentColor;
|
||||||
|
}
|
||||||
|
.inspect-btn:hover {
|
||||||
|
color: #58a6ff;
|
||||||
|
background: rgba(88, 166, 255, 0.1);
|
||||||
|
}
|
||||||
.pagination-btn {
|
.pagination-btn {
|
||||||
padding: 6px 14px;
|
padding: 6px 14px;
|
||||||
background: #21262d;
|
background: #21262d;
|
||||||
@@ -1313,12 +1448,15 @@ tbody {
|
|||||||
.search-spinner {
|
.search-spinner {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 14px;
|
right: 14px;
|
||||||
font-size: 18px;
|
width: 16px;
|
||||||
color: #58a6ff;
|
height: 16px;
|
||||||
animation: spin 0.8s linear infinite;
|
padding: 0;
|
||||||
|
border: 2px solid #30363d;
|
||||||
|
border-top-color: #58a6ff;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 0.6s linear infinite;
|
||||||
}
|
}
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
to { transform: rotate(360deg); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -315,8 +315,13 @@ function buildMapMarkers(ips) {
|
|||||||
|
|
||||||
let popupContent = `
|
let popupContent = `
|
||||||
<div style="padding: 12px; min-width: 200px;">
|
<div style="padding: 12px; min-width: 200px;">
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
|
||||||
<strong style="color: #58a6ff; font-size: 14px;">${ip.ip}</strong>
|
<strong style="color: #58a6ff; font-size: 14px;">${ip.ip}</strong>
|
||||||
|
<button onclick="window.openIpInsight('${ip.ip}')" class="inspect-btn" style="display: inline-flex; align-items: center; padding: 4px; background: none; color: #8b949e; border: none; cursor: pointer; border-radius: 4px;" title="Inspect IP">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 8px;">
|
||||||
<span style="background: ${categoryColor}1a; color: ${categoryColor}; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;">
|
<span style="background: ${categoryColor}1a; color: ${categoryColor}; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;">
|
||||||
${categoryLabels[category]}
|
${categoryLabels[category]}
|
||||||
</span>
|
</span>
|
||||||
@@ -340,23 +345,19 @@ function buildMapMarkers(ips) {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add inspect button
|
|
||||||
popupContent += `
|
|
||||||
<div style="margin-top: 12px; border-top: 1px solid #30363d; padding-top: 12px; text-align: center;">
|
|
||||||
<button onclick="window.openIpInsight('${ip.ip}')" class="inspect-btn" style="display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; background: #21262d; color: #58a6ff; border: 1px solid #30363d; border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s;">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
popupContent += '</div>';
|
popupContent += '</div>';
|
||||||
marker.setPopupContent(popupContent);
|
marker.setPopupContent(popupContent);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching IP stats:', err);
|
console.error('Error fetching IP stats:', err);
|
||||||
const errorPopup = `
|
const errorPopup = `
|
||||||
<div style="padding: 12px; min-width: 280px; max-width: 320px;">
|
<div style="padding: 12px; min-width: 280px; max-width: 320px;">
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
|
||||||
<strong style="color: #58a6ff; font-size: 14px;">${ip.ip}</strong>
|
<strong style="color: #58a6ff; font-size: 14px;">${ip.ip}</strong>
|
||||||
|
<button onclick="window.openIpInsight('${ip.ip}')" class="inspect-btn" style="display: inline-flex; align-items: center; padding: 4px; background: none; color: #8b949e; border: none; cursor: pointer; border-radius: 4px;" title="Inspect IP">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 8px;">
|
||||||
<span style="background: ${categoryColor}1a; color: ${categoryColor}; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;">
|
<span style="background: ${categoryColor}1a; color: ${categoryColor}; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;">
|
||||||
${categoryLabels[category]}
|
${categoryLabels[category]}
|
||||||
</span>
|
</span>
|
||||||
@@ -372,11 +373,6 @@ function buildMapMarkers(ips) {
|
|||||||
<div style="margin-top: 12px; border-top: 1px solid #30363d; padding-top: 12px; text-align: center; color: #f85149; font-size: 11px;">
|
<div style="margin-top: 12px; border-top: 1px solid #30363d; padding-top: 12px; text-align: center; color: #f85149; font-size: 11px;">
|
||||||
Failed to load chart: ${err.message}
|
Failed to load chart: ${err.message}
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 12px; text-align: center;">
|
|
||||||
<button onclick="window.openIpInsight('${ip.ip}')" class="inspect-btn" style="display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; background: #21262d; color: #58a6ff; border: 1px solid #30363d; border-radius: 4px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s;">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 16 16" fill="currentColor"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
marker.setPopupContent(errorPopup);
|
marker.setPopupContent(errorPopup);
|
||||||
|
|||||||
@@ -11,11 +11,13 @@
|
|||||||
* @param {Object} categoryScores - Object with keys: attacker, good_crawler, bad_crawler, regular_user, unknown
|
* @param {Object} categoryScores - Object with keys: attacker, good_crawler, bad_crawler, regular_user, unknown
|
||||||
* @param {number} [size=200] - Width/height of the SVG in pixels
|
* @param {number} [size=200] - Width/height of the SVG in pixels
|
||||||
* @param {boolean} [showLegend=true] - Whether to show the legend below the chart
|
* @param {boolean} [showLegend=true] - Whether to show the legend below the chart
|
||||||
|
* @param {string} [legendPosition='below'] - 'below' or 'side' (side = legend to the right of the chart)
|
||||||
* @returns {string} HTML string containing the SVG radar chart
|
* @returns {string} HTML string containing the SVG radar chart
|
||||||
*/
|
*/
|
||||||
function generateRadarChart(categoryScores, size, showLegend) {
|
function generateRadarChart(categoryScores, size, showLegend, legendPosition) {
|
||||||
size = size || 200;
|
size = size || 200;
|
||||||
if (showLegend === undefined) showLegend = true;
|
if (showLegend === undefined) showLegend = true;
|
||||||
|
legendPosition = legendPosition || 'below';
|
||||||
|
|
||||||
if (!categoryScores || Object.keys(categoryScores).length === 0) {
|
if (!categoryScores || Object.keys(categoryScores).length === 0) {
|
||||||
return '<div style="color: #8b949e; text-align: center; padding: 20px;">No category data available</div>';
|
return '<div style="color: #8b949e; text-align: center; padding: 20px;">No category data available</div>';
|
||||||
@@ -55,7 +57,8 @@ function generateRadarChart(categoryScores, size, showLegend) {
|
|||||||
|
|
||||||
const cx = 100, cy = 100, maxRadius = 75;
|
const cx = 100, cy = 100, maxRadius = 75;
|
||||||
|
|
||||||
let html = '<div style="display: flex; flex-direction: column; align-items: center;">';
|
const flexDir = legendPosition === 'side' ? 'row' : 'column';
|
||||||
|
let html = `<div style="display: flex; flex-direction: ${flexDir}; align-items: center; gap: 16px; justify-content: center;">`;
|
||||||
html += `<svg class="radar-chart" viewBox="-30 -30 260 260" preserveAspectRatio="xMidYMid meet" style="width: ${size}px; height: ${size}px;">`;
|
html += `<svg class="radar-chart" viewBox="-30 -30 260 260" preserveAspectRatio="xMidYMid meet" style="width: ${size}px; height: ${size}px;">`;
|
||||||
|
|
||||||
// Draw concentric circles (grid)
|
// Draw concentric circles (grid)
|
||||||
|
|||||||
Reference in New Issue
Block a user