tidy logs. Add all files to service worker
This commit is contained in:
@@ -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" },
|
||||
|
||||
13
src/Sync.ts
13
src/Sync.ts
@@ -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
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
1569
src/main2.ts
1569
src/main2.ts
File diff suppressed because it is too large
Load Diff
@@ -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'
|
||||
];
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ export async function checkPostIds(userID, post_ids) {
|
||||
console.error("Error processing post:", error);
|
||||
}
|
||||
}
|
||||
console.log(`checkPostIds need ${postIdsNeeded.length} posts`);
|
||||
// console.log(`checkPostIds need ${postIdsNeeded.length} posts`);
|
||||
return postIdsNeeded;
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
"IDUtils": "/static/IDUtils.js",
|
||||
"PeerManager": "/static/PeerManager.js",
|
||||
"log": "/static/log.js",
|
||||
"Sync": "/static/Sync.js"
|
||||
"Sync": "/static/Sync.js",
|
||||
"App": "/static/App.js",
|
||||
"dataUtils": "/static/dataUtils.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
1105
static/main2.js
1105
static/main2.js
File diff suppressed because it is too large
Load Diff
@@ -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'
|
||||
];
|
||||
self.addEventListener("install", (e) => {
|
||||
|
||||
Reference in New Issue
Block a user