update upstream to 0.7.16

This commit is contained in:
ushan0v
2026-05-12 23:31:14 +03:00
parent afb1cd554b
commit 2c1e9f402d
6 changed files with 301 additions and 188 deletions
@@ -0,0 +1,102 @@
import { normalizeCompiledVersion } from '../../../../helpers/normalizeCompiledVersion';
import {
compareReleaseVersions,
isDevVersion,
} from '../../../../helpers/compareReleaseVersions';
import type { StoreType } from '../../../services/store.service';
import type { IRenderSystemInfoRow } from '../partials';
function isUnknownVersion(version?: string | null): boolean {
return version === 'unknown' || version === _('unknown');
}
export function getPodkopVersionRow(
diagnosticsSystemInfo: StoreType['diagnosticsSystemInfo'],
): IRenderSystemInfoRow {
const loading = diagnosticsSystemInfo.loading;
const unknown = isUnknownVersion(diagnosticsSystemInfo.podkop_version);
const hasActualVersion =
Boolean(diagnosticsSystemInfo.podkop_latest_version) &&
!isUnknownVersion(diagnosticsSystemInfo.podkop_latest_version);
const version = normalizeCompiledVersion(
diagnosticsSystemInfo.podkop_version,
);
const latestVersion = diagnosticsSystemInfo.podkop_latest_version || '';
if (loading) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Checking'),
kind: 'neutral',
},
};
}
if (isDevVersion(version)) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Dev'),
kind: 'neutral',
},
};
}
if (unknown || !hasActualVersion) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Check unavailable'),
kind: 'neutral',
},
};
}
const versionCompareResult = compareReleaseVersions(version, latestVersion);
if (versionCompareResult === null) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Check unavailable'),
kind: 'neutral',
},
};
}
if (versionCompareResult < 0) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Outdated'),
kind: 'warning',
},
};
}
if (versionCompareResult > 0) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Dev'),
kind: 'neutral',
},
};
}
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Latest'),
kind: 'success',
},
};
}
@@ -7,7 +7,6 @@ import { runZapretCheck } from './checks/runZapretCheck';
import { loadingDiagnosticsChecksStore } from './diagnostic.store';
import { logger, store, StoreType } from '../../services';
import {
IRenderSystemInfoRow,
renderAvailableActions,
renderCheckSection,
renderRunAction,
@@ -21,10 +20,7 @@ import { PODKOP_LUCI_APP_VERSION } from '../../../constants';
import { showToast } from '../../../helpers/showToast';
import { renderWikiDisclaimer } from './partials/renderWikiDisclaimer';
import { runSectionsCheck } from './checks/runSectionsCheck';
import {
compareReleaseVersions,
isDevVersion,
} from '../../../helpers/compareReleaseVersions';
import { getPodkopVersionRow } from './helpers/getPodkopVersionRow';
const UNKNOWN_DIAGNOSTICS_SYSTEM_INFO = {
podkop_version: _('unknown'),
@@ -461,104 +457,9 @@ function renderDiagnosticSystemInfoWidget() {
const container = document.getElementById('pdk_diagnostic-page-system-info');
function getPodkopVersionRow(): IRenderSystemInfoRow {
const loading = diagnosticsSystemInfo.loading;
const unknown = diagnosticsSystemInfo.podkop_version === _('unknown');
const hasActualVersion =
Boolean(diagnosticsSystemInfo.podkop_latest_version) &&
diagnosticsSystemInfo.podkop_latest_version !== 'unknown';
const version = normalizeCompiledVersion(
diagnosticsSystemInfo.podkop_version,
);
const latestVersion =
`${diagnosticsSystemInfo.podkop_latest_version || ''}`.replace(/^v/, '');
if (loading) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Checking'),
kind: 'neutral',
},
};
}
if (isDevVersion(version)) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Dev'),
kind: 'neutral',
},
};
}
if (unknown || !hasActualVersion) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Check unavailable'),
kind: 'neutral',
},
};
}
const versionCompareResult = compareReleaseVersions(version, latestVersion);
if (versionCompareResult === null) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Check unavailable'),
kind: 'neutral',
},
};
}
if (versionCompareResult < 0) {
logger.debug(
'[DIAGNOSTIC]',
'diagnosticsSystemInfo',
diagnosticsSystemInfo,
);
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Outdated'),
kind: 'warning',
},
};
}
if (versionCompareResult > 0) {
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Dev'),
kind: 'neutral',
},
};
}
return {
key: 'Podkop Plus',
value: version,
tag: {
label: _('Latest'),
kind: 'success',
},
};
}
const renderedSystemInfo = renderSystemInfo({
items: [
getPodkopVersionRow(),
getPodkopVersionRow(diagnosticsSystemInfo),
{
key: 'Luci App',
value: normalizeCompiledVersion(PODKOP_LUCI_APP_VERSION),
@@ -0,0 +1,110 @@
import { describe, expect, it } from 'vitest';
import { getPodkopVersionRow } from '../helpers/getPodkopVersionRow';
import type { StoreType } from '../../../services/store.service';
function makeDiagnosticsSystemInfo(
patch: Partial<StoreType['diagnosticsSystemInfo']> = {},
): StoreType['diagnosticsSystemInfo'] {
return {
loading: false,
podkop_version: '0.7.16-4',
podkop_latest_version: '0.7.16-4',
luci_app_version: '0.7.16-4',
sing_box_version: '1.12.0',
zapret_version: 'not installed',
zapret_installed: 0,
openwrt_version: 'OpenWrt 25.12',
device_model: 'Test Router',
...patch,
};
}
describe('getPodkopVersionRow', () => {
it('returns Latest when versions differ only by leading v', () => {
const row = getPodkopVersionRow(
makeDiagnosticsSystemInfo({
podkop_version: 'v0.7.16-4',
podkop_latest_version: '0.7.16-4',
}),
);
expect(row).toEqual({
key: 'Podkop Plus',
value: 'v0.7.16-4',
tag: {
label: 'Latest',
kind: 'success',
},
});
});
it('returns Outdated when the current fork release is older', () => {
const row = getPodkopVersionRow(
makeDiagnosticsSystemInfo({
podkop_version: '0.7.16-3',
podkop_latest_version: '0.7.16-4',
}),
);
expect(row).toEqual({
key: 'Podkop Plus',
value: '0.7.16-3',
tag: {
label: 'Outdated',
kind: 'warning',
},
});
});
it('returns Dev when the current fork release is newer than latest', () => {
const row = getPodkopVersionRow(
makeDiagnosticsSystemInfo({
podkop_version: '0.7.16-5',
podkop_latest_version: '0.7.16-4',
}),
);
expect(row).toEqual({
key: 'Podkop Plus',
value: '0.7.16-5',
tag: {
label: 'Dev',
kind: 'neutral',
},
});
});
it('returns Check unavailable when latest version is unknown', () => {
const row = getPodkopVersionRow(
makeDiagnosticsSystemInfo({
podkop_latest_version: 'unknown',
}),
);
expect(row).toEqual({
key: 'Podkop Plus',
value: '0.7.16-4',
tag: {
label: 'Check unavailable',
kind: 'neutral',
},
});
});
it('returns Dev for placeholder builds', () => {
const row = getPodkopVersionRow(
makeDiagnosticsSystemInfo({
podkop_version: '__COMPILED_VERSION_VARIABLE__',
}),
);
expect(row).toEqual({
key: 'Podkop Plus',
value: 'dev',
tag: {
label: 'Dev',
kind: 'neutral',
},
});
});
});
+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-podkop-plus
PODKOP_BASE_VERSION:=$(or $(PODKOP_BASE_VERSION),$(PODKOP_VERSION),0.7.15)
PODKOP_BASE_VERSION:=$(or $(PODKOP_BASE_VERSION),$(PODKOP_VERSION),0.7.16)
PODKOP_FORK_RELEASE:=$(or $(PODKOP_FORK_RELEASE),4)
PODKOP_PACKAGE_VERSION:=$(PODKOP_BASE_VERSION)-$(PODKOP_FORK_RELEASE)
@@ -4626,6 +4626,89 @@ function isDevVersion(version) {
return version === "dev" || /(?:^|[.+-])dev(?:$|[.+-])/i.test(version) || version.includes("COMPILED");
}
// src/podkop/tabs/diagnostic/helpers/getPodkopVersionRow.ts
function isUnknownVersion(version) {
return version === "unknown" || version === _("unknown");
}
function getPodkopVersionRow(diagnosticsSystemInfo) {
const loading = diagnosticsSystemInfo.loading;
const unknown = isUnknownVersion(diagnosticsSystemInfo.podkop_version);
const hasActualVersion = Boolean(diagnosticsSystemInfo.podkop_latest_version) && !isUnknownVersion(diagnosticsSystemInfo.podkop_latest_version);
const version = normalizeCompiledVersion(
diagnosticsSystemInfo.podkop_version
);
const latestVersion = diagnosticsSystemInfo.podkop_latest_version || "";
if (loading) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Checking"),
kind: "neutral"
}
};
}
if (isDevVersion(version)) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Dev"),
kind: "neutral"
}
};
}
if (unknown || !hasActualVersion) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Check unavailable"),
kind: "neutral"
}
};
}
const versionCompareResult = compareReleaseVersions(version, latestVersion);
if (versionCompareResult === null) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Check unavailable"),
kind: "neutral"
}
};
}
if (versionCompareResult < 0) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Outdated"),
kind: "warning"
}
};
}
if (versionCompareResult > 0) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Dev"),
kind: "neutral"
}
};
}
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Latest"),
kind: "success"
}
};
}
// src/podkop/tabs/diagnostic/initController.ts
var UNKNOWN_DIAGNOSTICS_SYSTEM_INFO = {
podkop_version: _("unknown"),
@@ -4969,92 +5052,9 @@ function renderDiagnosticSystemInfoWidget() {
logger.debug("[DIAGNOSTIC]", "renderDiagnosticSystemInfoWidget");
const diagnosticsSystemInfo = store.get().diagnosticsSystemInfo;
const container = document.getElementById("pdk_diagnostic-page-system-info");
function getPodkopVersionRow() {
const loading = diagnosticsSystemInfo.loading;
const unknown = diagnosticsSystemInfo.podkop_version === _("unknown");
const hasActualVersion = Boolean(diagnosticsSystemInfo.podkop_latest_version) && diagnosticsSystemInfo.podkop_latest_version !== "unknown";
const version = normalizeCompiledVersion(
diagnosticsSystemInfo.podkop_version
);
const latestVersion = `${diagnosticsSystemInfo.podkop_latest_version || ""}`.replace(/^v/, "");
if (loading) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Checking"),
kind: "neutral"
}
};
}
if (isDevVersion(version)) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Dev"),
kind: "neutral"
}
};
}
if (unknown || !hasActualVersion) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Check unavailable"),
kind: "neutral"
}
};
}
const versionCompareResult = compareReleaseVersions(version, latestVersion);
if (versionCompareResult === null) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Check unavailable"),
kind: "neutral"
}
};
}
if (versionCompareResult < 0) {
logger.debug(
"[DIAGNOSTIC]",
"diagnosticsSystemInfo",
diagnosticsSystemInfo
);
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Outdated"),
kind: "warning"
}
};
}
if (versionCompareResult > 0) {
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Dev"),
kind: "neutral"
}
};
}
return {
key: "Podkop Plus",
value: version,
tag: {
label: _("Latest"),
kind: "success"
}
};
}
const renderedSystemInfo = renderSystemInfo({
items: [
getPodkopVersionRow(),
getPodkopVersionRow(diagnosticsSystemInfo),
{
key: "Luci App",
value: normalizeCompiledVersion(PODKOP_LUCI_APP_VERSION)
+2 -2
View File
@@ -5,7 +5,7 @@ SCRIPT_PATH="$(readlink -f "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
RELEASE_VERSION="${1:-0.7.15-4}"
RELEASE_VERSION="${1:-0.7.16-4}"
OUTPUT_DIR_INPUT="${2:-}"
BASE_VERSION="${RELEASE_VERSION%-*}"
FORK_RELEASE="${RELEASE_VERSION##*-}"
@@ -20,7 +20,7 @@ if [[ "$DEFAULT_BUILD_HOME" == "/root" ]]; then
fi
if [[ "$BASE_VERSION" == "$RELEASE_VERSION" || -z "$FORK_RELEASE" ]]; then
echo "Expected release version in the form 0.7.15-1" >&2
echo "Expected release version in the form 0.7.16-1" >&2
exit 1
fi