minio 테스트 인증정보 삭제, 변수 처리 완료
All checks were successful
Build And Test / build-and-push (push) Successful in 4m25s

This commit is contained in:
2025-01-26 01:16:26 +09:00
parent d8111f6070
commit 1d38fe26bd
9 changed files with 381 additions and 52 deletions

View File

@ -13,7 +13,7 @@
by.
{{ post.author | upper }}</div>
<!-- Rendered Markdown Content -->
<div>
<div id="post-content">
{{ post.render_markdown|safe }}
</div>
<hr>
@ -50,9 +50,50 @@
hljs.highlightElement(block);
});
});
</script>
<!-- Delete post -->
<script>
// Function to update images with presigned URLs
async function updateImagesWithPresignedUrls() {
const contentDiv = document.getElementById("post-content");
const contentHtml = contentDiv.innerHTML;
const parser = new DOMParser();
const doc = parser.parseFromString(contentHtml, "text/html");
const images = doc.querySelectorAll("img");
for (const img of images) {
const objectName = img.getAttribute("src"); // src에 저장된 object_name
try {
const response = await fetch("/obs_minio/get_presigned_url/", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({object_name: objectName})
});
if (response.ok) {
const data = await response.json();
img.setAttribute("src", data.presigned_url); // Presigned URL로 src 업데이트
}
} catch (error) {
console.error("Error fetching presigned URL:", error);
}
}
// 업데이트된 HTML을 다시 삽입
contentDiv.innerHTML = doc.body.innerHTML;
// Reapply syntax highlighting
document
.querySelectorAll("pre code")
.forEach((block) => {
hljs.highlightElement(block);
});
}
// Call the function when the page loads
document.addEventListener("DOMContentLoaded", updateImagesWithPresignedUrls);
// Delete post
document
.getElementById("delete-button")
.addEventListener("click", function () {
@ -64,4 +105,4 @@
}
});
</script>
{% endblock %}
{% endblock %}