diff --git a/views/admin/mapper.ejs b/views/admin/mapper.ejs index 2d3fdd6..1a21e51 100644 --- a/views/admin/mapper.ejs +++ b/views/admin/mapper.ejs @@ -27,7 +27,7 @@ - +
URL을 입력하고 "페이지 가져오기"를 클릭하세요
@@ -134,7 +134,12 @@ async function fetchPage() { document.getElementById('status-bar').textContent = '페이지 로딩 중...'; try { - var res = await api('POST', '/api/fetch-page', { url: url }); + var resp = await fetch('/api/fetch-page', { + method: 'POST', headers: {'Content-Type':'application/json'}, credentials: 'same-origin', + body: JSON.stringify({ url: url }) + }); + if (!resp.ok) { var err = await resp.json().catch(function(){return {error:'HTTP '+resp.status}}); throw new Error(err.error || 'HTTP '+resp.status); } + var res = await resp.json(); if (res.error) throw new Error(res.error); var frame = document.getElementById('preview-frame'); @@ -145,6 +150,10 @@ async function fetchPage() { var baseTag = ''; html = html.replace(/]*)>/i, '' + baseTag); + // Mixed Content 방지: http → https 변환 (리소스 URL만) + html = html.replace(/(src|href|action)=(["'])http:\/\//gi, '$1=$2https://'); + html = html.replace(/url\((['"]?)http:\/\//gi, 'url($1https://'); + // iframe에 매퍼 스크립트 주입 var mapperScript = getMapperScript(); html = html.replace(/<\\/body>/i, mapperScript + '');