Spaces:
Paused
Paused
File size: 643 Bytes
4e7644b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import type { MarketPluginEntry } from "@/api/modules/pluginMarket";
function deriveCompatLabel(version: string): string | null {
const trimmed = version.trim().replace(/^v/i, "");
const match = trimmed.match(/^(\d+)/);
if (!match) return null;
return `${match[1]}.x`;
}
export function isMarketPluginCompatible(
entry: MarketPluginEntry,
currentVersion: string | null,
): boolean {
if (!currentVersion) return true;
const labels = entry.qwenpaw_compat_labels;
if (!labels || labels.length === 0) return true;
const label = deriveCompatLabel(currentVersion);
if (!label) return true;
return labels.includes(label);
}
|