This commit is contained in:
lda committed 2025-12-18 03:08:14 +07:00
1 parent 5a1ae7f842
commit ebab37fc00
3 files changed
+27 -18

No files matched your search

+5 -4
View File
@@ -1,5 +1,4 @@
{% macro magic_link(url, text, unique_id='magic_link') %} {% macro magic_link(url, text, unique_id='magic_link') %} {# Example Macro #}
{# Example Macro #}
<a <a
href="{{ url }}" href="{{ url }}"
target="_blank" target="_blank"
@@ -24,13 +23,15 @@
}); });
})(); })();
</script> </script>
{% endmacro %} {% macro qrcode_queue(queue_items) %} {% if queue_items %} {% endmacro %} {% macro qrcode_queue(queue_items, qr_limit = 100) %} {% if
queue_items %}
<ol class="queue-grid"> <ol class="queue-grid">
{% for item in queue_items %} {% for item in queue_items %}
<li> <li>
<a href="{{ item }}" target="_blank" rel="noreferrer noopener"> <a href="{{ item }}" target="_blank" rel="noreferrer noopener">
{{ item }} {{ item }} {% if not loop.index > qr_limit %}
<div class="qrcode"></div> <div class="qrcode"></div>
{% endif %}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
+20 -12
View File
@@ -9,11 +9,12 @@
href="{{ url_for('static', path='style.css') }}" href="{{ url_for('static', path='style.css') }}"
/> />
</head> </head>
<body> <body>
{% if queue_length > 0 %} {% if queue_length > 0 %}
<div class="trail-container"> <div class="trail-container">
<div class="trail-count">{{ queue_length }}</div> <div class="trail-count">{{ queue_length }}</div>
<p>Items Left</p> <p>items left</p>
<p <p
style=" style="
@@ -35,22 +36,29 @@
<div class="trail-hint">Tap anywhere to open & next</div> <div class="trail-hint">Tap anywhere to open & next</div>
</div> </div>
<script> <script>
if (window.opener) {
// new tab = window open no "noopener".
console.log(/** @type {Window} */ (window.opener)); // hi hello hi
}
window.addEventListener("load", () => { window.addEventListener("load", () => {
document.body.addEventListener("click", async (e) => { document.body.addEventListener("click", (e) => {
if (e.target.tagName === "A") return; if (e.target.tagName === "A") return;
// now this is not the new updated
const newTab = window.open("", "_blank");
// do trix // do trix
await fetch("/r", { redirect: "manual" }); if (newTab) {
// background
if (newTab.document.body) {
newTab.document.body.style.backgroundColor =
getComputedStyle(document.body).backgroundColor;
}
// now this is the new updated newTab.addEventListener("message", () => {
const newTab = window.open(window.location.href, "_blank"); // Swap roles: Current tab -> Content, New tab -> Controller
location.replace("/r");
// yo this is good no security error newTab.opener = null;
window.location.replace("{{ current_link }}"); newTab.location.replace(window.location.href);
});
// Trigger the message event to run the swap on the next tick
newTab.postMessage("");
}
}); });
}); });
</script> </script>
Generated
+2 -2
View File
@@ -291,9 +291,9 @@ dependencies = [
requires-dist = [ requires-dist = [
{ name = "fastapi" }, { name = "fastapi" },
{ name = "flask" }, { name = "flask" },
{ name = "pydantic", specifier = ">=2.12.5" }, { name = "pydantic" },
{ name = "python-multipart" }, { name = "python-multipart" },
{ name = "qrcode", specifier = ">=8.2" }, { name = "qrcode" },
{ name = "uvicorn" }, { name = "uvicorn" },
] ]