Bootstrap saved state from ProxiFyre config

This commit is contained in:
2026-07-08 10:34:40 +03:00
parent c5120669d2
commit e745633d91
6 changed files with 364 additions and 25 deletions

View File

@@ -1050,7 +1050,7 @@ export function App() {
<span>{items.length}</span>
</div>
<div className="apps-config-actions">
{renderApplyActions('proxifyre', { showConfigPath: false })}
{renderApplyActions('proxifyre', { showConfigPath: false, showState: false })}
</div>
</div>
@@ -1158,9 +1158,10 @@ export function App() {
function renderApplyActions(
context: 'proxifyre' | 'proxy',
options: { showConfigPath?: boolean } = {},
options: { showConfigPath?: boolean; showState?: boolean } = {},
) {
const showConfigPath = options.showConfigPath ?? true;
const showState = options.showState ?? true;
const externalProxyError = routeMode === 'external' ? safeProxyError(proxyInput) : null;
const readiness = getApplyReadiness({
routeMode,
@@ -1173,15 +1174,18 @@ export function App() {
busy: isApplying || Boolean(serviceAction) || Boolean(singBoxAction),
});
const showBlocker = !readiness.ready && !isLoading && !isDetectingComponents;
const disabledReason = !readiness.ready && readiness.title && readiness.text
? `${readiness.title}. ${readiness.text}`
: undefined;
return (
<>
{showBlocker ? (
{showState && showBlocker ? (
<div className="apply-state blocked" role="status">
<strong>{readiness.title}</strong>
<span>{readiness.text}</span>
</div>
) : hasUnappliedChanges ? (
) : showState && hasUnappliedChanges ? (
<div className="apply-state pending" role="status">
<strong>Изменения еще не применены в ProxiFyre</strong>
<span>{applyStateText(routeMode, isSingBoxInstalled, Boolean(singbox?.running))}</span>
@@ -1197,6 +1201,7 @@ export function App() {
disabled={!readiness.ready}
loading={isApplying}
loadingLabel={applyButtonLabel(context, true, hasUnappliedChanges, singBoxAction)}
title={disabledReason}
>
{applyButtonLabel(context, isApplying, hasUnappliedChanges, singBoxAction)}
</Button>