411 lines
17 KiB
HTML
411 lines
17 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>HTTPS Proxy - Admin</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: #1a1a2e;
|
|
color: #e0e0e0;
|
|
min-height: 100vh;
|
|
}
|
|
.header {
|
|
background: #16213e;
|
|
padding: 20px 30px;
|
|
border-bottom: 2px solid #0f3460;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
.header h1 { color: #00d4ff; font-size: 1.5em; }
|
|
.header .badge {
|
|
background: #0f3460;
|
|
color: #00d4ff;
|
|
padding: 5px 15px;
|
|
border-radius: 20px;
|
|
font-size: 0.85em;
|
|
}
|
|
.container { max-width: 1100px; margin: 30px auto; padding: 0 20px; }
|
|
|
|
/* Card style */
|
|
.card {
|
|
background: #16213e;
|
|
border-radius: 10px;
|
|
padding: 25px;
|
|
margin-bottom: 25px;
|
|
border: 1px solid #0f3460;
|
|
}
|
|
.card h2 {
|
|
color: #00d4ff;
|
|
margin-bottom: 20px;
|
|
font-size: 1.2em;
|
|
border-bottom: 1px solid #0f3460;
|
|
padding-bottom: 10px;
|
|
}
|
|
|
|
/* Form styles */
|
|
.form-row {
|
|
display: flex;
|
|
gap: 15px;
|
|
margin-bottom: 15px;
|
|
flex-wrap: wrap;
|
|
}
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
min-width: 150px;
|
|
}
|
|
.form-group label {
|
|
font-size: 0.85em;
|
|
color: #8899aa;
|
|
margin-bottom: 5px;
|
|
}
|
|
input, select {
|
|
background: #1a1a2e;
|
|
border: 1px solid #0f3460;
|
|
color: #e0e0e0;
|
|
padding: 10px 12px;
|
|
border-radius: 6px;
|
|
font-size: 0.95em;
|
|
}
|
|
input:focus, select:focus {
|
|
outline: none;
|
|
border-color: #00d4ff;
|
|
}
|
|
.btn {
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-size: 0.9em;
|
|
font-weight: 600;
|
|
transition: all 0.2s;
|
|
}
|
|
.btn-primary { background: #00d4ff; color: #1a1a2e; }
|
|
.btn-primary:hover { background: #00b8d4; }
|
|
.btn-danger { background: #e74c3c; color: white; }
|
|
.btn-danger:hover { background: #c0392b; }
|
|
.btn-success { background: #2ecc71; color: #1a1a2e; }
|
|
.btn-success:hover { background: #27ae60; }
|
|
.btn-warning { background: #f39c12; color: #1a1a2e; }
|
|
.btn-warning:hover { background: #e67e22; }
|
|
.btn-sm { padding: 6px 12px; font-size: 0.8em; }
|
|
|
|
/* Domain list */
|
|
.domain-list { margin-top: 10px; }
|
|
.domain-entry {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-bottom: 8px;
|
|
align-items: center;
|
|
}
|
|
.domain-entry input { flex: 1; }
|
|
.domain-entry .port-input { width: 100px; flex: none; }
|
|
.remove-domain {
|
|
background: #e74c3c;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 50%;
|
|
width: 28px;
|
|
height: 28px;
|
|
cursor: pointer;
|
|
font-size: 1.1em;
|
|
line-height: 1;
|
|
}
|
|
|
|
/* Target list */
|
|
.target-item {
|
|
background: #1a1a2e;
|
|
border: 1px solid #0f3460;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-bottom: 15px;
|
|
}
|
|
.target-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
}
|
|
.target-name {
|
|
font-size: 1.1em;
|
|
font-weight: 600;
|
|
color: #00d4ff;
|
|
}
|
|
.target-details {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 15px;
|
|
font-size: 0.9em;
|
|
}
|
|
.target-detail {
|
|
background: #16213e;
|
|
padding: 5px 12px;
|
|
border-radius: 5px;
|
|
}
|
|
.target-detail span { color: #8899aa; }
|
|
.status-enabled { color: #2ecc71; }
|
|
.status-disabled { color: #e74c3c; }
|
|
.actions { display: flex; gap: 8px; }
|
|
|
|
/* Collapsible edit form */
|
|
.edit-form {
|
|
display: none;
|
|
margin-top: 15px;
|
|
padding-top: 15px;
|
|
border-top: 1px solid #0f3460;
|
|
}
|
|
.edit-form.active { display: block; }
|
|
|
|
/* API section */
|
|
.api-info {
|
|
background: #1a1a2e;
|
|
padding: 15px;
|
|
border-radius: 6px;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.85em;
|
|
overflow-x: auto;
|
|
}
|
|
.api-info code {
|
|
color: #2ecc71;
|
|
}
|
|
.api-method {
|
|
display: inline-block;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-weight: 600;
|
|
font-size: 0.8em;
|
|
margin-right: 8px;
|
|
}
|
|
.api-get { background: #2ecc71; color: #1a1a2e; }
|
|
.api-post { background: #f39c12; color: #1a1a2e; }
|
|
.api-put { background: #3498db; color: white; }
|
|
.api-delete { background: #e74c3c; color: white; }
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #8899aa;
|
|
}
|
|
.empty-state p { margin-top: 10px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>HTTPS Reverse Proxy</h1>
|
|
<span class="badge">Self-Signed SSL - 100 Jahre</span>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<!-- Add new target -->
|
|
<div class="card">
|
|
<h2>Neues Proxy-Ziel hinzufuegen</h2>
|
|
<form method="POST" action="/target/add" id="addForm">
|
|
<div class="form-row">
|
|
<div class="form-group">
|
|
<label>Name</label>
|
|
<input type="text" name="name" placeholder="z.B. mein-service" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ziel-Host (IP/Hostname)</label>
|
|
<input type="text" name="target_host" placeholder="z.B. 192.168.1.100" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ziel-Port</label>
|
|
<input type="number" name="target_port" value="80" min="1" max="65535">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ziel-Schema</label>
|
|
<select name="target_scheme">
|
|
<option value="http">HTTP</option>
|
|
<option value="https">HTTPS</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group" style="max-width: 200px;">
|
|
<label>Listen-Port (fuer IP-Zugriff)</label>
|
|
<input type="number" name="listen_port" placeholder="z.B. 8080" min="0" max="65535">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Domaenen (optional - fuer Domain-basiertes Routing)</label>
|
|
<div class="domain-list" id="newDomains">
|
|
<div class="domain-entry">
|
|
<input type="text" name="domain_name[]" placeholder="z.B. app.example.local">
|
|
<input type="number" name="domain_port[]" class="port-input" value="443" min="1" max="65535" placeholder="Port">
|
|
<button type="button" class="remove-domain" onclick="this.parentElement.remove()">×</button>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-sm btn-primary" style="margin-top:8px" onclick="addDomainField('newDomains')">+ Domain hinzufuegen</button>
|
|
</div>
|
|
|
|
<div style="margin-top: 20px;">
|
|
<button type="submit" class="btn btn-success">Proxy-Ziel hinzufuegen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Target list -->
|
|
<div class="card">
|
|
<h2>Aktive Proxy-Ziele ({{ config.targets | length }})</h2>
|
|
|
|
{% if config.targets %}
|
|
{% for target in config.targets %}
|
|
<div class="target-item">
|
|
<div class="target-header">
|
|
<div>
|
|
<span class="target-name">{{ target.name }}</span>
|
|
{% if target.enabled %}
|
|
<span class="status-enabled"> ● Aktiv</span>
|
|
{% else %}
|
|
<span class="status-disabled"> ● Deaktiviert</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="actions">
|
|
<button class="btn btn-sm btn-primary" onclick="toggleEdit({{ loop.index0 }})">Bearbeiten</button>
|
|
<form method="POST" action="/target/{{ loop.index0 }}/toggle" style="display:inline">
|
|
<button type="submit" class="btn btn-sm btn-warning">
|
|
{{ "Deaktivieren" if target.enabled else "Aktivieren" }}
|
|
</button>
|
|
</form>
|
|
<form method="POST" action="/target/{{ loop.index0 }}/delete" style="display:inline"
|
|
onsubmit="return confirm('Wirklich loeschen?')">
|
|
<button type="submit" class="btn btn-sm btn-danger">Loeschen</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="target-details">
|
|
<div class="target-detail">
|
|
<span>Ziel:</span> {{ target.target_scheme }}://{{ target.target_host }}:{{ target.target_port }}
|
|
</div>
|
|
{% if target.listen_port %}
|
|
<div class="target-detail">
|
|
<span>Listen-Port:</span> {{ target.listen_port }}
|
|
</div>
|
|
{% endif %}
|
|
{% for d in target.domains %}
|
|
<div class="target-detail">
|
|
<span>Domain:</span> {{ d.domain }}:{{ d.port }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<!-- Edit form -->
|
|
<div class="edit-form" id="edit-{{ loop.index0 }}">
|
|
<form method="POST" action="/target/{{ loop.index0 }}/edit">
|
|
<div class="form-row">
|
|
<div class="form-group">
|
|
<label>Name</label>
|
|
<input type="text" name="name" value="{{ target.name }}" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ziel-Host</label>
|
|
<input type="text" name="target_host" value="{{ target.target_host }}" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ziel-Port</label>
|
|
<input type="number" name="target_port" value="{{ target.target_port }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Schema</label>
|
|
<select name="target_scheme">
|
|
<option value="http" {{ "selected" if target.target_scheme == "http" }}>HTTP</option>
|
|
<option value="https" {{ "selected" if target.target_scheme == "https" }}>HTTPS</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group" style="max-width: 200px;">
|
|
<label>Listen-Port</label>
|
|
<input type="number" name="listen_port" value="{{ target.listen_port or '' }}">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Domaenen</label>
|
|
<div class="domain-list" id="editDomains{{ loop.index0 }}">
|
|
{% for d in target.domains %}
|
|
<div class="domain-entry">
|
|
<input type="text" name="domain_name[]" value="{{ d.domain }}">
|
|
<input type="number" name="domain_port[]" class="port-input" value="{{ d.port }}">
|
|
<button type="button" class="remove-domain" onclick="this.parentElement.remove()">×</button>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<button type="button" class="btn btn-sm btn-primary" style="margin-top:8px"
|
|
onclick="addDomainField('editDomains{{ loop.index0 }}')">+ Domain</button>
|
|
</div>
|
|
<div style="margin-top: 15px;">
|
|
<button type="submit" class="btn btn-success">Speichern</button>
|
|
<button type="button" class="btn btn-sm" style="background:#0f3460;color:#e0e0e0"
|
|
onclick="toggleEdit({{ loop.index0 }})">Abbrechen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<h3>Keine Proxy-Ziele konfiguriert</h3>
|
|
<p>Fuege oben ein neues Ziel hinzu, um den Proxy zu starten.</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- API Documentation -->
|
|
<div class="card">
|
|
<h2>API-Dokumentation</h2>
|
|
<p style="margin-bottom: 15px; color: #8899aa;">
|
|
Alle Endpunkte erfordern HTTP Basic Auth (gleiche Zugangsdaten wie die WebUI).
|
|
</p>
|
|
|
|
<div class="api-info" style="margin-bottom: 10px;">
|
|
<p><span class="api-method api-get">GET</span> <code>/api/targets</code> - Alle Ziele auflisten</p>
|
|
</div>
|
|
<div class="api-info" style="margin-bottom: 10px;">
|
|
<p><span class="api-method api-post">POST</span> <code>/api/targets</code> - Neues Ziel hinzufuegen</p>
|
|
<pre style="margin-top:8px;color:#8899aa">curl -k -u admin:password -X POST https://localhost:8443/api/targets \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"name":"my-app","target_host":"192.168.1.50","target_port":3000,
|
|
"listen_port":9443,"domains":[{"domain":"app.local","port":443}]}'</pre>
|
|
</div>
|
|
<div class="api-info" style="margin-bottom: 10px;">
|
|
<p><span class="api-method api-put">PUT</span> <code>/api/targets/<id></code> - Ziel aktualisieren</p>
|
|
</div>
|
|
<div class="api-info" style="margin-bottom: 10px;">
|
|
<p><span class="api-method api-delete">DELETE</span> <code>/api/targets/<id></code> - Ziel loeschen</p>
|
|
</div>
|
|
<div class="api-info">
|
|
<p><span class="api-method api-post">POST</span> <code>/api/reload</code> - Nginx-Konfiguration neu laden</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function addDomainField(containerId) {
|
|
const container = document.getElementById(containerId);
|
|
const entry = document.createElement('div');
|
|
entry.className = 'domain-entry';
|
|
entry.innerHTML = `
|
|
<input type="text" name="domain_name[]" placeholder="z.B. app.example.local">
|
|
<input type="number" name="domain_port[]" class="port-input" value="443" min="1" max="65535" placeholder="Port">
|
|
<button type="button" class="remove-domain" onclick="this.parentElement.remove()">×</button>
|
|
`;
|
|
container.appendChild(entry);
|
|
}
|
|
|
|
function toggleEdit(idx) {
|
|
const form = document.getElementById('edit-' + idx);
|
|
form.classList.toggle('active');
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|