Skip to content

Commit

Permalink
Working on desktop apparently
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Leblow committed Nov 24, 2023
1 parent e0c75a0 commit 8f7bf63
Show file tree
Hide file tree
Showing 17 changed files with 2,398 additions and 1,625 deletions.
3,599 changes: 2,180 additions & 1,419 deletions packages/backend/package-lock.json

Large diffs are not rendered by default.

290 changes: 145 additions & 145 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,147 +1,147 @@
{
"name": "@quiet/backend",
"version": "2.0.3-alpha.5",
"description": "tlg-manager",
"types": "lib/index.d.ts",
"type": "module",
"exports": "lib/index.js",
"author": "",
"license": "MIT",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
"webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"applyPatches": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true",
"prepare": "npm run applyPatches && npm run webpack",
"version": "git add -A src",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix",
"lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/",
"test-nest": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --detectOpenHandles --forceExit ./src/nest/**/*.spec.ts",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js ./src/**/* --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\"",
"test-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/**/* --runInBand --colors --ci --silent --verbose --testPathIgnorePatterns=\".src/nest/(!?nodeTest*)|(.node_modules*)|src/nest/.*\\.tor.spec\\.(t|j)s|src/nest/ipfs-file-manager/big-files.long.spec.ts$\"",
"test-ci-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --colors --ci --silent --verbose --detectOpenHandles --forceExit ./src/nest/**/*.tor.spec.ts",
"test-ci-long-running": "cross-env DEBUG=backend:* NODE_OPTIONS=--experimental-vm-modules jest --colors --ci --verbose ./src/nest/**/*.long.spec.ts",
"test-connect": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG='libp2p:websockets*' jest ./src/nodeTest/* --verbose",
"test-connect-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/nodeTest/* --colors --ci --silent --verbose",
"test-replication-no-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules ts-node -v && cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 200 --entriesCount 1000 --no-useTor",
"test-replication-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 500 --entriesCount 1000 --useTor",
"rmDist": "rimraf lib/"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]:TryQuiet/backend.git"
},
"files": [
"lib/**/*",
"package-lock.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"clearMocks": true,
"coverageProvider": "v8",
"transformIgnorePatterns": [
"node_modules/(?!p-defer|peer-id)"
],
"testTimeout": 40000,
"setupFiles": [
"./jestSetup.js"
],
"testEnvironment": "jest-environment-node"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@quiet/eslint-config": "^2.0.2-alpha.0",
"@quiet/state-manager": "^2.0.2-alpha.3",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.9",
"@types/jest": "28.1.8",
"@types/luxon": "^3.3.0",
"@types/mock-fs": "^4.13.1",
"@types/node": "18.11.9",
"@types/node-fetch": "^2.5.11",
"@types/orbit-db": "git+https://github.com/orbitdb/orbit-db-types.git",
"@types/supertest": "^2.0.11",
"@types/tmp": "^0.2.3",
"@types/validator": "^13.11.5",
"@types/ws": "8.5.3",
"babel-jest": "^29.3.1",
"cross-env": "^5.2.0",
"fetch-mock-jest": "^1.5.1",
"jest": "^29.4.2",
"mock-fs": "^5.1.2",
"tmp": "^0.2.1",
"ts-jest": "^29.0.3",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"typescript": "^4.9.3",
"wait-for-expect": "^3.0.2",
"webpack": "5.75.0",
"webpack-cli": "5.0.1",
"yargs": "^17.1.0"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "6.1.0",
"@chainsafe/libp2p-noise": "11.0.0",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@peculiar/webcrypto": "1.4.3",
"@quiet/common": "^2.0.2-alpha.1",
"@quiet/identity": "^2.0.2-alpha.2",
"@quiet/logger": "^2.0.2-alpha.0",
"@quiet/types": "^2.0.2-alpha.1",
"abortable-iterator": "^3.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.1",
"cli-table": "^0.3.6",
"commander": "^7.2.0",
"cors": "^2.8.5",
"crypto-js": "^4.1.1",
"debug": "^4.3.1",
"dotenv": "8.2.0",
"events": "^3.2.0",
"express": "^4.17.1",
"get-port": "^5.1.1",
"go-ipfs": "npm:[email protected]",
"http-server": "^0.12.3",
"https-proxy-agent": "^5.0.0",
"image-size": "^1.0.1",
"ipfs": "0.66.0",
"ipfs-log": "^5.4.2",
"it-ws": "5.0.6",
"joi": "^17.8.1",
"level": "8.0.0",
"libp2p": "0.42.2",
"luxon": "^1.11.4",
"multiaddr": "^10.0.1",
"orbit-db": "0.29.0",
"orbit-db-access-controllers": "^0.4.0",
"orbit-db-identity-provider": "0.5.0",
"orbit-db-io": "1.0.2",
"orbit-db-pubsub": "0.6.0",
"orbit-db-store": "4.3.4",
"p-queue": "7.3.4",
"peer-id": "^0.16.0",
"pkijs": "3.0.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"secp256k1": "4.0.3",
"socket.io": "4.6.0",
"socks-proxy-agent": "^5.0.0",
"string-replace-loader": "3.1.0",
"ts-jest-resolver": "^2.0.0",
"validator": "^13.11.0"
},
"overrides": {
"level": "$level",
"leveldown": "^6",
"go-ipfs": "npm:[email protected]",
"orbit-db": {
"ipfs-pubsub-peer-monitor": "vinkabuki/ipfs-pubsub-peer-monitor#038af76f22e6c902dab4a855b24273707ce17d94"
}
}
"name": "@quiet/backend",
"version": "2.0.3-alpha.5",
"description": "tlg-manager",
"types": "lib/index.d.ts",
"type": "module",
"exports": "lib/index.js",
"author": "",
"license": "MIT",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
"webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"applyPatches": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true",
"prepare": "npm run applyPatches && npm run webpack",
"version": "git add -A src",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix",
"lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/",
"test-nest": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --detectOpenHandles --forceExit ./src/nest/**/*.spec.ts",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js ./src/**/* --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\"",
"test-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/**/* --runInBand --colors --ci --silent --verbose --testPathIgnorePatterns=\".src/nest/(!?nodeTest*)|(.node_modules*)|src/nest/.*\\.tor.spec\\.(t|j)s|src/nest/ipfs-file-manager/big-files.long.spec.ts$\"",
"test-ci-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --colors --ci --silent --verbose --detectOpenHandles --forceExit ./src/nest/**/*.tor.spec.ts",
"test-ci-long-running": "cross-env DEBUG=backend:* NODE_OPTIONS=--experimental-vm-modules jest --colors --ci --verbose ./src/nest/**/*.long.spec.ts",
"test-connect": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG='libp2p:websockets*' jest ./src/nodeTest/* --verbose",
"test-connect-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/nodeTest/* --colors --ci --silent --verbose",
"test-replication-no-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules ts-node -v && cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 200 --entriesCount 1000 --no-useTor",
"test-replication-tor": "cross-env NODE_OPTIONS=--experimental-vm-modules cross-env DEBUG='backend:dbSnap*,backend:localTest*' ts-node src/nodeTest/testReplicate.ts --nodesCount 1 --timeThreshold 500 --entriesCount 1000 --useTor",
"rmDist": "rimraf lib/"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]:TryQuiet/backend.git"
},
"files": [
"lib/**/*",
"package-lock.json"
],
"jest": {
"preset": "ts-jest/presets/default-esm",
"clearMocks": true,
"coverageProvider": "v8",
"transformIgnorePatterns": [
"node_modules/(?!p-defer|peer-id)"
],
"testTimeout": 40000,
"setupFiles": [
"./jestSetup.js"
],
"testEnvironment": "jest-environment-node"
},
"devDependencies": {
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.10",
"@quiet/eslint-config": "^2.0.2-alpha.0",
"@quiet/state-manager": "^2.0.2-alpha.3",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.9",
"@types/jest": "28.1.8",
"@types/luxon": "^3.3.0",
"@types/mock-fs": "^4.13.1",
"@types/node": "18.11.9",
"@types/node-fetch": "^2.5.11",
"@types/orbit-db": "git+https://github.com/orbitdb/orbit-db-types.git",
"@types/supertest": "^2.0.11",
"@types/tmp": "^0.2.3",
"@types/validator": "^13.11.5",
"@types/ws": "8.5.3",
"babel-jest": "^29.3.1",
"cross-env": "^5.2.0",
"fetch-mock-jest": "^1.5.1",
"jest": "^29.4.2",
"mock-fs": "^5.1.2",
"tmp": "^0.2.1",
"ts-jest": "^29.0.3",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"typescript": "^4.9.3",
"wait-for-expect": "^3.0.2",
"webpack": "5.75.0",
"webpack-cli": "5.0.1",
"yargs": "^17.1.0"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "6.1.0",
"@chainsafe/libp2p-noise": "11.0.0",
"@nestjs/common": "^10.2.10",
"@nestjs/core": "^10.2.10",
"@nestjs/platform-express": "^10.2.10",
"@peculiar/webcrypto": "1.4.3",
"@quiet/common": "^2.0.2-alpha.1",
"@quiet/identity": "^2.0.2-alpha.2",
"@quiet/logger": "^2.0.2-alpha.0",
"@quiet/types": "^2.0.2-alpha.1",
"abortable-iterator": "^3.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.1",
"cli-table": "^0.3.6",
"commander": "^7.2.0",
"cors": "^2.8.5",
"crypto-js": "^4.1.1",
"debug": "^4.3.1",
"dotenv": "8.2.0",
"events": "^3.2.0",
"express": "^4.17.1",
"get-port": "^5.1.1",
"go-ipfs": "npm:[email protected]",
"http-server": "^0.12.3",
"https-proxy-agent": "^5.0.0",
"image-size": "^1.0.1",
"ipfs": "0.66.0",
"ipfs-log": "^5.4.2",
"it-ws": "5.0.6",
"joi": "^17.8.1",
"level": "8.0.0",
"libp2p": "0.42.2",
"luxon": "^1.11.4",
"multiaddr": "^10.0.1",
"orbit-db": "0.29.0",
"orbit-db-access-controllers": "^0.4.0",
"orbit-db-identity-provider": "0.5.0",
"orbit-db-io": "1.0.2",
"orbit-db-pubsub": "0.6.0",
"orbit-db-store": "4.3.4",
"p-queue": "7.3.4",
"peer-id": "^0.16.0",
"pkijs": "3.0.8",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"secp256k1": "4.0.3",
"socket.io": "4.6.0",
"socks-proxy-agent": "^5.0.0",
"string-replace-loader": "3.1.0",
"ts-jest-resolver": "^2.0.0",
"validator": "^13.11.0"
},
"overrides": {
"level": "$level",
"leveldown": "^6",
"go-ipfs": "npm:[email protected]",
"orbit-db": {
"ipfs-pubsub-peer-monitor": "vinkabuki/ipfs-pubsub-peer-monitor#038af76f22e6c902dab4a855b24273707ce17d94"
}
}
}
1 change: 0 additions & 1 deletion packages/backend/src/backendManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const runBackendDesktop = async () => {
},
},
}),
{ logger: false }
)

const connectionsManager = app.get<ConnectionsManagerService>(ConnectionsManagerService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
if (ownerOrbitDbIdentity) {
this.logger("Creating network: received owner's OrbitDB identity")
await this.localDbService.putOwnerOrbitDbIdentity(ownerOrbitDbIdentity)
} else {
this.logger.error("Creating network: received owner's OrbitDB identity is not valid")
emitError(this.serverIoProvider.io, {
type: SocketActionTypes.NETWORK,
message: ErrorMessages.NETWORK_SETUP_FAILED,
community: community.id,
})
return
}

const payload: ResponseCreateNetworkPayload = {
Expand Down Expand Up @@ -343,6 +335,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
type: SocketActionTypes.COMMUNITY,
message: ErrorMessages.COMMUNITY_LAUNCH_FAILED,
community: payload.id,
trace: e.stack,
})
return
}
Expand All @@ -361,6 +354,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI

this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY, { id: payload.id })
}

public async launch(payload: InitCommunityPayload) {
// Start existing community (community that user is already a part of)
this.logger(`Spawning hidden service for community ${payload.id}, peer: ${payload.peerId.id}`)
Expand Down Expand Up @@ -429,6 +423,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
await this.storageService.init(_peerId)
this.logger('storage initialized')
}

private attachTorEventsListeners() {
this.logger('attachTorEventsListeners')

Expand Down Expand Up @@ -496,7 +491,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
})
this.socketService.on(SocketActionTypes.SEND_COMMUNITY_METADATA, async (payload: CommunityMetadata) => {
const meta = await this.storageService?.communityMetadataStore?.updateCommunityMetadata(payload)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_METADATA_SAVED, meta)
})
this.socketService.on(SocketActionTypes.SAVE_USER_CSR, async (payload: SaveCSRPayload) => {
this.logger(`socketService - ${SocketActionTypes.SAVE_USER_CSR}`)
Expand Down Expand Up @@ -623,8 +617,9 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.registrationService.emit(RegistrationEvents.REGISTER_USER_CERTIFICATE, payload)
}
)
this.storageService.on(StorageEvents.COMMUNITY_METADATA_LOADED, (payload: CommunityMetadata) => {
this.logger(`Storage - ${StorageEvents.COMMUNITY_METADATA_LOADED}: ${payload}`)
this.storageService.on(StorageEvents.COMMUNITY_METADATA_SAVED, (meta: CommunityMetadata) => {
this.logger(`Storage - ${StorageEvents.COMMUNITY_METADATA_SAVED}: ${meta}`)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_METADATA_SAVED, meta)
})
}
}
Loading

0 comments on commit 8f7bf63

Please sign in to comment.