Build and Push Docker Image / build-and-push (push) Failing after 2m19s
The search form POSTed to /finger, an uncacheable URL with no search term in it, so every lookup re-ran the finger command even for repeated searches of the same user. Redirect any query/POST search to the canonical /finger/<username> path (and submit the form via GET, with a JS fast-path straight to that URL) so repeated lookups are served from the nginx response cache. A bare /finger with no user still lists local system users.
73 lines
3.0 KiB
HTML
73 lines
3.0 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="row">
|
|
<div class="col-lg-10 mx-auto">
|
|
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
|
|
<h1 class="h5 mb-0">🔍 Finger Command</h1>
|
|
<!-- GET so the search lands on a cacheable URL; JS sends it straight
|
|
to /finger/<term>, and without JS the server redirects there. -->
|
|
<form method="GET" action="{{ url_for('finger') }}" class="d-flex" role="search"
|
|
onsubmit="return gotoFinger(event)">
|
|
<input type="text" class="form-control form-control-sm me-2" id="username" name="username"
|
|
value="{{ username or '' }}"
|
|
placeholder="[email protected]"
|
|
pattern="[a-zA-Z0-9.\-_@]*"
|
|
title="Alphanumeric characters, dots, hyphens, underscores, and @ symbol allowed"
|
|
style="max-width: 260px;">
|
|
<button type="submit" class="btn btn-sm btn-primary">
|
|
<i class="fas fa-search"></i> Finger
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0">
|
|
{% if username %}
|
|
Results for "{{ username }}"
|
|
{% else %}
|
|
System Users
|
|
{% endif %}
|
|
</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
{% if error %}
|
|
<div class="alert alert-danger" role="alert">
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
<strong>Error:</strong> {{ error }}
|
|
</div>
|
|
{% elif result %}
|
|
<div class="finger-output">
|
|
<pre class="rounded mb-0"><code>{{ result }}</code></pre>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-center text-muted py-5">
|
|
<i class="fas fa-terminal fa-3x mb-3"></i>
|
|
<p>No information available.</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Navigate straight to the cacheable /finger/<term> path so the nginx response
|
|
// cache is hit for repeated lookups (avoids a redirect round-trip).
|
|
function gotoFinger(event) {
|
|
var term = document.getElementById('username').value.trim();
|
|
if (!term) { return true; } // empty -> let GET /finger list system users
|
|
event.preventDefault();
|
|
window.location.href = "{{ url_for('finger') }}/" + encodeURIComponent(term);
|
|
return false;
|
|
}
|
|
|
|
function clearForm() {
|
|
document.getElementById('username').value = '';
|
|
// Optionally reload the page to clear results
|
|
window.location.href = "{{ url_for('finger') }}";
|
|
}
|
|
</script>
|
|
{% endblock %}
|