ai #4

Merged
ssa merged 2 commits from ai into main 2026-02-19 00:18:59 +03:00
Showing only changes of commit 529b506612 - Show all commits

View File

@@ -52,7 +52,13 @@ export function ConfigTemplate(props: ConfigTemplateProps) {
try { try {
if (value.trim()) { if (value.trim()) {
// Replace @placeholders@ with valid JSON values for validation // Replace @placeholders@ with valid JSON values for validation
const sanitizedValue = value.replace(/"@?(\w+)@?"/g, '"__PLACEHOLDER__"'); // Handle both quoted "@placeholder@" and unquoted @placeholder@
let sanitizedValue = value
// Replace quoted placeholders: "@host@" -> "__PLACEHOLDER__"
.replace(/"@[^"]+@"/g, '"__PLACEHOLDER__"')
// Replace unquoted placeholders between : and , or } : @port@ -> "__PLACEHOLDER__"
.replace(/:\s*@[^,\s}]+@/g, ': "__PLACEHOLDER__"');
JSON.parse(sanitizedValue); JSON.parse(sanitizedValue);
setJsonError(null); setJsonError(null);
} else { } else {