c680fea8e0
- New: services/proxy_service.py (path->URL mapping) - New: services/web_panel/routes/proxy.py (3 REST endpoints) - New: static/web_panel/pages/proxy.html (WebUI) - Tests: 28/28 passing
19 lines
1.7 KiB
HTML
19 lines
1.7 KiB
HTML
<!DOCTYPE html><html lang="zh"><head><meta charset="UTF-8"><title>反向代理 - SenSu</title>
|
|
<style>body{font-family:monospace;background:#0e1416;color:#e0e3e4;margin:0;padding:16px}
|
|
h2{color:#00bcd4;border-bottom:1px solid #333;padding-bottom:8px}
|
|
.card{background:#1a1f21;border-radius:8px;padding:12px;margin:8px 0}
|
|
input,button{padding:6px 10px;margin:4px;border-radius:4px;border:1px solid #444;background:#222;color:#e0e3e4}
|
|
button{background:#00bcd4;color:#000;cursor:pointer;font-weight:bold}
|
|
button.danger{background:#ff5252}.status-active{color:#4caf50}
|
|
</style></head><body>
|
|
<h2>🔀 反向代理</h2>
|
|
<div class="card"><h3>添加代理</h3>
|
|
<input id="px-path" placeholder="路径 (如: /app)" style="width:200px"><br>
|
|
<input id="px-target" placeholder="目标 (如: http://192.168.1.5:8080)" style="width:400px"><br>
|
|
<input id="px-desc" placeholder="描述" style="width:300px"><br>
|
|
<button onclick="add()">添加</button></div>
|
|
<div id="list">加载中...</div>
|
|
<script>
|
|
async function r(){const d=await(await fetch("/SenSu/api/proxy")).json();let h="";for(const p of d.proxies||[]){h+=`<div class="card"><b>${p.path}</b> <span class="status-active">● ${p.status}</span><br>→ ${p.target} ${p.description||""}<button class="danger" onclick="del('${p.path}')">删除</button></div>`}document.getElementById("list").innerHTML=h||"暂无代理"}
|
|
async function add(){await fetch("/SenSu/api/proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:document.getElementById("px-path").value,target:document.getElementById("px-target").value,description:document.getElementById("px-desc").value})});r()}
|
|
async function del(p){await fetch(`/SenSu/api/proxy/${encodeURIComponent(p)}`,{method:"DELETE"});r()}r()</script></body></html> |