mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-07-26 08:55:33 +03:00
feat: add wiki disclaimer to diagnostics
This commit is contained in:
@@ -452,17 +452,18 @@ function validateSocksUrl(url) {
|
||||
|
||||
// src/validators/validateProxyUrl.ts
|
||||
function validateProxyUrl(url) {
|
||||
if (url.startsWith("ss://")) {
|
||||
return validateShadowsocksUrl(url);
|
||||
const trimmedUrl = url.trim();
|
||||
if (trimmedUrl.startsWith("ss://")) {
|
||||
return validateShadowsocksUrl(trimmedUrl);
|
||||
}
|
||||
if (url.startsWith("vless://")) {
|
||||
return validateVlessUrl(url);
|
||||
if (trimmedUrl.startsWith("vless://")) {
|
||||
return validateVlessUrl(trimmedUrl);
|
||||
}
|
||||
if (url.startsWith("trojan://")) {
|
||||
return validateTrojanUrl(url);
|
||||
if (trimmedUrl.startsWith("trojan://")) {
|
||||
return validateTrojanUrl(trimmedUrl);
|
||||
}
|
||||
if (/^socks(4|4a|5):\/\//.test(url)) {
|
||||
return validateSocksUrl(url);
|
||||
if (/^socks(4|4a|5):\/\//.test(trimmedUrl)) {
|
||||
return validateSocksUrl(trimmedUrl);
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
@@ -1087,7 +1088,7 @@ var loadingDiagnosticsChecksStore = {
|
||||
code: "DNS" /* DNS */,
|
||||
title: DIAGNOSTICS_CHECKS_MAP.DNS.title,
|
||||
order: DIAGNOSTICS_CHECKS_MAP.DNS.order,
|
||||
description: _("Queued"),
|
||||
description: _("Pending"),
|
||||
items: [],
|
||||
state: "skipped"
|
||||
},
|
||||
@@ -1095,7 +1096,7 @@ var loadingDiagnosticsChecksStore = {
|
||||
code: "SINGBOX" /* SINGBOX */,
|
||||
title: DIAGNOSTICS_CHECKS_MAP.SINGBOX.title,
|
||||
order: DIAGNOSTICS_CHECKS_MAP.SINGBOX.order,
|
||||
description: _("Queued"),
|
||||
description: _("Pending"),
|
||||
items: [],
|
||||
state: "skipped"
|
||||
},
|
||||
@@ -1103,7 +1104,7 @@ var loadingDiagnosticsChecksStore = {
|
||||
code: "NFT" /* NFT */,
|
||||
title: DIAGNOSTICS_CHECKS_MAP.NFT.title,
|
||||
order: DIAGNOSTICS_CHECKS_MAP.NFT.order,
|
||||
description: _("Queued"),
|
||||
description: _("Pending"),
|
||||
items: [],
|
||||
state: "skipped"
|
||||
},
|
||||
@@ -1111,7 +1112,7 @@ var loadingDiagnosticsChecksStore = {
|
||||
code: "FAKEIP" /* FAKEIP */,
|
||||
title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title,
|
||||
order: DIAGNOSTICS_CHECKS_MAP.FAKEIP.order,
|
||||
description: _("Queued"),
|
||||
description: _("Pending"),
|
||||
items: [],
|
||||
state: "skipped"
|
||||
}
|
||||
@@ -2341,6 +2342,7 @@ function render2() {
|
||||
})
|
||||
]),
|
||||
E("div", { class: "pdk_diagnostic-page__right-bar" }, [
|
||||
E("div", { id: "pdk_diagnostic-page-wiki" }),
|
||||
E("div", { id: "pdk_diagnostic-page-actions" }),
|
||||
E("div", { id: "pdk_diagnostic-page-system-info" })
|
||||
])
|
||||
@@ -2372,7 +2374,7 @@ function getMeta({ allGood, atLeastOneGood }) {
|
||||
if (atLeastOneGood) {
|
||||
return {
|
||||
state: "warning",
|
||||
description: _("Checks partially passed")
|
||||
description: _("Issues detected")
|
||||
};
|
||||
}
|
||||
return {
|
||||
@@ -3195,6 +3197,34 @@ function renderSearchIcon24() {
|
||||
);
|
||||
}
|
||||
|
||||
// src/icons/renderBookOpenTextIcon24.ts
|
||||
function renderBookOpenTextIcon24() {
|
||||
const NS = "http://www.w3.org/2000/svg";
|
||||
return svgEl(
|
||||
"svg",
|
||||
{
|
||||
xmlns: NS,
|
||||
viewBox: "0 0 24 24",
|
||||
fill: "none",
|
||||
stroke: "currentColor",
|
||||
"stroke-width": "2",
|
||||
"stroke-linecap": "round",
|
||||
"stroke-linejoin": "round",
|
||||
class: "lucide lucide-book-open-text-icon lucide-book-open-text"
|
||||
},
|
||||
[
|
||||
svgEl("path", { d: "M12 7v14" }),
|
||||
svgEl("path", { d: "M16 12h2" }),
|
||||
svgEl("path", { d: "M16 8h2" }),
|
||||
svgEl("path", {
|
||||
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
|
||||
}),
|
||||
svgEl("path", { d: "M6 12h2" }),
|
||||
svgEl("path", { d: "M6 8h2" })
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// src/partials/button/renderButton.ts
|
||||
function renderButton({
|
||||
classNames = [],
|
||||
@@ -3618,6 +3648,41 @@ function normalizeCompiledVersion(version) {
|
||||
return version;
|
||||
}
|
||||
|
||||
// src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts
|
||||
function renderWikiDisclaimer(kind) {
|
||||
const iconWrap = E("span", {
|
||||
class: "pdk_diagnostic-page__right-bar__wiki__icon"
|
||||
});
|
||||
iconWrap.appendChild(renderBookOpenTextIcon24());
|
||||
const className = [
|
||||
"pdk_diagnostic-page__right-bar__wiki",
|
||||
...insertIf(kind === "error", [
|
||||
"pdk_diagnostic-page__right-bar__wiki--error"
|
||||
]),
|
||||
...insertIf(kind === "warning", [
|
||||
"pdk_diagnostic-page__right-bar__wiki--warning"
|
||||
])
|
||||
].join(" ");
|
||||
return E("div", { class: className }, [
|
||||
E("div", { class: "pdk_diagnostic-page__right-bar__wiki__content" }, [
|
||||
iconWrap,
|
||||
E("div", { class: "pdk_diagnostic-page__right-bar__wiki__texts" }, [
|
||||
E("b", {}, _("Troubleshooting")),
|
||||
E("div", {}, _("Do not panic, everything can be fixed, just..."))
|
||||
])
|
||||
]),
|
||||
renderButton({
|
||||
classNames: ["cbi-button-save"],
|
||||
text: _("Visit Wiki"),
|
||||
onClick: () => window.open(
|
||||
"https://podkop.net/docs/troubleshooting/",
|
||||
"_blank",
|
||||
"noopener,noreferrer"
|
||||
)
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
// src/podkop/tabs/diagnostic/initController.ts
|
||||
async function fetchSystemInfo() {
|
||||
const systemInfo = await PodkopShellMethods.getSystemInfo();
|
||||
@@ -3879,6 +3944,23 @@ async function handleShowSingBoxConfig() {
|
||||
});
|
||||
}
|
||||
}
|
||||
function renderWikiDisclaimerWidget() {
|
||||
const diagnosticsChecks = store.get().diagnosticsChecks;
|
||||
function getWikiKind() {
|
||||
const allResults = diagnosticsChecks.map((check) => check.state);
|
||||
if (allResults.includes("error")) {
|
||||
return "error";
|
||||
}
|
||||
if (allResults.includes("warning")) {
|
||||
return "warning";
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
const container = document.getElementById("pdk_diagnostic-page-wiki");
|
||||
return preserveScrollForPage(() => {
|
||||
container.replaceChildren(renderWikiDisclaimer(getWikiKind()));
|
||||
});
|
||||
}
|
||||
function renderDiagnosticAvailableActionsWidget() {
|
||||
const diagnosticsActions = store.get().diagnosticsActions;
|
||||
const servicesInfoWidget = store.get().servicesInfoWidget;
|
||||
@@ -4013,6 +4095,7 @@ function renderDiagnosticSystemInfoWidget() {
|
||||
async function onStoreUpdate2(next, prev, diff) {
|
||||
if (diff.diagnosticsChecks) {
|
||||
renderDiagnosticsChecks();
|
||||
renderWikiDisclaimerWidget();
|
||||
}
|
||||
if (diff.diagnosticsRunAction) {
|
||||
renderDiagnosticRunActionWidget();
|
||||
@@ -4047,6 +4130,7 @@ function onPageMount2() {
|
||||
renderDiagnosticRunActionWidget();
|
||||
renderDiagnosticAvailableActionsWidget();
|
||||
renderDiagnosticSystemInfoWidget();
|
||||
renderWikiDisclaimerWidget();
|
||||
fetchServicesInfo();
|
||||
fetchSystemInfo();
|
||||
}
|
||||
@@ -4125,6 +4209,31 @@ var styles4 = `
|
||||
grid-row-gap: 10px;
|
||||
}
|
||||
|
||||
.pdk_diagnostic-page__right-bar__wiki {
|
||||
border: 2px var(--background-color-low, lightgray) solid;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: auto;
|
||||
grid-row-gap: 10px;
|
||||
}
|
||||
|
||||
.pdk_diagnostic-page__right-bar__wiki--warning {
|
||||
border: 2px var(--warn-color-medium, orange) solid;
|
||||
}
|
||||
.pdk_diagnostic-page__right-bar__wiki--error {
|
||||
border: 2px var(--error-color-medium, red) solid;
|
||||
}
|
||||
|
||||
.pdk_diagnostic-page__right-bar__wiki__content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 5fr;
|
||||
grid-column-gap: 10px;
|
||||
}
|
||||
|
||||
.pdk_diagnostic-page__right-bar__wiki__texts {}
|
||||
|
||||
.pdk_diagnostic-page__right-bar__actions {
|
||||
border: 2px var(--background-color-low, lightgray) solid;
|
||||
border-radius: 4px;
|
||||
|
||||
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PODKOP\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-23 19:08+0300\n"
|
||||
"PO-Revision-Date: 2025-10-23 19:08+0300\n"
|
||||
"POT-Creation-Date: 2025-10-23 20:00+0300\n"
|
||||
"PO-Revision-Date: 2025-10-23 20:00+0300\n"
|
||||
"Last-Translator: divocat\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: ru\n"
|
||||
@@ -75,10 +75,7 @@ msgid "checks"
|
||||
msgstr "проверки"
|
||||
|
||||
msgid "Checks failed"
|
||||
msgstr "Проверки не пройдены"
|
||||
|
||||
msgid "Checks partially passed"
|
||||
msgstr "Проверки пройдены частично"
|
||||
msgstr "Проверки не выполнены"
|
||||
|
||||
msgid "Checks passed"
|
||||
msgstr "Проверки пройдены"
|
||||
@@ -164,6 +161,9 @@ msgstr "DNS-сервер"
|
||||
msgid "DNS server address cannot be empty"
|
||||
msgstr "Адрес DNS-сервера не может быть пустым"
|
||||
|
||||
msgid "Do not panic, everything can be fixed, just..."
|
||||
msgstr "Не паникуйте, всё можно исправить, просто..."
|
||||
|
||||
msgid "Domain Resolver"
|
||||
msgstr "Резолвер доменов"
|
||||
|
||||
@@ -350,6 +350,9 @@ msgstr "Неверный URL VLESS: ошибка разбора"
|
||||
msgid "IP address 0.0.0.0 is not allowed"
|
||||
msgstr "IP-адрес 0.0.0.0 не допускается"
|
||||
|
||||
msgid "Issues detected"
|
||||
msgstr "Обнаружены проблемы"
|
||||
|
||||
msgid "Latest"
|
||||
msgstr "Последняя"
|
||||
|
||||
@@ -416,6 +419,9 @@ msgstr "Путь должен содержать хотя бы одну дире
|
||||
msgid "Path must end with cache.db"
|
||||
msgstr "Путь должен заканчиваться на cache.db"
|
||||
|
||||
msgid "Pending"
|
||||
msgstr "Ожидает запуска"
|
||||
|
||||
msgid "Podkop"
|
||||
msgstr "Podkop"
|
||||
|
||||
@@ -434,9 +440,6 @@ msgstr "Прокси-трафик не маршрутизируется чере
|
||||
msgid "Proxy traffic is routed via FakeIP"
|
||||
msgstr "Прокси-трафик направляется через FakeIP"
|
||||
|
||||
msgid "Queued"
|
||||
msgstr "В очереди"
|
||||
|
||||
msgid "Regional options cannot be used together"
|
||||
msgstr "Нельзя использовать несколько региональных опций одновременно"
|
||||
|
||||
@@ -617,6 +620,9 @@ msgstr "Трафик"
|
||||
msgid "Traffic Total"
|
||||
msgstr "Всего трафика"
|
||||
|
||||
msgid "Troubleshooting"
|
||||
msgstr "Устранение неполадок"
|
||||
|
||||
msgid "TTL must be a positive number"
|
||||
msgstr "TTL должно быть положительным числом"
|
||||
|
||||
@@ -677,6 +683,9 @@ msgstr "Ошибки валидации:"
|
||||
msgid "View logs"
|
||||
msgstr "Посмотреть логи"
|
||||
|
||||
msgid "Visit Wiki"
|
||||
msgstr "Перейти в wiki"
|
||||
|
||||
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
|
||||
msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены."
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PODKOP\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-23 16:08+0300\n"
|
||||
"PO-Revision-Date: 2025-10-23 16:08+0300\n"
|
||||
"POT-Creation-Date: 2025-10-23 17:00+0300\n"
|
||||
"PO-Revision-Date: 2025-10-23 17:00+0300\n"
|
||||
"Last-Translator: divocat <divocatt@gmail.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
@@ -101,10 +101,6 @@ msgstr ""
|
||||
msgid "Checks failed"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20
|
||||
msgid "Checks partially passed"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:13
|
||||
msgid "Checks passed"
|
||||
msgstr ""
|
||||
@@ -222,6 +218,10 @@ msgstr ""
|
||||
msgid "DNS server address cannot be empty"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:26
|
||||
msgid "Do not panic, everything can be fixed, just..."
|
||||
msgstr ""
|
||||
|
||||
#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:166
|
||||
msgid "Domain Resolver"
|
||||
msgstr ""
|
||||
@@ -312,12 +312,12 @@ msgstr ""
|
||||
msgid "Failed to copy!"
|
||||
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
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:226
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:230
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:260
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:264
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:298
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:302
|
||||
msgid "Failed to execute!"
|
||||
msgstr ""
|
||||
|
||||
@@ -333,7 +333,7 @@ msgstr ""
|
||||
msgid "Get global check"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:220
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:221
|
||||
msgid "Global check"
|
||||
msgstr ""
|
||||
|
||||
@@ -478,7 +478,11 @@ msgstr ""
|
||||
msgid "IP address 0.0.0.0 is not allowed"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:427
|
||||
#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20
|
||||
msgid "Issues detected"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:452
|
||||
msgid "Latest"
|
||||
msgstr ""
|
||||
|
||||
@@ -545,7 +549,7 @@ msgstr ""
|
||||
msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:417
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:442
|
||||
msgid "Outdated"
|
||||
msgstr ""
|
||||
|
||||
@@ -569,6 +573,13 @@ msgstr ""
|
||||
msgid "Path must end with cache.db"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119
|
||||
msgid "Pending"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/dashboard/initController.ts:340
|
||||
msgid "Podkop"
|
||||
msgstr ""
|
||||
@@ -593,13 +604,6 @@ msgstr ""
|
||||
msgid "Proxy traffic is routed via FakeIP"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111
|
||||
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119
|
||||
msgid "Queued"
|
||||
msgstr ""
|
||||
|
||||
#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:245
|
||||
msgid "Regional options cannot be used together"
|
||||
msgstr ""
|
||||
@@ -733,7 +737,7 @@ msgstr ""
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:288
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:289
|
||||
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116
|
||||
msgid "Show sing-box config"
|
||||
msgstr ""
|
||||
@@ -843,6 +847,10 @@ msgstr ""
|
||||
msgid "Traffic Total"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:25
|
||||
msgid "Troubleshooting"
|
||||
msgstr ""
|
||||
|
||||
#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:80
|
||||
msgid "TTL must be a positive number"
|
||||
msgstr ""
|
||||
@@ -860,13 +868,13 @@ msgstr ""
|
||||
msgid "UDP over TCP"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:36
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:37
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:38
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:39
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:40
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:41
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:391
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:42
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:416
|
||||
msgid "unknown"
|
||||
msgstr ""
|
||||
|
||||
@@ -879,7 +887,7 @@ msgstr ""
|
||||
msgid "Uplink"
|
||||
msgstr ""
|
||||
|
||||
#: src/validators/validateProxyUrl.ts:27
|
||||
#: src/validators/validateProxyUrl.ts:29
|
||||
msgid "URL must start with vless://, ss://, trojan://, or socks4/5://"
|
||||
msgstr ""
|
||||
|
||||
@@ -940,11 +948,15 @@ msgstr ""
|
||||
msgid "Validation errors:"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:254
|
||||
#: src/podkop/tabs/diagnostic/initController.ts:255
|
||||
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107
|
||||
msgid "View logs"
|
||||
msgstr ""
|
||||
|
||||
#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:31
|
||||
msgid "Visit Wiki"
|
||||
msgstr ""
|
||||
|
||||
#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:247
|
||||
msgid "Warning: %s cannot be used together with %s. Previous selections have been removed."
|
||||
msgstr ""
|
||||
|
||||
Reference in New Issue
Block a user