panel: install commands no longer append --probe-only
Probe-only is governed solely by the master-side flag so unchecking it in the panel takes effect on its own; an agent.json preset would pin it via the dual-source OR gate. The install-agent.sh/ps1 --probe-only flag stays for manual installs. tsc --noEmit clean.
This commit is contained in:
@@ -84,9 +84,6 @@ export default function NodeFormModal({
|
||||
const [testResult, setTestResult] = useState<ProbeResult | null>(null);
|
||||
const [agentToken, setAgentToken] = useState<string | null>(null);
|
||||
const [agentNodeName, setAgentNodeName] = useState('');
|
||||
// Whether the just-created agent node was flagged probe-only, so the
|
||||
// install command below can carry the matching --probe-only flag.
|
||||
const [agentProbeOnly, setAgentProbeOnly] = useState(false);
|
||||
const [agentMasterUrl, setAgentMasterUrl] = useState('');
|
||||
// Edit mode (item 19): the stored install material for an existing agent
|
||||
// node, fetched from the master; null until loaded / for non-agent nodes.
|
||||
@@ -104,7 +101,6 @@ export default function NodeFormModal({
|
||||
const inboundSyncMode = useWatch({ control: methods.control, name: 'inboundSyncMode' }) ?? 'all';
|
||||
const nodeType = useWatch({ control: methods.control, name: 'nodeType' }) ?? 'traditional';
|
||||
const isAgent = nodeType === 'agent';
|
||||
const probeOnly = useWatch({ control: methods.control, name: 'probeOnly' }) ?? false;
|
||||
const { data: outboundGroups } = useOutboundTagGroups({ excludeBlackhole: true });
|
||||
|
||||
// Outbounds and balancers share one picker (like the panel-outbound selector);
|
||||
@@ -186,10 +182,13 @@ export default function NodeFormModal({
|
||||
const cmd = shownInstall.hasToken
|
||||
? `${base} --token ${shownInstall.token} --name ${shownInstall.name}`
|
||||
: `${base} --name ${shownInstall.name}`;
|
||||
// The toggle is the source of truth for the re-displayed command:
|
||||
// flipping it rewrites the command the operator would re-run.
|
||||
return probeOnly ? `${cmd} --probe-only` : cmd;
|
||||
}, [shownInstall, editMasterUrl, probeOnly]);
|
||||
// The command never carries --probe-only: an agent.json preset would
|
||||
// pin probe-only on the machine (dual-source OR gate) and the panel
|
||||
// toggle alone could no longer turn it off. Probe-only is governed
|
||||
// solely by the master-side flag; the script flag stays for manual
|
||||
// installs that deliberately want the preset.
|
||||
return cmd;
|
||||
}, [shownInstall, editMasterUrl]);
|
||||
|
||||
const title = useMemo(
|
||||
() => (mode === 'edit' ? t('pages.nodes.editNode') : t('pages.nodes.addNode')),
|
||||
@@ -307,7 +306,6 @@ export default function NodeFormModal({
|
||||
if (agentMode && mode === 'add' && obj?.agentToken) {
|
||||
setAgentToken(obj.agentToken);
|
||||
setAgentNodeName(result.data.name.trim());
|
||||
setAgentProbeOnly(result.data.probeOnly ?? false);
|
||||
// Default the master URL to the address this panel is being
|
||||
// viewed through — origin AND base path. Dropping the base
|
||||
// path made the agent's registration 404. User can edit it.
|
||||
@@ -330,7 +328,7 @@ export default function NodeFormModal({
|
||||
// one would produce a command that can never register, so withhold it
|
||||
// (and say why) instead of letting the user copy a dead command.
|
||||
const installCmd = agentMasterUrl
|
||||
? `bash <(curl -fL https://git.881218.xyz/rogue/3x-ui-agent/raw/branch/main/install-agent.sh) --master ${agentMasterUrl} --token ${agentToken ?? ''} --name ${agentNodeName}${agentProbeOnly ? ' --probe-only' : ''}`
|
||||
? `bash <(curl -fL https://git.881218.xyz/rogue/3x-ui-agent/raw/branch/main/install-agent.sh) --master ${agentMasterUrl} --token ${agentToken ?? ''} --name ${agentNodeName}`
|
||||
: '';
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user