Files
frps-manager/templates/proxy_form.html
T
Your Name 71214524f4 feat: frps-manager v1.0 - frp 0.70.1 multi-tenant web management system
- Multi-tenant client/proxy management with Flask+SQLite
- Frps server control (start/restart/token rotation)
- Generate frpc.ini with shared server token + admin API
- Dashboard API integration (live client/proxy status)
- RBAC: admin/tenant_admin/user roles
- Audit logging for all operations
- Systemd service files included
- Requires legacy INI format (frp 0.70 TOML auth broken)
2026-08-10 14:17:49 +08:00

67 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ '编辑' if item else '新建' }}代理 · frps-manager{% endblock %}
{% block content %}
<h1>{{ '编辑代理' if item else '新建代理规则' }}</h1>
<form method="post" class="form-card">
{% if item %}
<label>名称 <input value="{{ item.name }}" disabled></label>
<label>类型 <input value="{{ item.type }}" disabled></label>
<label>客户端 <input value="{{ item.client.name }} ({{ item.client.tenant.name }})" disabled></label>
{% else %}
<label>客户端
<select name="client_id" required>
{% for c in clients %}<option value="{{ c.id }}" {% if prefill_client == c.id %}selected{% endif %}>{{ c.name }} ({{ c.tenant.name }})</option>{% endfor %}
</select>
</label>
<label>名称 <input name="name" required pattern="[a-zA-Z0-9_.-]+"></label>
<label>类型
<select name="type" required>
{% for t in types %}<option value="{{ t }}">{{ t }}</option>{% endfor %}
</select>
</label>
{% endif %}
<fieldset>
<legend>本地服务(frpc 那台机器上的)</legend>
<label>本地 IP <input name="local_ip" value="{{ item.local_ip if item else '127.0.0.1' }}"></label>
<label>本地端口 <input name="local_port" type="number" min="1" max="65535" required value="{{ item.local_port if item else '' }}"></label>
</fieldset>
<fieldset>
<legend>对外暴露(frps 上的端口 / 域名)</legend>
<label>远端端口 (tcp/udp 专用) <input name="remote_port" type="number" min="1" max="65535" value="{{ item.remote_port or '' }}"></label>
<label>custom_domains (http/https,逗号分隔) <input name="custom_domains" value="{{ item.custom_domains or '' }}" placeholder="a.example.com,b.example.com"></label>
<label>subdomain (http/https) <input name="subdomain" value="{{ item.subdomain or '' }}"></label>
<label>locations (http 路径,逗号分隔) <input name="locations" value="{{ item.locations or '' }}" placeholder="/api,/static"></label>
</fieldset>
<fieldset>
<legend>传输 / 健康检查</legend>
<label class="checkbox"><input type="checkbox" name="use_encryption" {% if item and item.use_encryption %}checked{% endif %}> 启用加密</label>
<label class="checkbox"><input type="checkbox" name="use_compression" {% if item and item.use_compression %}checked{% endif %}> 启用压缩</label>
<label>健康检查类型
<select name="health_check_type">
<option value="">不启用</option>
<option value="tcp" {% if item and item.health_check_type == 'tcp' %}selected{% endif %}>tcp</option>
<option value="http" {% if item and item.health_check_type == 'http' %}selected{% endif %}>http</option>
</select>
</label>
<label>健康检查 URL (http 类型) <input name="health_check_url" value="{{ item.health_check_url or '' }}" placeholder="/health"></label>
<label>健康检查间隔(秒) <input name="health_check_interval_s" type="number" min="5" value="{{ item.health_check_interval_s if item else 30 }}"></label>
<label>健康检查超时(秒) <input name="health_check_timeout_s" type="number" min="1" value="{{ item.health_check_timeout_s if item else 3 }}"></label>
</fieldset>
<label>备注 <textarea name="note" rows="2">{{ item.note or '' if item else '' }}</textarea></label>
<label class="checkbox"><input type="checkbox" name="is_enabled" {% if item is none or item.is_enabled %}checked{% endif %}> 启用</label>
<p class="muted small">
保存后,frpc 主机的 <code>frpc.ini</code> 需要重新拉取(点客户端列表的 <strong>frpc.ini</strong> 按钮),
然后在 frpc 主机执行 <code>frpc reload -c /etc/frpc.ini</code> 让新代理生效。
</p>
<div class="form-actions">
<button class="btn btn-primary" type="submit">保存</button>
<a class="btn" href="{{ url_for('proxies_list') }}">取消</a>
</div>
</form>
{% endblock %}