MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / toggleScanMode

Function toggleScanMode

web/scripts/ragnar_modern.js:19710–19729  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

19708// Shared-to-the-mesh case: flag when a peer has shared more files than we last
19709// saw. Baselines silently on first observation so pre-existing shares don't flag.
19710function refreshSharedFlag() {
19711 networkAwareFetch('/api/mesh/share')
19712 .then(r => r.json())
19713 .then(d => {
19714 const peerCount = ((d && d.items) || []).filter(i => !i.is_local).length;
19715 let raw = null;
19716 try { raw = localStorage.getItem('mesh_share_seen'); } catch (e) { /* ignore */ }
19717 if (raw === null) {
19718 try { localStorage.setItem('mesh_share_seen', String(peerCount)); } catch (e) { /* ignore */ }
19719 _filesFlagSharedNew = false;
19720 } else {
19721 _filesFlagSharedNew = peerCount > (parseInt(raw, 10) || 0);
19722 }
19723 _applyFilesFlag();
19724 })
19725 .catch(() => { /* silent — background check */ });
19726}
19727// Everything currently shared is now "seen" (called when Mesh Share is opened).
19728function markSharedSeen(peerCount) {
19729 try { localStorage.setItem('mesh_share_seen', String(peerCount || 0)); } catch (e) { /* ignore */ }
19730 _filesFlagSharedNew = false;
19731 _applyFilesFlag();
19732}

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected