linting, etc.

This commit is contained in:
Moriz Wahl 2022-11-07 13:16:22 +01:00
parent 8aac319895
commit 7efd2ffca3
3 changed files with 11 additions and 14 deletions

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import DHT from '@hyperswarm/dht' import DHT from '@hyperswarm/dht'
import { Connection } from '@dbTools/typeorm' // import { Connection } from '@dbTools/typeorm'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
function between(min: number, max: number) { function between(min: number, max: number) {
@ -22,7 +22,7 @@ const nodeAPI = {
} }
export const startDHT = async ( export const startDHT = async (
connection: Connection, // connection: Connection,
topic: string, topic: string,
): Promise<void> => { ): Promise<void> => {
try { try {
@ -71,9 +71,6 @@ export const startDHT = async (
const collectedPubKeys: string[] = [] const collectedPubKeys: string[] = []
for await (const data of result) { for await (const data of result) {
/* console.log(
`${data.from.host}:${data.from.port}: peers: ${data.peers.length}`
); */
data.peers.forEach((peer: any) => { data.peers.forEach((peer: any) => {
const pubKey = peer.publicKey.toString('hex') const pubKey = peer.publicKey.toString('hex')
if ( if (
@ -93,13 +90,13 @@ export const startDHT = async (
// publicKey here is keyPair.publicKey from above // publicKey here is keyPair.publicKey from above
const socket = node.connect(Buffer.from(remotePubKey, 'hex')) const socket = node.connect(Buffer.from(remotePubKey, 'hex'))
/* socket.once("connect", function () { // socket.once("connect", function () {
console.log("client side emitted connect"); // console.log("client side emitted connect");
}); */ // });
/* socket.once("end", function () { // socket.once("end", function () {
console.log("client side ended"); // console.log("client side ended");
}); */ // });
socket.once('error', (err: any) => { socket.once('error', (err: any) => {
errorfulRequests.push(remotePubKey) errorfulRequests.push(remotePubKey)

View File

@ -7,7 +7,7 @@ import { startDHT } from '@/federation/index'
import CONFIG from './config' import CONFIG from './config'
async function main() { async function main() {
const { app, con } = await createServer() const { app } = await createServer()
app.listen(CONFIG.PORT, () => { app.listen(CONFIG.PORT, () => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
@ -20,7 +20,7 @@ async function main() {
// start DHT hyperswarm when DHT_TOPIC is set in .env // start DHT hyperswarm when DHT_TOPIC is set in .env
if (CONFIG.DHT_TOPIC) { if (CONFIG.DHT_TOPIC) {
await startDHT(con, CONFIG.DHT_TOPIC) await startDHT(CONFIG.DHT_TOPIC) // con,
} }
} }

View File

@ -4,7 +4,7 @@
/* Basic Options */ /* Basic Options */
// "incremental": true, /* Enable incremental compilation */ // "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'. */ "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. */ // "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */ // "allowJs": true, /* Allow javascript files to be compiled. */