Add order history, live proxy test, SQLite rate limiter (cross-worker + real client IP)
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
<button onclick="copy(this.previousElementSibling)">Copy</button>
|
||||
</div>
|
||||
<p class="muted" style="font-size:12px;margin-bottom:0">Proxy password is unique to you. Use it for proxy auth, not your web password.</p>
|
||||
<button class="btn btn-ghost" id="testbtn" onclick="testProxy()" style="margin-top:12px">⚡ Test my proxy</button>
|
||||
<pre class="code" id="testout" style="display:none;margin-top:10px"></pre>
|
||||
<form method="post" action="/dashboard/rotate" style="margin-top:14px">
|
||||
<input type="submit" value="Rotate proxy password">
|
||||
</form>
|
||||
@@ -84,7 +86,43 @@
|
||||
<p class="muted" style="margin-top:18px">No dedicated IPs yet — <a href="/dedicated">order one</a>.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if orders %}
|
||||
<div class="card" style="margin-top:18px">
|
||||
<h3>Order history</h3>
|
||||
<table style="width:100%;font-size:13px;border-collapse:collapse">
|
||||
<tr style="color:var(--muted);text-align:left"><th>Plan</th><th>GB</th><th>sats</th><th>Status</th></tr>
|
||||
{% for o in orders %}
|
||||
<tr style="border-top:1px solid var(--border)">
|
||||
<td style="padding:4px">{{ o.plan_name or '—' }}</td>
|
||||
<td>{{ o.plan_gb or '—' }}</td>
|
||||
<td>{{ o.amount_sats }}</td>
|
||||
<td style="color:{{ 'var(--ok)' if o.status=='paid' else 'var(--warn)' }}">{{ o.status }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
function copy(el){ el.select(); document.execCommand('copy'); }
|
||||
async function testProxy(){
|
||||
const btn = document.getElementById('testbtn');
|
||||
const out = document.getElementById('testout');
|
||||
btn.textContent = 'Testing…';
|
||||
out.style.display = 'block';
|
||||
out.textContent = '…';
|
||||
try {
|
||||
const r = await fetch('/dashboard/test');
|
||||
const j = await r.json();
|
||||
if (j.status === 'success') {
|
||||
out.textContent = 'egress ' + j.query + '\n' + j.country + ' · ' + j.city + ' · ' + j.isp;
|
||||
} else {
|
||||
out.textContent = 'proxy error: ' + (j.message || j.status);
|
||||
}
|
||||
} catch(e) {
|
||||
out.textContent = 'error: ' + e;
|
||||
}
|
||||
btn.textContent = '⚡ Test my proxy';
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user