feat(nodes): Add insecure TLS option for external nodes

This commit is contained in:
ReturnFI
2025-10-23 11:07:50 +00:00
parent a9309920c4
commit 8cfed0f1b4
7 changed files with 44 additions and 33 deletions

View File

@ -286,6 +286,7 @@ $(document).ready(function () {
<td>${escapeHtml(node.port || 'N/A')}</td>
<td>${escapeHtml(node.sni || 'N/A')}</td>
<td>${escapeHtml(node.obfs || 'N/A')}</td>
<td>${escapeHtml(node.insecure ? 'True' : 'False')}</td>
<td>${escapeHtml(node.pinSHA256 || 'N/A')}</td>
<td>
<button class="btn btn-xs btn-danger delete-node-btn" data-name="${escapeHtml(node.name)}">
@ -310,8 +311,9 @@ $(document).ready(function () {
const sni = $("#node_sni").val().trim();
const obfs = $("#node_obfs").val().trim();
const pinSHA256 = $("#node_pin").val().trim();
const insecure = $("#node_insecure").is(':checked');
const data = { name: name, ip: ip };
const data = { name: name, ip: ip, insecure: insecure };
if (port) data.port = parseInt(port);
if (sni) data.sni = sni;
if (obfs) data.obfs = obfs;
@ -326,12 +328,7 @@ $(document).ready(function () {
"#add_node_btn",
false,
function() {
$("#node_name").val('');
$("#node_ip").val('');
$("#node_port").val('');
$("#node_sni").val('');
$("#node_obfs").val('');
$("#node_pin").val('');
$("#add_node_form")[0].reset();
$("#add_node_form .form-control").removeClass('is-invalid');
fetchNodes();
}

View File

@ -90,7 +90,7 @@ async def add_node(body: AddNodeBody):
Adds a new external node to the configuration.
Args:
body: Request body containing the name and IP of the node.
body: Request body containing the full details of the node.
"""
try:
cli_api.add_node(
@ -99,7 +99,8 @@ async def add_node(body: AddNodeBody):
port=body.port,
sni=body.sni,
pinSHA256=body.pinSHA256,
obfs=body.obfs
obfs=body.obfs,
insecure=body.insecure
)
return DetailResponse(detail=f"Node '{body.name}' added successfully.")
except Exception as e:

View File

@ -39,6 +39,7 @@ class Node(BaseModel):
sni: Optional[str] = None
pinSHA256: Optional[str] = None
obfs: Optional[str] = None
insecure: Optional[bool] = False
@field_validator('ip', mode='before')
def check_node_ip(cls, v: str | None):

View File

@ -228,6 +228,7 @@
<th>Port</th>
<th>SNI</th>
<th>OBFS</th>
<th>Insecure</th>
<th>Pin SHA256</th>
<th>Action</th>
</tr>
@ -276,6 +277,14 @@
<input type="text" class="form-control" id="node_pin" placeholder="5D:23:0E:E9:10:AB:96:E0:43...">
<div class="invalid-feedback">Invalid SHA256 pin format.</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="node_insecure">
<label class="form-check-label" for="node_insecure">
Insecure
</label>
</div>
</div>
<button type="button" id="add_node_btn" class="btn btn-success">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none;"></span>
Add Node