fix: remove mandatory validation for ReportCollection fields

Remove the validation that required target_url, expected_domain, and
entry_script meta tags for ReportCollection scenes. Third-party scenes
do not have these meta tags, so the generator now uses empty values
that users can manually edit in scene.toml.

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-17 00:09:12 +08:00
parent b5131c858a
commit 464f18c672

View File

@@ -109,31 +109,8 @@ pub fn analyze_scene_source_with_hint(
let expected_domain = meta_content(&html, "sgclaw-expected-domain"); let expected_domain = meta_content(&html, "sgclaw-expected-domain");
let entry_script = meta_content(&html, "sgclaw-entry-script"); let entry_script = meta_content(&html, "sgclaw-entry-script");
// Validate required fields based on scene kind // All fields are optional - generator will use placeholders for missing values
match scene_kind { // This allows third-party scenes without meta tags to be processed
SceneKind::ReportCollection => {
// ReportCollection requires target_url, expected_domain, and entry_script
if target_url.as_deref().unwrap_or_default().trim().is_empty()
|| expected_domain
.as_deref()
.unwrap_or_default()
.trim()
.is_empty()
|| entry_script
.as_deref()
.unwrap_or_default()
.trim()
.is_empty()
{
return Err(AnalyzeSceneError::new(
"report_collection scene requires target_url, expected_domain, and entry_script",
));
}
}
SceneKind::Monitoring => {
// Monitoring type has optional fields - no validation needed
}
}
Ok(SceneSourceAnalysis { Ok(SceneSourceAnalysis {
scene_kind, scene_kind,