update cdn checker

This commit is contained in:
Jonathan
2025-10-26 01:44:44 +07:00
parent 8688861372
commit ab4451539c
+13 -7
View File
@@ -225,16 +225,22 @@ class CDN(Challenge):
self.logger.error(f" ✗ View post failed: {e}")
return False
# [9/9] Metadata must be real ExifTool output (no fallbacks)
self.logger.info("[9/9] Verifying metadata via /post/<id> (ExifTool) ...")
# [9/9] Metadata must appear somewhere in the post HTML (no fallback)
self.logger.info("[9/9] Verifying metadata presence (File Name / Date Created) ...")
try:
mr = s.get(base_url + f"/post/{created_post_id}", timeout=10)
assert mr.status_code == 200, f"Meta HTTP {mr.status_code}"
meta = (mr.text or "").strip()
assert meta, "Empty metadata"
assert "no-metadata" not in meta and "exif_err:" not in meta, "App fallback metadata detected"
assert all(k in meta for k in self._exif_must_have), "Metadata is not ExifTool output"
self.logger.info(" ✓ Metadata present and produced by ExifTool")
html = (mr.text or "")
assert html.strip(), "Empty metadata HTML"
# Reject app fallbacks
assert "no-metadata" not in html and "exif_err:" not in html, "App fallback metadata detected"
# Required keys appear anywhere in the HTML
assert "File Name:" in html, "Missing 'File Name:' in post HTML"
assert "Date Created:" in html, "Missing 'Date Created:' in post HTML"
self.logger.info(" ✓ Required metadata keys found in page HTML")
except Exception as e:
self.logger.error(f" ✗ Metadata verification failed: {e}")
return False