Skip to content

Commit

Permalink
merged develop into jest/use-commonjs-libs
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkabuki committed Aug 29, 2023
2 parents ecd31d6 + 144bd9c commit 089cd45
Show file tree
Hide file tree
Showing 88 changed files with 671 additions and 405 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ jobs:
max_attempts: 3
command: cd packages/e2e-tests && npm run test invitationLink.test.ts

- name: Download App Image 1.2.0
working-directory: ./packages/e2e-tests/Quiet
run: curl -LO https://github.com/TryQuiet/quiet/releases/download/quiet%401.2.0/Quiet-1.2.0.AppImage
# - name: Download App Image 1.2.0
# working-directory: ./packages/e2e-tests/Quiet
# run: curl -LO https://github.com/TryQuiet/quiet/releases/download/quiet%401.2.0/Quiet-1.2.0.AppImage

- name: Chmod App Image 1.2.0
working-directory: ./packages/e2e-tests/Quiet
run: chmod +x Quiet-1.2.0.AppImage
# - name: Chmod App Image 1.2.0
# working-directory: ./packages/e2e-tests/Quiet
# run: chmod +x Quiet-1.2.0.AppImage

- name: Run Backwards Compatibility test
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: cd packages/e2e-tests && npm run test backwardsCompatibility.test.ts
# - name: Run Backwards Compatibility test
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 15
# max_attempts: 3
# command: cd packages/e2e-tests && npm run test backwardsCompatibility.test.ts
40 changes: 7 additions & 33 deletions .github/workflows/e2e-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,51 +47,25 @@ jobs:
- name: Add App file to applications
run: cd ~ && cp -R "/Volumes/Quiet $VERSION/Quiet.app" /Applications

- name: Change name dir
run: cd ~ && mv /Applications/Quiet.app /Applications/Quiet-Latest.app

# OLD ver
- name: Download DMG 1.2.0
working-directory: ./packages/e2e-tests/Quiet
run: curl -LO https://github.com/TryQuiet/quiet/releases/download/quiet%401.2.0/Quiet-1.2.0.dmg

- name: Chmod 1.2.0
working-directory: ./packages/e2e-tests/Quiet
run: chmod +x Quiet-1.2.0.dmg

- name: Mount installer file in volume on system 1.2.0
working-directory: ./packages/e2e-tests/Quiet
run: hdiutil mount Quiet-1.2.0.dmg

- name: Add App file to applications 1.2.0
run: cd ~ && cp -R "/Volumes/Quiet 1.2.0/Quiet.app" /Applications

- name: Run invitation link test - Includes 2 separate application clients
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 3
command: cd packages/e2e-tests && npm run test invitationLink.test.ts

# OLD ver
- name: Run one client test
uses: nick-fields/retry@v2
with:
timeout_minutes: 15
max_attempts: 3
command: cd packages/e2e-tests && npm run test oneClient.test.ts

# - name: Run Backwards Compatibility test
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 15
# max_attempts: 3
# command: cd packages/e2e-tests && npm run test backwardsCompatibility.test.ts

- name: Run two clients test
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 3
command: cd packages/e2e-tests && npm run test twoClients.test.ts

- name: Run invitation link test - Includes 2 separate application clients
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 3
command: cd packages/e2e-tests && npm run test invitationLink.test.ts

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Encrypted p2p team chat with no servers, just Tor.
<br />
<!-- <a href="https://tryquiet.org"><strong>tryquiet.org »</strong></a> -->
<a href="https://github.com/TryQuiet/quiet/releases/tag/quiet%401.4.0"><strong>Downloads</strong></a> |
<a href="https://github.com/TryQuiet/quiet/releases/tag/quiet%401.8.0"><strong>Downloads</strong></a> |
<a href="#how-it-works"><strong>How it Works</strong></a> |
<a href="#features"><strong>Features</strong></a> |
<a href="https://github.com/TryQuiet/monorepo/wiki/Threat-Model"><strong>Threat Model</strong></a> |
Expand Down Expand Up @@ -52,7 +52,7 @@ See our [FAQ](https://github.com/TryQuiet/monorepo/wiki/Quiet-FAQ) for answers t

## Getting started

To try Quiet, download the [latest release](https://github.com/TryQuiet/quiet/releases/tag/quiet%401.4.0) for your platform (.dmg for macOS, .exe for Windows, etc.) and install it in the normal way. Then create a community and open the community's settings to invite members.
To try Quiet, download the [latest release](https://github.com/TryQuiet/quiet/releases/tag/quiet%401.8.0) for your platform (.dmg for macOS, .exe for Windows, etc.) and install it in the normal way. Then create a community and open the community's settings to invite members.

If you'd like to help develop Quiet, see [Contributing to Quiet](#contributing-to-quiet).

Expand Down
24 changes: 24 additions & 0 deletions packages/backend-bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.6.0](/compare/[email protected]@1.6.0) (2023-08-28)

**Note:** Version bump only for package backend-bundle





# [1.6.0-alpha.0](https://github.com/TryQuiet/quiet/compare/[email protected]@1.6.0-alpha.0) (2023-08-25)

**Note:** Version bump only for package backend-bundle





# [1.5.0](https://github.com/TryQuiet/quiet/compare/[email protected]@1.5.0) (2023-08-17)

**Note:** Version bump only for package backend-bundle





# [1.4.0](https://github.com/ZbayApp/monorepo/compare/[email protected]@1.4.0) (2023-07-28)

**Note:** Version bump only for package backend-bundle
Expand Down
4 changes: 2 additions & 2 deletions packages/backend-bundle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/backend-bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend-bundle",
"version": "1.4.0",
"version": "1.6.0",
"description": "",
"main": "bundle.cjs",
"scripts": {},
Expand Down
24 changes: 24 additions & 0 deletions packages/backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.9.0](https://github.com/TryQuiet/backend/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-08-28)

**Note:** Version bump only for package @quiet/backend





# [1.9.0-alpha.0](https://github.com/TryQuiet/backend/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-08-25)

**Note:** Version bump only for package @quiet/backend





# [1.8.0](https://github.com/TryQuiet/backend/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-08-17)

**Note:** Version bump only for package @quiet/backend





## [1.7.1-alpha.3](https://github.com/TryQuiet/backend/compare/@quiet/[email protected]...@quiet/[email protected]) (2023-08-11)

**Note:** Version bump only for package @quiet/backend
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quiet/backend",
"version": "1.7.1-alpha.3",
"version": "1.9.0",
"description": "tlg-manager",
"types": "lib/index.d.ts",
"type": "module",
Expand Down Expand Up @@ -53,8 +53,8 @@
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@quiet/eslint-config": "^1.1.0",
"@quiet/state-manager": "^1.7.1-alpha.1",
"@quiet/eslint-config": "^1.3.0",
"@quiet/state-manager": "^1.9.0",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.9",
"@types/jest": "28.1.8",
Expand Down Expand Up @@ -89,10 +89,10 @@
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@peculiar/webcrypto": "1.4.3",
"@quiet/common": "^1.6.0",
"@quiet/identity": "^1.6.0",
"@quiet/logger": "^1.4.0",
"@quiet/types": "^1.6.0",
"@quiet/common": "^1.8.0",
"@quiet/identity": "^1.8.0",
"@quiet/logger": "^1.6.0",
"@quiet/types": "^1.8.0",
"abortable-iterator": "^3.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/nest/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ export const torDirForPlatform = (basePath?: string): string => {
}

export const createLibp2pAddress = (address: string, peerId: string) => {
return `/dns4/${address}/tcp/443/wss/p2p/${peerId}`
return `/dns4/${address}/tcp/80/ws/p2p/${peerId}`
}

export const createLibp2pListenAddress = (address: string) => {
return `/dns4/${address}/tcp/443/wss`
return `/dns4/${address}/tcp/80/ws`
}

export const getUsersAddresses = async (users: User[]): Promise<string[]> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
}

public async leaveCommunity() {
this.tor.resetHiddenServices()
this.serverIoProvider.io.close()
await this.localDbService.purge()
await this.closeAllServices({ saveTor: true })
Expand Down
8 changes: 5 additions & 3 deletions packages/backend/src/nest/libp2p/libp2p.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ describe('Libp2pService', () => {

it('creates libp2p address with proper ws type (%s)', async () => {
const libp2pAddress = libp2pService.createLibp2pAddress(params.localAddress, params.peerId.toString())
expect(libp2pAddress).toStrictEqual(`/dns4/${params.localAddress}/tcp/443/wss/p2p/${params.peerId.toString()}`)
expect(libp2pAddress).toStrictEqual(
`/dns4/${params.localAddress}.onion/tcp/80/wss/p2p/${params.peerId.toString()}`
)
})

it('creates libp2p listen address', async () => {
const libp2pListenAddress = libp2pService.createLibp2pListenAddress(params.listenAddresses[0])
expect(libp2pListenAddress).toStrictEqual(`/dns4/${params.listenAddresses}/tcp/443/wss`)
const libp2pListenAddress = libp2pService.createLibp2pListenAddress('onionAddress')
expect(libp2pListenAddress).toStrictEqual(`/dns4/onionAddress.onion/tcp/80/wss`)
})
})
3 changes: 0 additions & 3 deletions packages/backend/src/nest/libp2p/libp2p.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ export class Libp2pService extends EventEmitter {
filter: all,
websocket: {
agent: params.agent,
cert: params.cert,
key: params.key,
ca: params.ca,
},
localAddress: params.localAddress,
targetPort: params.targetPort,
Expand Down
8 changes: 6 additions & 2 deletions packages/backend/src/nest/libp2p/libp2p.utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const ONION = '.onion'

export const createLibp2pAddress = (address: string, peerId: string) => {
return `/dns4/${address}/tcp/443/wss/p2p/${peerId}`
if (!address.endsWith(ONION)) address += ONION
return `/dns4/${address}/tcp/80/wss/p2p/${peerId}`
}

export const createLibp2pListenAddress = (address: string) => {
return `/dns4/${address}/tcp/443/wss`
if (!address.endsWith(ONION)) address += ONION
return `/dns4/${address}/tcp/80/wss`
}
11 changes: 9 additions & 2 deletions packages/backend/src/nest/tor/tor-control.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ export class TorControl implements OnModuleInit {
}

private async connect(): Promise<void> {
console.log('this.torControlParams', this.torControlParams)
console.log('configOptions.torControl', this.configOptions.torControlPort)
return await new Promise((resolve, reject) => {
if (this.connection) {
reject(new Error('TOR: Connection already established'))
Expand Down Expand Up @@ -82,8 +80,17 @@ export class TorControl implements OnModuleInit {
}

public async sendCommand(command: string): Promise<{ code: number; messages: string[] }> {
await this.waitForDisconnect()
return await new Promise((resolve, reject) => {
void this._sendCommand(command, resolve, reject)
})
}

private async waitForDisconnect() {
await new Promise<void>(resolve => {
if (!this.connection) {
resolve()
}
})
}
}
21 changes: 7 additions & 14 deletions packages/backend/src/nest/tor/tor.service.tor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { jest } from '@jest/globals'
import { TorControlAuthType } from './tor.types'
import { TorControl } from './tor-control.service'
import crypto from 'crypto'
import { sleep } from '../common/sleep'
jest.setTimeout(200_000)
describe('TorControl', () => {
let module: TestingModule
Expand Down Expand Up @@ -121,22 +122,15 @@ describe('TorControl', () => {
expect(hiddenServiceOnionAddress).toBe('u2rg2direy34dj77375h2fbhsc2tvxj752h4tlso64mjnlevcv54oaad.onion')
})

// currently provider generate password
// it('generates hashed password', async () => {
// await torService.init()
// torService.generateHashedPassword()
// console.log(torService.torHashedPassword)
// console.log(torService.torPassword)
// expect(tor.torHashedPassword).toHaveLength(61)
// expect(tor.torPassword).toHaveLength(32)
// })

it('tor spawn repeating 3 times with 1 second timeout and repeating will stop after that', async () => {
await expect(torService.init({ repeat: 3, timeout: 1000 })).rejects.toThrow('Failed to spawn tor 4 times')
it('tor spawn repeats', async () => {
const spyOnInit = jest.spyOn(torService, 'init')
await torService.init(1000)
await sleep(4000)
expect(spyOnInit).toHaveBeenCalledTimes(2)
})

it('tor is initializing correctly with 40 seconds timeout', async () => {
await torService.init({ repeat: 3, timeout: 40000 })
await torService.init()
})

it('creates and destroys hidden service', async () => {
Expand All @@ -145,7 +139,6 @@ describe('TorControl', () => {
const serviceId = hiddenService.onionAddress.split('.')[0]
const status = await torService.destroyHiddenService(serviceId)
expect(status).toBe(true)
// await torService.kill()
})

it('attempt destroy nonexistent hidden service', async () => {
Expand Down
Loading

0 comments on commit 089cd45

Please sign in to comment.