Use minimal single-column layout for all finger results
Unify the interactive /finger page on the same results-first layout introduced for direct /finger/<user> links: drop the two-column view (About Finger panel, success banner, timestamp, back-to-home button) and the now-unused direct flag.
This commit is contained in:
@@ -167,7 +167,7 @@ def finger_direct(username):
|
|||||||
else:
|
else:
|
||||||
error = output
|
error = output
|
||||||
|
|
||||||
return render_template('finger.html', title=f'Finger - {username}', result=result, error=error, username=username, direct=True)
|
return render_template('finger.html', title=f'Finger - {username}', result=result, error=error, username=username)
|
||||||
|
|
||||||
@app.route('/api/finger')
|
@app.route('/api/finger')
|
||||||
@app.route('/api/finger/<path:username>')
|
@app.route('/api/finger/<path:username>')
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if direct %}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-10 mx-auto">
|
<div class="col-lg-10 mx-auto">
|
||||||
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
|
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
|
||||||
@@ -49,106 +48,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-10 mx-auto">
|
|
||||||
<h1 class="mb-4">🔍 Finger Command</h1>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">User Lookup</h5>
|
|
||||||
<form method="POST" action="{{ url_for('finger') }}">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="username" class="form-label">Username (optional)</label>
|
|
||||||
<input type="text" class="form-control" id="username" name="username"
|
|
||||||
value="{{ username or '' }}"
|
|
||||||
placeholder="Enter username or email (e.g., [email protected])"
|
|
||||||
pattern="[a-zA-Z0-9.\-_@]*"
|
|
||||||
title="Alphanumeric characters, dots, hyphens, underscores, and @ symbol allowed">
|
|
||||||
<div class="form-text">
|
|
||||||
Leave empty to show all logged-in users, or enter a username or email address.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-search"></i> Run Finger
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-outline-secondary ms-2" onclick="clearForm()">
|
|
||||||
Clear
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-body">
|
|
||||||
<h6 class="card-title">ℹ️ About Finger</h6>
|
|
||||||
<p class="card-text small">
|
|
||||||
The finger command displays information about users on the system, including:
|
|
||||||
</p>
|
|
||||||
<ul class="small">
|
|
||||||
<li>Login name and real name</li>
|
|
||||||
<li>Terminal and login time</li>
|
|
||||||
<li>Idle time</li>
|
|
||||||
<li>Home directory and shell</li>
|
|
||||||
<li>Plan and project files (if available)</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-8">
|
|
||||||
<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>
|
|
||||||
{% if result or error %}
|
|
||||||
<small class="text-muted">
|
|
||||||
{{ moment().format('YYYY-MM-DD HH:mm:ss') if moment else '' }}
|
|
||||||
</small>
|
|
||||||
{% endif %}
|
|
||||||
</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="alert alert-success mb-3" role="alert">
|
|
||||||
<i class="fas fa-check-circle"></i>
|
|
||||||
Command executed successfully
|
|
||||||
</div>
|
|
||||||
<div class="finger-output">
|
|
||||||
<pre class="rounded"><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>Enter a username and click "Run Finger" to see user information,<br>
|
|
||||||
or leave username empty to see all logged-in users.</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-center mt-4">
|
|
||||||
<a href="{{ url_for('index') }}" class="btn btn-outline-primary">
|
|
||||||
<i class="fas fa-home"></i> Back to Home
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
@@ -156,12 +55,5 @@ function clearForm() {
|
|||||||
// Optionally reload the page to clear results
|
// Optionally reload the page to clear results
|
||||||
window.location.href = "{{ url_for('finger') }}";
|
window.location.href = "{{ url_for('finger') }}";
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if not direct %}
|
|
||||||
// Auto-focus on username input when page loads
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
document.getElementById('username').focus();
|
|
||||||
});
|
|
||||||
{% endif %}
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user