feat: add skip next checks if sb is not running

This commit is contained in:
divocat
2025-10-15 21:24:56 +03:00
parent c0b35c865d
commit d8b7e12c4d
5 changed files with 14 additions and 3 deletions

View File

@@ -80,4 +80,6 @@ export const PodkopShellMethods = {
callBaseMethod<unknown>(Podkop.AvailableMethods.SHOW_SING_BOX_CONFIG),
checkLogs: async () =>
callBaseMethod<unknown>(Podkop.AvailableMethods.CHECK_LOGS),
getSystemInfo: async () =>
callBaseMethod<unknown>(Podkop.AvailableMethods.GET_SYSTEM_INFO),
};

View File

@@ -101,7 +101,7 @@ export async function runSingBoxCheck() {
],
});
if (!atLeastOneGood) {
if (!atLeastOneGood || !data.sing_box_process_running) {
throw new Error('Sing-box checks failed');
}
}

View File

@@ -68,6 +68,7 @@ async function handleRestart() {
restart: { loading: false },
},
});
store.reset(['diagnosticsChecks']);
}, 5000);
}
}
@@ -93,6 +94,7 @@ async function handleStop() {
stop: { loading: false },
},
});
store.reset(['diagnosticsChecks']);
}
}
@@ -118,6 +120,7 @@ async function handleStart() {
start: { loading: false },
},
});
store.reset(['diagnosticsChecks']);
}, 5000);
}
}

View File

@@ -67,6 +67,7 @@ export namespace Podkop {
GLOBAL_CHECK = 'global_check',
SHOW_SING_BOX_CONFIG = 'show_sing_box_config',
CHECK_LOGS = 'check_logs',
GET_SYSTEM_INFO = 'get_system_info',
}
export enum AvailableClashAPIMethods {

View File

@@ -449,6 +449,7 @@ var Podkop;
AvailableMethods2["GLOBAL_CHECK"] = "global_check";
AvailableMethods2["SHOW_SING_BOX_CONFIG"] = "show_sing_box_config";
AvailableMethods2["CHECK_LOGS"] = "check_logs";
AvailableMethods2["GET_SYSTEM_INFO"] = "get_system_info";
})(AvailableMethods = Podkop2.AvailableMethods || (Podkop2.AvailableMethods = {}));
let AvailableClashAPIMethods;
((AvailableClashAPIMethods2) => {
@@ -520,7 +521,8 @@ var PodkopShellMethods = {
),
globalCheck: async () => callBaseMethod(Podkop.AvailableMethods.GLOBAL_CHECK),
showSingBoxConfig: async () => callBaseMethod(Podkop.AvailableMethods.SHOW_SING_BOX_CONFIG),
checkLogs: async () => callBaseMethod(Podkop.AvailableMethods.CHECK_LOGS)
checkLogs: async () => callBaseMethod(Podkop.AvailableMethods.CHECK_LOGS),
getSystemInfo: async () => callBaseMethod(Podkop.AvailableMethods.GET_SYSTEM_INFO)
};
// src/podkop/methods/custom/getDashboardSections.ts
@@ -2172,7 +2174,7 @@ async function runSingBoxCheck() {
}
]
});
if (!atLeastOneGood) {
if (!atLeastOneGood || !data.sing_box_process_running) {
throw new Error("Sing-box checks failed");
}
}
@@ -3244,6 +3246,7 @@ async function handleRestart() {
restart: { loading: false }
}
});
store.reset(["diagnosticsChecks"]);
}, 5e3);
}
}
@@ -3267,6 +3270,7 @@ async function handleStop() {
stop: { loading: false }
}
});
store.reset(["diagnosticsChecks"]);
}
}
async function handleStart() {
@@ -3290,6 +3294,7 @@ async function handleStart() {
start: { loading: false }
}
});
store.reset(["diagnosticsChecks"]);
}, 5e3);
}
}