diff --git a/backend/src/federation/index.ts b/backend/src/federation/index.ts index 8974c4e45..2ca58b432 100644 --- a/backend/src/federation/index.ts +++ b/backend/src/federation/index.ts @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import DHT from '@hyperswarm/dht' -import { Connection } from '@dbTools/typeorm' +// import { Connection } from '@dbTools/typeorm' import { backendLogger as logger } from '@/server/logger' function between(min: number, max: number) { @@ -22,7 +22,7 @@ const nodeAPI = { } export const startDHT = async ( - connection: Connection, + // connection: Connection, topic: string, ): Promise => { try { @@ -71,9 +71,6 @@ export const startDHT = async ( const collectedPubKeys: string[] = [] for await (const data of result) { - /* console.log( - `${data.from.host}:${data.from.port}: peers: ${data.peers.length}` - ); */ data.peers.forEach((peer: any) => { const pubKey = peer.publicKey.toString('hex') if ( @@ -93,13 +90,13 @@ export const startDHT = async ( // publicKey here is keyPair.publicKey from above const socket = node.connect(Buffer.from(remotePubKey, 'hex')) - /* socket.once("connect", function () { - console.log("client side emitted connect"); - }); */ + // socket.once("connect", function () { + // console.log("client side emitted connect"); + // }); - /* socket.once("end", function () { - console.log("client side ended"); - }); */ + // socket.once("end", function () { + // console.log("client side ended"); + // }); socket.once('error', (err: any) => { errorfulRequests.push(remotePubKey) diff --git a/backend/src/index.ts b/backend/src/index.ts index 5c0f0c293..dc1bbb115 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -7,7 +7,7 @@ import { startDHT } from '@/federation/index' import CONFIG from './config' async function main() { - const { app, con } = await createServer() + const { app } = await createServer() app.listen(CONFIG.PORT, () => { // eslint-disable-next-line no-console @@ -20,7 +20,7 @@ async function main() { // start DHT hyperswarm when DHT_TOPIC is set in .env if (CONFIG.DHT_TOPIC) { - await startDHT(con, CONFIG.DHT_TOPIC) + await startDHT(CONFIG.DHT_TOPIC) // con, } } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 6a59eb2c0..2e5a8b5b2 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -4,7 +4,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ + "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */