临时提交

This commit is contained in:
fengfeng 2026-02-02 12:04:37 +08:00
parent a81869c96d
commit 9635b00e07
2 changed files with 16 additions and 3 deletions

View File

@ -53,7 +53,7 @@ function getFirstAvailableId(ids: number[]) : number {
}
function generateNodeData(nodes : NodeData[]) : NodeData | null {
const hostId = getFirstAvailableId(nodes.map(n => n.hostId))
const hostId = getFirstAvailableId(nodes.filter(n => n.groupId == 0).map(n => n.hostId))
if(hostId > 255) return null
const privateKey = generateWireGuardPrivateKey();

View File

@ -1,5 +1,6 @@
import { useState, ReactNode } from 'react';
import { NodeData, Settings } from '../types/graph';
import { generateWireGuardPrivateKey } from '../utils/wireguardConfig'
import './NodeEditor.css';
@ -39,6 +40,10 @@ export default function NodeEditor({
// onClose();
};
const handleGenerateKey = (): void => {
handleInputChange('privateKey', generateWireGuardPrivateKey())
}
return (
<div className="node-editor-overlay">
<div className="node-editor">
@ -70,12 +75,20 @@ export default function NodeEditor({
<div className="item-group">
<input
value={formData.privateKey || ''}
onChange={(e) => handleInputChange('privateKey', e.target.value)}
readOnly
/>
<button className="btn-interect"></button>
<button className="btn-interect" onClick={handleGenerateKey}></button>
</div>
</div>
<div className="form-group">
<label>ID</label>
<input
type="text"
value={formData.hostId || ''}
onChange={(e) => handleInputChange('hostId', e.target.value)}
placeholder="将用作为虚拟地址的最后一位。同一子网下主机ID不能重复不得超过255"
/>
</div>
<div className="form-group">