Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,29 @@ const searchForm = document.getElementById("searchForm");
const errorMessage = document.getElementById("errorMessage");
let debounceTimeout;

// Detect if the browser is running on an e-reader or tablet
function isEreaderOrTablet() {
const ua = navigator.userAgent.toLowerCase();
return (
ua.includes("kindle") ||
ua.includes("kobo") ||
ua.includes("silk") ||
ua.includes("playbook") ||
ua.includes("tablet")
);
}

// Detect if the browser is in a P2P environment
function isP2PEnvironment() {
const protocol = window.location.protocol;
const isIpfs = protocol.startsWith("ipfs") || protocol.startsWith("ipns");
const ua = navigator.userAgent.toLowerCase();

// P2P browser detection
const isPeersky = ua.includes("peersky");
const isAgregore = ua.includes("agregore");
return isIpfs || isPeersky || isAgregore;

return (isIpfs || isPeersky || isAgregore) && !isEreaderOrTablet();
}

function getIpfsBaseUrl() {
Expand Down