mirror of
https://github.com/prompt-security/clawsec.git
synced 2026-06-24 02:41:20 +03:00
1efb813ed4
* fix(nvd): add hermes query specs to feed polling * fix(nvd): derive platform fallback from matched targets * fix(nvd): avoid arg overflow on full cve rescan * fix(feed): add other platform filter for nonstandard slugs * refactor(feed): centralize advisory platform badge mapping * fix(feed): share platform normalization and fix tab callback typing * refactor(feed): simplify platform descriptor fallback
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { CORE_PLATFORM_SLUGS } from '../types';
|
|
|
|
export interface PlatformDescriptor {
|
|
label: string;
|
|
classes: string;
|
|
}
|
|
|
|
export const normalizePlatformSlug = (platform: string) => platform.trim().toLowerCase();
|
|
|
|
const PLATFORM_DESCRIPTOR_BY_SLUG: Record<string, PlatformDescriptor> = {
|
|
openclaw: {
|
|
label: 'OpenClaw',
|
|
classes: 'bg-clawd-accent/20 text-clawd-accent border border-clawd-accent/40',
|
|
},
|
|
nanoclaw: {
|
|
label: 'NanoClaw',
|
|
classes: 'bg-clawd-secondary/20 text-clawd-secondary border border-clawd-secondary/40',
|
|
},
|
|
hermes: {
|
|
label: 'Hermes',
|
|
classes: 'bg-emerald-500/20 text-emerald-300 border border-emerald-400/40',
|
|
},
|
|
};
|
|
|
|
const CORE_PLATFORM_SET = new Set<string>(CORE_PLATFORM_SLUGS);
|
|
|
|
export const isCorePlatformSlug = (platform: string) =>
|
|
CORE_PLATFORM_SET.has(normalizePlatformSlug(platform));
|
|
|
|
export const getPlatformDescriptor = (platform: string): PlatformDescriptor => {
|
|
const normalized = normalizePlatformSlug(platform);
|
|
return PLATFORM_DESCRIPTOR_BY_SLUG[normalized] ?? {
|
|
label: platform.trim() || platform,
|
|
classes: 'bg-clawd-700 text-gray-300 border border-clawd-600',
|
|
};
|
|
};
|