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 [testResult, setTestResult] = useState<ProbeResult | null>(null);
|
||||||
const [agentToken, setAgentToken] = useState<string | null>(null);
|
const [agentToken, setAgentToken] = useState<string | null>(null);
|
||||||
const [agentNodeName, setAgentNodeName] = useState('');
|
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('');
|
const [agentMasterUrl, setAgentMasterUrl] = useState('');
|
||||||
// Edit mode (item 19): the stored install material for an existing agent
|
// Edit mode (item 19): the stored install material for an existing agent
|
||||||
// node, fetched from the master; null until loaded / for non-agent nodes.
|
// 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 inboundSyncMode = useWatch({ control: methods.control, name: 'inboundSyncMode' }) ?? 'all';
|
||||||
const nodeType = useWatch({ control: methods.control, name: 'nodeType' }) ?? 'traditional';
|
const nodeType = useWatch({ control: methods.control, name: 'nodeType' }) ?? 'traditional';
|
||||||
const isAgent = nodeType === 'agent';
|
const isAgent = nodeType === 'agent';
|
||||||
const probeOnly = useWatch({ control: methods.control, name: 'probeOnly' }) ?? false;
|
|
||||||
const { data: outboundGroups } = useOutboundTagGroups({ excludeBlackhole: true });
|
const { data: outboundGroups } = useOutboundTagGroups({ excludeBlackhole: true });
|
||||||
|
|
||||||
// Outbounds and balancers share one picker (like the panel-outbound selector);
|
// Outbounds and balancers share one picker (like the panel-outbound selector);
|
||||||
@@ -186,10 +182,13 @@ export default function NodeFormModal({
|
|||||||
const cmd = shownInstall.hasToken
|
const cmd = shownInstall.hasToken
|
||||||
? `${base} --token ${shownInstall.token} --name ${shownInstall.name}`
|
? `${base} --token ${shownInstall.token} --name ${shownInstall.name}`
|
||||||
: `${base} --name ${shownInstall.name}`;
|
: `${base} --name ${shownInstall.name}`;
|
||||||
// The toggle is the source of truth for the re-displayed command:
|
// The command never carries --probe-only: an agent.json preset would
|
||||||
// flipping it rewrites the command the operator would re-run.
|
// pin probe-only on the machine (dual-source OR gate) and the panel
|
||||||
return probeOnly ? `${cmd} --probe-only` : cmd;
|
// toggle alone could no longer turn it off. Probe-only is governed
|
||||||
}, [shownInstall, editMasterUrl, probeOnly]);
|
// 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(
|
const title = useMemo(
|
||||||
() => (mode === 'edit' ? t('pages.nodes.editNode') : t('pages.nodes.addNode')),
|
() => (mode === 'edit' ? t('pages.nodes.editNode') : t('pages.nodes.addNode')),
|
||||||
@@ -307,7 +306,6 @@ export default function NodeFormModal({
|
|||||||
if (agentMode && mode === 'add' && obj?.agentToken) {
|
if (agentMode && mode === 'add' && obj?.agentToken) {
|
||||||
setAgentToken(obj.agentToken);
|
setAgentToken(obj.agentToken);
|
||||||
setAgentNodeName(result.data.name.trim());
|
setAgentNodeName(result.data.name.trim());
|
||||||
setAgentProbeOnly(result.data.probeOnly ?? false);
|
|
||||||
// Default the master URL to the address this panel is being
|
// Default the master URL to the address this panel is being
|
||||||
// viewed through — origin AND base path. Dropping the base
|
// viewed through — origin AND base path. Dropping the base
|
||||||
// path made the agent's registration 404. User can edit it.
|
// 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
|
// one would produce a command that can never register, so withhold it
|
||||||
// (and say why) instead of letting the user copy a dead command.
|
// (and say why) instead of letting the user copy a dead command.
|
||||||
const installCmd = agentMasterUrl
|
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 (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user