This commit is contained in:
andreyflat 2025-08-19 03:58:16 +08:00
parent 6217ca412c
commit 6636f6698b

View file

@ -442,23 +442,35 @@ const videoObserver = new IntersectionObserver((entries, observer) => {
</script> </script>
<script> <script>
(function () { window.addEventListener("load", () => {
const secret = "flat_secret_123"; // тот же, что в Netlify → SECRET_KEY try {
const url = "/.netlify/functions/privateViewLogger?key=" + encodeURIComponent(secret) + "&t=" + Date.now(); if (sessionStorage.getItem("af_logged")) return; // не спамим: 1 раз за сессию
sessionStorage.setItem("af_logged", "1");
const secret = "flat_secret_123"; // тот же, что в Netlify → SECRET_KEY
const url = "/.netlify/functions/privateViewLogger"
+ "?key=" + encodeURIComponent(secret)
+ "&path=" + encodeURIComponent(location.pathname)
+ "&t=" + Date.now(); // ломаем кэш
if (navigator.sendBeacon) {
const body = JSON.stringify({ path: location.pathname });
navigator.sendBeacon(url, body);
} else {
fetch(url, { fetch(url, {
method: "POST", method: "POST",
keepalive: true, keepalive: true,
headers: { "content-type": "application/json", "cache-control": "no-store" }, headers: { "content-type": "application/json" },
body: JSON.stringify({ path: location.pathname }) body: JSON.stringify({ path: location.pathname })
}) }).catch(() => {});
.then(r => r.text().then(t => console.log("logger:", r.status, t))) }
.catch(e => console.log("logger error:", e)); } catch {}
})(); });
</script> </script>
<button id="scrollToTopBtn" title="Rewind">&#8679;</button> <button id="scrollToTopBtn" title="Rewind">&#8679;</button>
<script> <script>