generated from nathanwoodburn/python-webserver-template
fix: Set https in prod
All checks were successful
Build Docker / BuildImage (push) Successful in 30s
All checks were successful
Build Docker / BuildImage (push) Successful in 30s
This commit is contained in:
@@ -69,6 +69,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
<div class="card-header bg-success text-white py-3 d-flex justify-content-between align-items-center">
|
||||
<h3 class="h5 mb-0">Result for ${escapeHtml(url)}</h3>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-light ms-2" id="new-tab">
|
||||
<i class="bi bi-code-slash me-1"></i>View in new tab
|
||||
</button>
|
||||
<button class="btn btn-sm btn-light ms-2" id="view-source">
|
||||
<i class="bi bi-code-slash me-1"></i>View Source
|
||||
</button>
|
||||
@@ -84,6 +87,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
// Get reference to the iframe and buttons
|
||||
const iframe = document.getElementById('result-iframe');
|
||||
const viewSourceButton = document.getElementById('view-source');
|
||||
const newTabButton = document.getElementById('new-tab');
|
||||
|
||||
const cleanedHtml = removeScripts(data.result);
|
||||
|
||||
@@ -93,6 +97,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
// Set the iframe src to the blob URL
|
||||
iframe.src = blobUrl;
|
||||
|
||||
|
||||
// Add event listener to view source button
|
||||
viewSourceButton.addEventListener('click', function () {
|
||||
@@ -113,6 +118,15 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
sourceWindow.document.close();
|
||||
});
|
||||
|
||||
// Add event listener to new tab button
|
||||
newTabButton.addEventListener('click', function () {
|
||||
// Get URL from window.location
|
||||
const proxyurl = `${window.location.protocol}//${window.location.host}/proxy/${url}`;
|
||||
|
||||
// Open host/proxy/url in new tab
|
||||
window.open(proxyurl, '_blank');
|
||||
});
|
||||
|
||||
// Set up cleanup when iframe is no longer needed
|
||||
window.addEventListener('beforeunload', function () {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
|
||||
Reference in New Issue
Block a user