feat: add toast when shell exec failed

This commit is contained in:
divocat
2025-10-23 19:08:27 +03:00
parent 9f8f032dce
commit 13d27dab21
7 changed files with 114 additions and 34 deletions

View File

@@ -508,6 +508,18 @@
"src/helpers/copyToClipboard.ts:12" "src/helpers/copyToClipboard.ts:12"
] ]
}, },
{
"call": "Failed to execute!",
"key": "Failed to execute!",
"places": [
"src/podkop/tabs/diagnostic/initController.ts:225",
"src/podkop/tabs/diagnostic/initController.ts:229",
"src/podkop/tabs/diagnostic/initController.ts:259",
"src/podkop/tabs/diagnostic/initController.ts:263",
"src/podkop/tabs/diagnostic/initController.ts:297",
"src/podkop/tabs/diagnostic/initController.ts:301"
]
},
{ {
"call": "Fastest", "call": "Fastest",
"key": "Fastest", "key": "Fastest",
@@ -533,7 +545,7 @@
"call": "Global check", "call": "Global check",
"key": "Global check", "key": "Global check",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:218" "src/podkop/tabs/diagnostic/initController.ts:220"
] ]
}, },
{ {
@@ -786,7 +798,7 @@
"call": "Latest", "call": "Latest",
"key": "Latest", "key": "Latest",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:404" "src/podkop/tabs/diagnostic/initController.ts:427"
] ]
}, },
{ {
@@ -901,7 +913,7 @@
"call": "Outdated", "call": "Outdated",
"key": "Outdated", "key": "Outdated",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:394" "src/podkop/tabs/diagnostic/initController.ts:417"
] ]
}, },
{ {
@@ -1227,7 +1239,7 @@
"call": "Show sing-box config", "call": "Show sing-box config",
"key": "Show sing-box config", "key": "Show sing-box config",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:278", "src/podkop/tabs/diagnostic/initController.ts:288",
"src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116" "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116"
] ]
}, },
@@ -1447,13 +1459,13 @@
"call": "unknown", "call": "unknown",
"key": "unknown", "key": "unknown",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:34",
"src/podkop/tabs/diagnostic/initController.ts:35",
"src/podkop/tabs/diagnostic/initController.ts:36", "src/podkop/tabs/diagnostic/initController.ts:36",
"src/podkop/tabs/diagnostic/initController.ts:37", "src/podkop/tabs/diagnostic/initController.ts:37",
"src/podkop/tabs/diagnostic/initController.ts:38", "src/podkop/tabs/diagnostic/initController.ts:38",
"src/podkop/tabs/diagnostic/initController.ts:39", "src/podkop/tabs/diagnostic/initController.ts:39",
"src/podkop/tabs/diagnostic/initController.ts:373" "src/podkop/tabs/diagnostic/initController.ts:40",
"src/podkop/tabs/diagnostic/initController.ts:41",
"src/podkop/tabs/diagnostic/initController.ts:391"
] ]
}, },
{ {
@@ -1572,7 +1584,7 @@
"call": "View logs", "call": "View logs",
"key": "View logs", "key": "View logs",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:248", "src/podkop/tabs/diagnostic/initController.ts:254",
"src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107" "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107"
] ]
}, },

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 15:55+0300\n" "POT-Creation-Date: 2025-10-23 16:08+0300\n"
"PO-Revision-Date: 2025-10-23 15:55+0300\n" "PO-Revision-Date: 2025-10-23 16:08+0300\n"
"Last-Translator: divocat <divocatt@gmail.com>\n" "Last-Translator: divocat <divocatt@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
@@ -312,6 +312,15 @@ msgstr ""
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:225
#: src/podkop/tabs/diagnostic/initController.ts:229
#: src/podkop/tabs/diagnostic/initController.ts:259
#: src/podkop/tabs/diagnostic/initController.ts:263
#: src/podkop/tabs/diagnostic/initController.ts:297
#: src/podkop/tabs/diagnostic/initController.ts:301
msgid "Failed to execute!"
msgstr ""
#: src/podkop/methods/custom/getDashboardSections.ts:117 #: src/podkop/methods/custom/getDashboardSections.ts:117
msgid "Fastest" msgid "Fastest"
msgstr "" msgstr ""
@@ -324,7 +333,7 @@ msgstr ""
msgid "Get global check" msgid "Get global check"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:218 #: src/podkop/tabs/diagnostic/initController.ts:220
msgid "Global check" msgid "Global check"
msgstr "" msgstr ""
@@ -469,7 +478,7 @@ msgstr ""
msgid "IP address 0.0.0.0 is not allowed" msgid "IP address 0.0.0.0 is not allowed"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:404 #: src/podkop/tabs/diagnostic/initController.ts:427
msgid "Latest" msgid "Latest"
msgstr "" msgstr ""
@@ -536,7 +545,7 @@ msgstr ""
msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:394 #: src/podkop/tabs/diagnostic/initController.ts:417
msgid "Outdated" msgid "Outdated"
msgstr "" msgstr ""
@@ -724,7 +733,7 @@ msgstr ""
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:278 #: src/podkop/tabs/diagnostic/initController.ts:288
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116
msgid "Show sing-box config" msgid "Show sing-box config"
msgstr "" msgstr ""
@@ -851,13 +860,13 @@ msgstr ""
msgid "UDP over TCP" msgid "UDP over TCP"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:34
#: src/podkop/tabs/diagnostic/initController.ts:35
#: src/podkop/tabs/diagnostic/initController.ts:36 #: src/podkop/tabs/diagnostic/initController.ts:36
#: src/podkop/tabs/diagnostic/initController.ts:37 #: src/podkop/tabs/diagnostic/initController.ts:37
#: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:38
#: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:39
#: src/podkop/tabs/diagnostic/initController.ts:373 #: src/podkop/tabs/diagnostic/initController.ts:40
#: src/podkop/tabs/diagnostic/initController.ts:41
#: src/podkop/tabs/diagnostic/initController.ts:391
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
@@ -931,7 +940,7 @@ msgstr ""
msgid "Validation errors:" msgid "Validation errors:"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:248 #: src/podkop/tabs/diagnostic/initController.ts:254
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107
msgid "View logs" msgid "View logs"
msgstr "" msgstr ""

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 18:55+0300\n" "POT-Creation-Date: 2025-10-23 19:08+0300\n"
"PO-Revision-Date: 2025-10-23 18:55+0300\n" "PO-Revision-Date: 2025-10-23 19:08+0300\n"
"Last-Translator: divocat\n" "Last-Translator: divocat\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: ru\n" "Language: ru\n"
@@ -230,6 +230,9 @@ msgstr "Исключите трафик протокола NTP из туннел
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "Не удалось скопировать!" msgstr "Не удалось скопировать!"
msgid "Failed to execute!"
msgstr "Не удалось выполнить!"
msgid "Fastest" msgid "Fastest"
msgstr "Самый быстрый" msgstr "Самый быстрый"

View File

@@ -16,6 +16,8 @@ import { PodkopShellMethods } from '../../methods';
import { fetchServicesInfo } from '../../fetchers'; import { fetchServicesInfo } from '../../fetchers';
import { normalizeCompiledVersion } from '../../../helpers/normalizeCompiledVersion'; import { normalizeCompiledVersion } from '../../../helpers/normalizeCompiledVersion';
import { renderModal } from '../../../partials'; import { renderModal } from '../../../partials';
import { PODKOP_LUCI_APP_VERSION } from '../../../constants';
import { showToast } from '../../../helpers/showToast';
async function fetchSystemInfo() { async function fetchSystemInfo() {
const systemInfo = await PodkopShellMethods.getSystemInfo(); const systemInfo = await PodkopShellMethods.getSystemInfo();
@@ -218,9 +220,13 @@ async function handleShowGlobalCheck() {
_('Global check'), _('Global check'),
renderModal(globalCheck.data as string, 'global_check'), renderModal(globalCheck.data as string, 'global_check'),
); );
} else {
logger.error('[DIAGNOSTIC]', 'handleShowGlobalCheck - e', globalCheck);
showToast(_('Failed to execute!'), 'error');
} }
} catch (e) { } catch (e) {
logger.error('[DIAGNOSTIC]', 'handleShowGlobalCheck - e', e); logger.error('[DIAGNOSTIC]', 'handleShowGlobalCheck - e', e);
showToast(_('Failed to execute!'), 'error');
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -248,9 +254,13 @@ async function handleViewLogs() {
_('View logs'), _('View logs'),
renderModal(viewLogs.data as string, 'view_logs'), renderModal(viewLogs.data as string, 'view_logs'),
); );
} else {
logger.error('[DIAGNOSTIC]', 'handleViewLogs - e', viewLogs);
showToast(_('Failed to execute!'), 'error');
} }
} catch (e) { } catch (e) {
logger.error('[DIAGNOSTIC]', 'handleViewLogs - e', e); logger.error('[DIAGNOSTIC]', 'handleViewLogs - e', e);
showToast(_('Failed to execute!'), 'error');
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -278,9 +288,17 @@ async function handleShowSingBoxConfig() {
_('Show sing-box config'), _('Show sing-box config'),
renderModal(showSingBoxConfig.data as string, 'show_sing_box_config'), renderModal(showSingBoxConfig.data as string, 'show_sing_box_config'),
); );
} else {
logger.error(
'[DIAGNOSTIC]',
'handleShowSingBoxConfig - e',
showSingBoxConfig,
);
showToast(_('Failed to execute!'), 'error');
} }
} catch (e) { } catch (e) {
logger.error('[DIAGNOSTIC]', 'handleShowSingBoxConfig - e', e); logger.error('[DIAGNOSTIC]', 'handleShowSingBoxConfig - e', e);
showToast(_('Failed to execute!'), 'error');
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -387,6 +405,11 @@ function renderDiagnosticSystemInfoWidget() {
} }
if (version !== `v${diagnosticsSystemInfo.podkop_latest_version}`) { if (version !== `v${diagnosticsSystemInfo.podkop_latest_version}`) {
logger.debug(
'[DIAGNOSTIC]',
'diagnosticsSystemInfo',
diagnosticsSystemInfo,
);
return { return {
key: 'Podkop', key: 'Podkop',
value: version, value: version,
@@ -412,7 +435,7 @@ function renderDiagnosticSystemInfoWidget() {
getPodkopVersionRow(), getPodkopVersionRow(),
{ {
key: 'Luci App', key: 'Luci App',
value: normalizeCompiledVersion(diagnosticsSystemInfo.luci_app_version), value: normalizeCompiledVersion(PODKOP_LUCI_APP_VERSION),
}, },
{ {
key: 'Sing-box', key: 'Sing-box',

View File

@@ -3797,9 +3797,13 @@ async function handleShowGlobalCheck() {
_("Global check"), _("Global check"),
renderModal(globalCheck.data, "global_check") renderModal(globalCheck.data, "global_check")
); );
} else {
logger.error("[DIAGNOSTIC]", "handleShowGlobalCheck - e", globalCheck);
showToast(_("Failed to execute!"), "error");
} }
} catch (e) { } catch (e) {
logger.error("[DIAGNOSTIC]", "handleShowGlobalCheck - e", e); logger.error("[DIAGNOSTIC]", "handleShowGlobalCheck - e", e);
showToast(_("Failed to execute!"), "error");
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -3824,9 +3828,13 @@ async function handleViewLogs() {
_("View logs"), _("View logs"),
renderModal(viewLogs.data, "view_logs") renderModal(viewLogs.data, "view_logs")
); );
} else {
logger.error("[DIAGNOSTIC]", "handleViewLogs - e", viewLogs);
showToast(_("Failed to execute!"), "error");
} }
} catch (e) { } catch (e) {
logger.error("[DIAGNOSTIC]", "handleViewLogs - e", e); logger.error("[DIAGNOSTIC]", "handleViewLogs - e", e);
showToast(_("Failed to execute!"), "error");
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -3851,9 +3859,17 @@ async function handleShowSingBoxConfig() {
_("Show sing-box config"), _("Show sing-box config"),
renderModal(showSingBoxConfig.data, "show_sing_box_config") renderModal(showSingBoxConfig.data, "show_sing_box_config")
); );
} else {
logger.error(
"[DIAGNOSTIC]",
"handleShowSingBoxConfig - e",
showSingBoxConfig
);
showToast(_("Failed to execute!"), "error");
} }
} catch (e) { } catch (e) {
logger.error("[DIAGNOSTIC]", "handleShowSingBoxConfig - e", e); logger.error("[DIAGNOSTIC]", "handleShowSingBoxConfig - e", e);
showToast(_("Failed to execute!"), "error");
} finally { } finally {
store.set({ store.set({
diagnosticsActions: { diagnosticsActions: {
@@ -3946,6 +3962,11 @@ function renderDiagnosticSystemInfoWidget() {
}; };
} }
if (version !== `v${diagnosticsSystemInfo.podkop_latest_version}`) { if (version !== `v${diagnosticsSystemInfo.podkop_latest_version}`) {
logger.debug(
"[DIAGNOSTIC]",
"diagnosticsSystemInfo",
diagnosticsSystemInfo
);
return { return {
key: "Podkop", key: "Podkop",
value: version, value: version,
@@ -3969,7 +3990,7 @@ function renderDiagnosticSystemInfoWidget() {
getPodkopVersionRow(), getPodkopVersionRow(),
{ {
key: "Luci App", key: "Luci App",
value: normalizeCompiledVersion(diagnosticsSystemInfo.luci_app_version) value: normalizeCompiledVersion(PODKOP_LUCI_APP_VERSION)
}, },
{ {
key: "Sing-box", key: "Sing-box",

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 18:55+0300\n" "POT-Creation-Date: 2025-10-23 19:08+0300\n"
"PO-Revision-Date: 2025-10-23 18:55+0300\n" "PO-Revision-Date: 2025-10-23 19:08+0300\n"
"Last-Translator: divocat\n" "Last-Translator: divocat\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: ru\n" "Language: ru\n"
@@ -230,6 +230,9 @@ msgstr "Исключите трафик протокола NTP из туннел
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "Не удалось скопировать!" msgstr "Не удалось скопировать!"
msgid "Failed to execute!"
msgstr "Не удалось выполнить!"
msgid "Fastest" msgid "Fastest"
msgstr "Самый быстрый" msgstr "Самый быстрый"

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 15:55+0300\n" "POT-Creation-Date: 2025-10-23 16:08+0300\n"
"PO-Revision-Date: 2025-10-23 15:55+0300\n" "PO-Revision-Date: 2025-10-23 16:08+0300\n"
"Last-Translator: divocat <divocatt@gmail.com>\n" "Last-Translator: divocat <divocatt@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
@@ -312,6 +312,15 @@ msgstr ""
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:225
#: src/podkop/tabs/diagnostic/initController.ts:229
#: src/podkop/tabs/diagnostic/initController.ts:259
#: src/podkop/tabs/diagnostic/initController.ts:263
#: src/podkop/tabs/diagnostic/initController.ts:297
#: src/podkop/tabs/diagnostic/initController.ts:301
msgid "Failed to execute!"
msgstr ""
#: src/podkop/methods/custom/getDashboardSections.ts:117 #: src/podkop/methods/custom/getDashboardSections.ts:117
msgid "Fastest" msgid "Fastest"
msgstr "" msgstr ""
@@ -324,7 +333,7 @@ msgstr ""
msgid "Get global check" msgid "Get global check"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:218 #: src/podkop/tabs/diagnostic/initController.ts:220
msgid "Global check" msgid "Global check"
msgstr "" msgstr ""
@@ -469,7 +478,7 @@ msgstr ""
msgid "IP address 0.0.0.0 is not allowed" msgid "IP address 0.0.0.0 is not allowed"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:404 #: src/podkop/tabs/diagnostic/initController.ts:427
msgid "Latest" msgid "Latest"
msgstr "" msgstr ""
@@ -536,7 +545,7 @@ msgstr ""
msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:394 #: src/podkop/tabs/diagnostic/initController.ts:417
msgid "Outdated" msgid "Outdated"
msgstr "" msgstr ""
@@ -724,7 +733,7 @@ msgstr ""
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:278 #: src/podkop/tabs/diagnostic/initController.ts:288
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116
msgid "Show sing-box config" msgid "Show sing-box config"
msgstr "" msgstr ""
@@ -851,13 +860,13 @@ msgstr ""
msgid "UDP over TCP" msgid "UDP over TCP"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:34
#: src/podkop/tabs/diagnostic/initController.ts:35
#: src/podkop/tabs/diagnostic/initController.ts:36 #: src/podkop/tabs/diagnostic/initController.ts:36
#: src/podkop/tabs/diagnostic/initController.ts:37 #: src/podkop/tabs/diagnostic/initController.ts:37
#: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:38
#: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:39
#: src/podkop/tabs/diagnostic/initController.ts:373 #: src/podkop/tabs/diagnostic/initController.ts:40
#: src/podkop/tabs/diagnostic/initController.ts:41
#: src/podkop/tabs/diagnostic/initController.ts:391
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
@@ -931,7 +940,7 @@ msgstr ""
msgid "Validation errors:" msgid "Validation errors:"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:248 #: src/podkop/tabs/diagnostic/initController.ts:254
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107
msgid "View logs" msgid "View logs"
msgstr "" msgstr ""