PageSourceSearch

https://anonymous-p2p-chat.nobogga.chatgpt.site/replica-freshness.js

js anonymous-p2p-chat.nobogga.chatgpt.site collected 2026-10-03 03:58:57 UTC 1,365 bytes, 34 lines download raw bytes

1export const SITE_REPLICA_WRITE_WINDOW_MS = 60 * 60 * 1000;
2
3function safeTimestamp(value) {
4  return Number.isSafeInteger(value) && value >= 0 ? value : null;
5}
6
7export function getReplicaStatus(siteId, metadata = null, now = Date.now()) {
8  const createdAt = safeTimestamp(metadata?.createdAt);
9  const verifiedAt = safeTimestamp(metadata?.verifiedAt);
10  const copyAgeMs = createdAt === null ? null : Math.max(0, now - createdAt);
11  const freshnessAt = verifiedAt === null ? createdAt : Math.max(createdAt ?? verifiedAt, verifiedAt);
12  const ageMs = freshnessAt === null ? null : Math.max(0, now - freshnessAt);
13  return {
14    siteId,
15    createdAt,
16    verifiedAt,
17    copyAgeMs,
18    ageMs,
19    verificationAgeMs: verifiedAt === null ? null : Math.max(0, now - verifiedAt),
20    freshnessAt,
21    writable: freshnessAt !== null && ageMs <= SITE_REPLICA_WRITE_WINDOW_MS,
22    expiresAt: freshnessAt === null ? null : freshnessAt + SITE_REPLICA_WRITE_WINDOW_MS,
23    sourcePeerId: metadata?.sourcePeerId || null,
24    handoffId: metadata?.handoffId || null,
25  };
26}
27
28export function isNewReplicaHandoff(previous, sourcePeerId, handoffId) {
29  return !previous || previous.sourcePeerId !== sourcePeerId || previous.handoffId !== handoffId;
30}
31
32export function shouldRecordReplicaCompletion(wasComplete, isComplete) {
33  return wasComplete !== true && isComplete === true;
34}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.