tidy logs. Add all files to service worker

This commit is contained in:
2025-05-26 19:09:30 -07:00
parent 125c51b3b7
commit 2ff634ddf0
10 changed files with 36 additions and 2681 deletions

View File

@@ -43,6 +43,7 @@ export class PeerManager {
messageSuperlog = false;
watchdogInterval: number = 0;
reconnectTimer: number | null = null;
peerStateSuperlog: boolean = false;
// async watchdog() {
// // Check that we're connected to at least N peers. If not, reconnect to the bootstrap server.
@@ -151,7 +152,7 @@ export class PeerManager {
}
if (!bootstrapPeerID) {
// console.log.apply(null, log("Didn't get bootstrap peer, waiting 10 seconds..."));
console.log.apply(null, log("Didn't get bootstrap peer, waiting 10 seconds..."));
// let callSendHello2OnTimeout = () => { console.log(this, "jajajajaj");this.sendHello2() };
// setTimeout(callSendHello2OnTimeout, 5_000);
return;
@@ -323,7 +324,7 @@ export class PeerManager {
}
onPeerConnected(peerID: PeerID) {
console.log.apply(null, log(`PeerManager: Successfully connected to peer ${peerID}`));
this.peerStateSuperlog && console.log.apply(null, log(`PeerManager: Successfully connected to peer ${peerID}`));
this.dispatchEvent(PeerEventTypes.PEER_CONNECTED, { peerID: peerID });
}
@@ -470,7 +471,7 @@ class PeerConnection {
iceServers: [
{ urls: "stun:ddln.app" },
{ urls: "turn:ddln.app", username: "a", credential: "b" },
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not return ipv6
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
// { urls: "stun:stun1.l.google.com" },
// { urls: "stun:stun2.l.google.com" },
// { urls: "stun:stun3.l.google.com" },

View File

@@ -39,8 +39,8 @@ export class Sync {
userIDsToSync: Set<string> = new Set();
syncSuperlog: boolean = false;
setArchive(isHeadless: boolean) {
this.isArchivePeer = isHeadless;
setArchive(isArchive: boolean) {
this.isArchivePeer = isArchive;
}
setUserID(userID: string) {
@@ -130,6 +130,14 @@ export class Sync {
let following = ['a0e42390-08b5-4b07-bc2b-787f8e5f1297']; // Follow BMO by default :)
following.push(this.userID);
// Hazel
if (userID == '622ecc28-2eff-44b9-b89d-fdea7c8dd2d5') {
following.push(...[
'8f6802be-c3b6-46c1-969c-5f90cbe01479', // Fiona
'622ecc28-2eff-44b9-b89d-fdea7c8dd2d5', // Hazel
]);
}
// Rob
if (userID === 'b38b623c-c3fa-4351-9cab-50233c99fa4e') {
following.push(...[
@@ -137,6 +145,7 @@ export class Sync {
'05a495a0-0dd8-4186-94c3-b8309ba6fc4c', // Martin
'bba3ad24-9181-4e22-90c8-c265c80873ea', // Harry
'8f6802be-c3b6-46c1-969c-5f90cbe01479', // Fiona
'622ecc28-2eff-44b9-b89d-fdea7c8dd2d5', // Hazel
]);
}

View File

@@ -281,7 +281,7 @@ export async function checkPostIds(userID: string, post_ids: string[]) {
}
}
console.log(`checkPostIds need ${postIdsNeeded.length} posts`);
// console.log(`checkPostIds need ${postIdsNeeded.length} posts`);
return postIdsNeeded;
} catch (error) {
console.error("Error in opening database:", error);

View File

@@ -32,6 +32,9 @@ export function log(...args: any[]): any {
let logLine = `[${new Date().toLocaleTimeString()}]: `;
for (let arg of args) {
let completeLine = (typeof arg === "string" || arg instanceof String) ? arg : JSON.stringify(arg, null, 4);
if (completeLine === undefined) {
completeLine = "undefined";
}
logLine += completeLine.substring(0, 500);
}
logLines.push(logLine + "\n");
@@ -42,5 +45,5 @@ export function log(...args: any[]): any {
renderLog();
return [...args];
return [logLine];// [...args];
}

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,11 @@ const contentToCache = [
'/static/db.js',
'/static/PeerManager.js',
'/static/IDUtils.js',
'/static/dataUtils.js',
'/static/App.js',
'/static/Sync.js',
'/static/IDUtils.js',
'/static/log.js',
'/static/favicon.ico'
];