Compare commits
4 commits
main
...
profile-in
| Author | SHA1 | Date | |
|---|---|---|---|
|
5f5e113c00 |
|||
|
487e9e19e7 |
|||
|
672d33f33d |
|||
|
2fd0bfdc6b |
4 changed files with 64 additions and 11 deletions
BIN
Firefox.zip
Normal file
BIN
Firefox.zip
Normal file
Binary file not shown.
|
|
@ -60,3 +60,9 @@ if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||||
exec cage firefox --kiosk https://c3nav.de
|
exec cage firefox --kiosk https://c3nav.de
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
mkdir -p /home/kiosk/.mozilla/firefox
|
||||||
|
curl -fsSL -o /tmp/Firefox.zip "https://git.hamburg.ccc.de/Firefox.zip"
|
||||||
|
unzip -o /tmp/Firefox.zip -d /home/kiosk/.mozilla/firefox
|
||||||
|
chown -R kiosk:kiosk /home/kiosk/.mozilla/firefox
|
||||||
|
rm -f /tmp/Firefox.zip
|
||||||
|
|
@ -53,6 +53,7 @@ d-i pkgsel/include string \
|
||||||
sudo \
|
sudo \
|
||||||
cage \
|
cage \
|
||||||
firefox-esr \
|
firefox-esr \
|
||||||
|
unzip \
|
||||||
curl
|
curl
|
||||||
|
|
||||||
d-i pkgsel/exclude string gnome-software
|
d-i pkgsel/exclude string gnome-software
|
||||||
|
|
@ -64,4 +65,4 @@ d-i finish-install/reboot_in_progress note
|
||||||
d-i preseed/late_command string \
|
d-i preseed/late_command string \
|
||||||
in-target curl -o /tmp/post_install.sh https://git.hamburg.ccc.de/ViMaSter/preseed/raw/branch/main/post_install.sh; \
|
in-target curl -o /tmp/post_install.sh https://git.hamburg.ccc.de/ViMaSter/preseed/raw/branch/main/post_install.sh; \
|
||||||
in-target chmod +x /tmp/post_install.sh; \
|
in-target chmod +x /tmp/post_install.sh; \
|
||||||
in-target /tmp/post_install.sh
|
in-target /tmp/post_install.sh;
|
||||||
|
|
@ -9,22 +9,31 @@
|
||||||
// @grant GM_addStyle
|
// @grant GM_addStyle
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
|
const target = "https://kiosk.39c3.by.vincent.mahn.ke/";
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// if the user is on target already or subdomain, do nothing
|
||||||
|
if (window.location.href === target || window.location.href.startsWith(target + '/')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement('button');
|
||||||
btn.textContent = 'Home';
|
btn.textContent = 'Home';
|
||||||
btn.style.cssText = ' all: unset; box-sizing: border-box; border: 2px solid #141414; background: #faf5f5; text-align: center; color: #141414; position: fixed; right: 10px; bottom: 10px; width: 60px; height: 60px; z-index: 2147483647; padding-top: 6px; border-radius: 60px;';
|
btn.style.cssText = ' all: unset; box-sizing: border-box; border: 2px solid #141414; background: #faf5f5; text-align: center; color: #141414; position: fixed; right: 10px; bottom: 10px; width: 60px; height: 60px; z-index: 2147483647; padding-top: 6px; border-radius: 60px;';
|
||||||
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-house-icon lucide-house"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>';
|
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-house-icon lucide-house"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>';
|
||||||
btn.addEventListener('click', () => {
|
btn.addEventListener('click', () => {
|
||||||
window.location.href = 'http://127.0.0.1:8080';
|
window.location.href = target;
|
||||||
});
|
});
|
||||||
(document.body || document.documentElement).appendChild(btn);
|
(document.body || document.documentElement).appendChild(btn);
|
||||||
|
|
||||||
|
|
||||||
const IDLE_LIMIT_MS = 30_000; // 30 seconds
|
const IDLE_LIMIT_MS = 60_000;
|
||||||
let idleTimer = null;
|
let idleTimer = null;
|
||||||
let promptVisible = false;
|
let promptVisible = false;
|
||||||
|
const PROMPT_LIMIT_MS = 30_000;
|
||||||
|
let promptInterval = null;
|
||||||
|
let promptTimeout = null;
|
||||||
|
|
||||||
const modal = document.createElement('div');
|
const modal = document.createElement('div');
|
||||||
modal.id = 'idle-modal';
|
modal.id = 'idle-modal';
|
||||||
|
|
@ -46,6 +55,7 @@
|
||||||
<p>Do you want to stay on this page or go back to the home page?</p>
|
<p>Do you want to stay on this page or go back to the home page?</p>
|
||||||
<button id="idle-stay">Stay</button>
|
<button id="idle-stay">Stay</button>
|
||||||
<button id="idle-go">Go to Home</button>
|
<button id="idle-go">Go to Home</button>
|
||||||
|
<p id="idle-countdown-msg" style="margin-top:8px">Auto return in <span id="idle-countdown">30</span>s</p>
|
||||||
`;
|
`;
|
||||||
document.body.appendChild(modal);
|
document.body.appendChild(modal);
|
||||||
|
|
||||||
|
|
@ -76,21 +86,57 @@
|
||||||
promptVisible = true;
|
promptVisible = true;
|
||||||
modal.hidden = false;
|
modal.hidden = false;
|
||||||
backdrop.hidden = false;
|
backdrop.hidden = false;
|
||||||
debugger;
|
|
||||||
// Move focus to the primary action for accessibility
|
// Clear any previous prompt timers
|
||||||
document.querySelector("#idle-stay").addEventListener("click", () => {
|
if (promptInterval) { clearInterval(promptInterval); promptInterval = null; }
|
||||||
|
if (promptTimeout) { clearTimeout(promptTimeout); promptTimeout = null; }
|
||||||
|
|
||||||
|
// Wire button actions (once to avoid duplicates)
|
||||||
|
const stayBtn = document.querySelector("#idle-stay");
|
||||||
|
const goBtn = document.querySelector("#idle-go");
|
||||||
|
|
||||||
|
if (stayBtn) {
|
||||||
|
stayBtn.addEventListener("click", () => {
|
||||||
hidePrompt();
|
hidePrompt();
|
||||||
resetIdleTimer();
|
resetIdleTimer();
|
||||||
});
|
}, { once: true });
|
||||||
document.querySelector("#idle-go").addEventListener("click", () => {
|
}
|
||||||
window.location.href = 'https://www.google.com';
|
|
||||||
});
|
if (goBtn) {
|
||||||
|
goBtn.addEventListener("click", () => {
|
||||||
|
window.location.href = target;
|
||||||
|
}, { once: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 30s countdown visible to the user
|
||||||
|
let remaining = PROMPT_LIMIT_MS / 1000; // seconds
|
||||||
|
const countdownEl = document.querySelector("#idle-countdown");
|
||||||
|
if (countdownEl) countdownEl.textContent = String(remaining);
|
||||||
|
|
||||||
|
promptInterval = setInterval(() => {
|
||||||
|
remaining -= 1;
|
||||||
|
if (remaining >= 0 && countdownEl) {
|
||||||
|
countdownEl.textContent = String(remaining);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
// Auto-go when expired
|
||||||
|
promptTimeout = setTimeout(() => {
|
||||||
|
const go = document.querySelector("#idle-go");
|
||||||
|
if (go) {
|
||||||
|
go.click();
|
||||||
|
} else {
|
||||||
|
window.location.href = target;
|
||||||
|
}
|
||||||
|
}, PROMPT_LIMIT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidePrompt() {
|
function hidePrompt() {
|
||||||
promptVisible = false;
|
promptVisible = false;
|
||||||
modal.hidden = true;
|
modal.hidden = true;
|
||||||
backdrop.hidden = true;
|
backdrop.hidden = true;
|
||||||
|
if (promptInterval) { clearInterval(promptInterval); promptInterval = null; }
|
||||||
|
if (promptTimeout) { clearTimeout(promptTimeout); promptTimeout = null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function onIdle() {
|
function onIdle() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue