diff --git a/Modules/Packages/Detect Age.js b/Modules/Packages/Detect Age.js index 5226d55..e5d4d8d 100644 --- a/Modules/Packages/Detect Age.js +++ b/Modules/Packages/Detect Age.js @@ -1,3 +1,4 @@ +import DOMPurify from 'dompurify'; //Detect Age async function detectAge(data) { const existingElement = document.querySelector('[data-role="dynamic-image"]') || document.querySelector('video[data-role="dynamic-video"]') || document.querySelector('[data-role="dynamic-dragged"]'); @@ -23,7 +24,8 @@ async function detectAge(data) { img.style.maxHeight = '500px'; img.setAttribute('data-role', 'dynamic-image'); - const imgSrc = imagedir + data; + const sanitizedData = DOMPurify.sanitize(data); + const imgSrc = imagedir + sanitizedData; img.src = imgSrc; // Check if the image source is valid @@ -57,7 +59,6 @@ async function detectAge(data) { // Handle image load error img.onerror = () => { - echo('Failed to load image.'); }; } \ No newline at end of file