Skip to content

Commit

Permalink
Merge branch 'develop' into feature/2310
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Apr 10, 2024
2 parents fcd8b2b + 4ce042e commit 7b5b688
Show file tree
Hide file tree
Showing 48 changed files with 75 additions and 310 deletions.
28 changes: 18 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
[unreleased]

# New features:

* Add support for new format of invitation link: `c=<cid>&t=<token>&s=<serverAddress>&i=<inviterAddress>` ([#2310](https://github.com/TryQuiet/quiet/issues/2310))
* Add utilities for emoji detection in messages and make all-emoji message larger font size ([#519](https://github.com/TryQuiet/quiet/issues/519))

# Refactorings:

* Use ack for CREATE_NETWORK and simplify

# Fixes

* Allow JPEG and GIF files as profile photos ([#2332](https://github.com/TryQuiet/quiet/issues/2332))
* Fixes issues with recreating general channel when deleted while offline ([#2334](https://github.com/TryQuiet/quiet/issues/2334))
# Chores

# Other:
* Cleanup data directory at end of e2e tests

* Refactored package.json to have consistent license "GPL-3.0-or-later"
[2.2.0]

# Chores
# New features:

* Cleanup data directory at end of e2e tests
* Add utilities for emoji detection in messages and make all-emoji message larger font size ([#519](https://github.com/TryQuiet/quiet/issues/519))

# Refactorings:

* Use ack for CREATE_NETWORK and simplify
* Move Community model to the backend

# Fixes:

* Allow JPEG and GIF files as profile photos ([#2332](https://github.com/TryQuiet/quiet/issues/2332))
* Fix issues with recreating general channel when deleted while offline ([#2334](https://github.com/TryQuiet/quiet/issues/2334))
* Fix package.json license inconsistency

[2.1.2]

Expand Down Expand Up @@ -279,4 +288,3 @@
* C4 for Quiet architecture. Context and Container diagrams.

* Invite tab as default in settings

6 changes: 3 additions & 3 deletions packages/backend/src/nest/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ export class AppModule {
io.engine.use((req, res, next) => {
const authHeader = req.headers['authorization']
if (!authHeader) {
console.error('No authorization header')
console.error('Backend server: No authorization header')
res.writeHead(401, 'No authorization header')
res.end()
return
}

const token = authHeader && authHeader.split(' ')[1]
if (!token) {
console.error('No auth token')
console.error('Backend server: No auth token')
res.writeHead(401, 'No authorization token')
res.end()
return
Expand All @@ -122,7 +122,7 @@ export class AppModule {
if (verifyToken(options.socketIOSecret, token)) {
next()
} else {
console.error('Wrong basic token')
console.error('Backend server: Unauthorized')
res.writeHead(401, 'Unauthorized')
res.end()
}
Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/nest/common/client-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const createUsersCerts = async (
nickname: 'dev99damian1',
commonName: onion,
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLert',
dmPublicKey: 'dmPublicKey1',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI

const localAddress = createLibp2pAddress(payload.hiddenService.onionAddress, payload.peerId.id)

const community = {
let community: Community = {
id: payload.id,
name: payload.name,
CA: payload.CA,
Expand All @@ -371,6 +371,22 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
await this.localDbService.setNetworkInfo(network)

await this.launchCommunity({ community, network })

const meta = await this.storageService.updateCommunityMetadata({
id: community.id,
rootCa: community.rootCa as string,
ownerCertificate: community.ownerCertificate as string,
})
const currentCommunity = await this.localDbService.getCurrentCommunity()

if (meta && currentCommunity) {
community = {
...currentCommunity,
ownerOrbitDbIdentity: meta.ownerOrbitDbIdentity,
}
await this.localDbService.setCommunity(community)
}

this.logger(`Created and launched community ${community.id}`)

return community
Expand Down Expand Up @@ -535,7 +551,15 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
// service for now. Both object construction and object
// initialization need to happen in order based on dependencies.
await this.registrationService.init(this.storageService)
this.logger('storage initialized')

if (community.CA) {
this.registrationService.setPermsData({
certificate: community.CA.rootCertString,
privKey: community.CA.rootKeyString,
})
}

this.logger('Storage initialized')

this.serverIoProvider.io.emit(
SocketActionTypes.CONNECTION_PROCESS_INFO,
Expand All @@ -559,7 +583,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.socketService.on(SocketActionTypes.CONNECTION, async () => {
// Update Frontend with Initialized Communities
if (this.communityId) {
console.log('Hunting for heisenbug: Backend initialized community and sent event to state manager')
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_LAUNCHED, { id: this.communityId })
console.log('this.libp2pService.connectedPeers', this.libp2pService.connectedPeers)
console.log('this.libp2pservice', this.libp2pService)
Expand Down Expand Up @@ -595,26 +618,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
callback(await this.joinCommunity(args))
}
)
// TODO: With the Community model on the backend, there is no need to call
// SET_COMMUNITY_METADATA anymore. We can call updateCommunityMetadata when
// creating the community.
this.socketService.on(
SocketActionTypes.SET_COMMUNITY_METADATA,
async (payload: CommunityMetadata, callback: (response: CommunityMetadata | undefined) => void) => {
const meta = await this.storageService.updateCommunityMetadata(payload)
const community = await this.localDbService.getCurrentCommunity()

if (meta && community) {
const updatedCommunity = {
...community,
ownerOrbitDbIdentity: meta.ownerOrbitDbIdentity,
}
await this.localDbService.setCommunity(updatedCommunity)
this.serverIoProvider.io.emit(SocketActionTypes.COMMUNITY_UPDATED, updatedCommunity)
}
callback(meta)
}
)
this.socketService.on(SocketActionTypes.LEAVE_COMMUNITY, async () => {
await this.leaveCommunity()
})
Expand All @@ -624,13 +627,6 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
this.logger(`socketService - ${SocketActionTypes.ADD_CSR}`)
await this.storageService?.saveCSR(payload)
})
// TODO: With the Community model on the backend, there is no need to call
// SET_COMMUNITY_CA_DATA anymore. We can call setPermsData when
// creating the community.
this.socketService.on(SocketActionTypes.SET_COMMUNITY_CA_DATA, async (payload: PermsData) => {
this.logger(`socketService - ${SocketActionTypes.SET_COMMUNITY_CA_DATA}`)
this.registrationService.setPermsData(payload)
})

// Public Channels
this.socketService.on(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('RegistrationService', () => {
nickname: 'userName',
commonName: 'nqnw4kc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand Down Expand Up @@ -88,7 +87,6 @@ describe('RegistrationService', () => {
nickname: 'alice',
commonName: 'nqnw4kc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand Down Expand Up @@ -122,7 +120,6 @@ describe('RegistrationService', () => {
nickname: 'userName2',
commonName: 'nqnw4kc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand All @@ -136,15 +133,13 @@ describe('RegistrationService', () => {
nickname: 'karol',
commonName: 'nqnw4kc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
const userCsr2 = await createUserCsr({
nickname: 'karol',
commonName: 'nnnnnnc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'QmffffffqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand Down Expand Up @@ -187,7 +182,6 @@ describe('RegistrationService', () => {
nickname: 'alice',
commonName: 'nqnw4kc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'Qmf3ySkYqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand All @@ -196,7 +190,6 @@ describe('RegistrationService', () => {
nickname: 'alice',
commonName: 'nnnnnnc4c77fb47lk52m5l57h4tcxceo7ymxekfn7yh5m66t4jv2olad.onion',
peerId: 'QmffffffqLET9xtAtDzvAr5Pp3egK1H3C5iJAZm1SpLEp6',
dmPublicKey: 'testdmPublicKey',
signAlg: configCrypto.signAlg,
hashAlg: configCrypto.hashAlg,
})
Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/nest/socket/socket.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ describe('SocketService', () => {
SocketActionTypes.LAUNCH_COMMUNITY.valueOf(),
SocketActionTypes.REGISTER_USER_CERTIFICATE.valueOf(),
SocketActionTypes.ADD_CSR.valueOf(),
SocketActionTypes.SET_COMMUNITY_METADATA.valueOf(),
]

fragile.forEach(event => {
Expand Down
11 changes: 0 additions & 11 deletions packages/backend/src/nest/socket/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,6 @@ export class SocketService extends EventEmitter implements OnModuleInit {
this.emit(SocketActionTypes.LIBP2P_PSK_STORED, payload)
})

socket.on(
SocketActionTypes.SET_COMMUNITY_METADATA,
(payload: CommunityMetadata, callback: (response: CommunityMetadata | undefined) => void) => {
this.emit(SocketActionTypes.SET_COMMUNITY_METADATA, payload, callback)
}
)

socket.on(SocketActionTypes.SET_COMMUNITY_CA_DATA, (payload: PermsData) => {
this.emit(SocketActionTypes.SET_COMMUNITY_CA_DATA, payload)
})

// ====== Users ======

socket.on(SocketActionTypes.SET_USER_PROFILE, (profile: UserProfile) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/backend/src/nest/storage/storage.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,15 +525,11 @@ describe('StorageService', () => {
{
onionAddress: '6vu2bxki777it3cpayv6fq6vpl4ke3kzj7gxicfygm55dhhtphyfdvyd.onion',
peerId: 'QmXRY4rhAx8Muq8dMGkr9qknJdE6UHZDdGaDRTQEbwFN5b',
dmPublicKey:
'299abdb3a1c456245fa65560624ba583a5d5e35d5945ee14d548df5d37f5a516b281f71e9c66d3e9145a80fb59ce3baae611dd621a838d1cd98676e7f1901261380133ba9cb1e52ae54a52d69134f032368de3caa9ab69dcfce6e9afcc192ce21129d1131efce0994a7f028c8c9977dd403c9509bd9e149e0081f2071ddce0b7fc217756da7deb9e16d57e3a41300c7087a96df9ee5a82d197cbeabfc4011251e2cf7d481161672d94b82df0ea7e593a4bc81919b1516806f26b32dd9774cd11237d98cd346be7a19715ae15c90998e715f095048f8227403fb8cf915ca035ca1e5ef033d990a4dc84750a7de65fc9cc928e773250cd68c625754400d2e836f3f4bb0654a56aad820c3e0e977b304eaec2e0a193c4aac8dfaaee614671ecd11a40317957b56fa8f099d1f6684c826e4984d0ebb8',
username: 'o',
},
{
onionAddress: 'y7yczmugl2tekami7sbdz5pfaemvx7bahwthrdvcbzw5vex2crsr26qd.onion',
peerId: 'QmT18UvnUBkseMc3SqnfPxpHwN8nzLrJeNSLZtc8rAFXhz',
dmPublicKey:
'050bf2be48a25c47ff3cb2a7b11d416bd02162c54ef28e7a6e77ed527a15cc19516605332c9bce4aba0f93f1266d5cfea2484cadc60d802587bf1ac0a87555ab42513fa6e2f7c06d094a2dc7a38f147a792b94022fad21a1dd6e02784aa1cc891bdb6ca0cf5a4be92b9ff93e83844206388f676e5c0bb406fd436beb0c8843c7a5061a3830a9bc88ea7b112852b19395d5feb1ae75d8082ff3c9473ce4612ec9c2f35489a0010bcf0136dd333638cd21a734b1f192f494371691f4b9c459ffa2d637aa70e8973af99dc94e417b766a8462afbc183fe6fc8b4220887de6a98d97a69cba851d0062b609439b6c6728be87cccc9f6680073d5ed8716611e2ca54f49bbc43c6aa49e02bcb1eecc79e5e491e063b95104e8e43ad09fac6d930399ff2b6c3a49c5b6117c8dc03db9300c0ca0364f29425',
username: 'o',
},
])
Expand Down
5 changes: 2 additions & 3 deletions packages/backend/src/nest/storage/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,8 @@ export class StorageService extends EventEmitter {
const onionAddress = getReqFieldValue(parsedCert, CertFieldsTypes.commonName)
const peerId = getReqFieldValue(parsedCert, CertFieldsTypes.peerId)
const username = getReqFieldValue(parsedCert, CertFieldsTypes.nickName)
const dmPublicKey = getReqFieldValue(parsedCert, CertFieldsTypes.dmPublicKey)
if (!onionAddress || !peerId || !username || !dmPublicKey) continue
allUsers.push({ onionAddress, peerId, username, dmPublicKey })
if (!onionAddress || !peerId || !username) continue
allUsers.push({ onionAddress, peerId, username })
}
return allUsers
}
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/nest/websocketOverTor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class WebSockets extends EventEmitter {
websocket: {
...this._websocketOpts,
},
signal: options.signal,
})
} catch (e) {
log.error('error connecting to %s. Details: %s', ma, e.message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ const Template: ComponentStory<typeof ChannelComponent> = () => {
privKey: 'privKey',
pubKey: 'pubKey',
},
dmKeys: {
publicKey: 'publicKey',
privateKey: 'privateKey',
},
userCsr: {
userCsr: 'userCsr',
userKey: 'userKey',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ const args: Partial<ChannelComponentProps & UploadFilesPreviewsProps> = {
privKey: 'privKey',
pubKey: 'pubKey',
},
dmKeys: {
publicKey: 'publicKey',
privateKey: 'privateKey',
},
userCsr: {
userCsr: 'userCsr',
userKey: 'userKey',
Expand Down
12 changes: 4 additions & 8 deletions packages/desktop/src/rtl-tests/community.create.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ import {
type NetworkInfo,
SavedOwnerCertificatePayload,
SocketActionTypes,
type ChannelsReplicatedPayload,
type RegisterOwnerCertificatePayload,
type ResponseLaunchCommunityPayload,
} from '@quiet/types'
import {
ChannelsReplicatedPayload,
publicChannels,
RegisterOwnerCertificatePayload,
ResponseLaunchCommunityPayload,
} from '@quiet/state-manager'
import { publicChannels } from '@quiet/state-manager'
import Channel from '../renderer/components/Channel/Channel'
import LoadingPanel from '../renderer/components/LoadingPanel/LoadingPanel'
import { AnyAction } from 'redux'
Expand Down Expand Up @@ -167,7 +165,6 @@ describe('User', () => {
"Modals/openModal",
"Identity/registerCertificate",
"Communities/createCommunity",
"Communities/sendCommunityCaData",
"Files/checkForMissingFiles",
"Network/addInitializedCommunity",
"Communities/clearInvitationCodes",
Expand All @@ -176,7 +173,6 @@ describe('User', () => {
"PublicChannels/addChannel",
"Identity/storeUserCertificate",
"Messages/addPublicChannelsMessagesBase",
"Communities/sendCommunityMetadata",
"PublicChannels/createGeneralChannel",
"PublicChannels/createChannel",
"Identity/saveUserCsr",
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/src/rtl-tests/community.join.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ describe('User', () => {
"Modals/openModal",
"Identity/registerCertificate",
"Communities/launchCommunity",
"Communities/sendCommunityCaData",
"Files/checkForMissingFiles",
"Network/addInitializedCommunity",
"Communities/clearInvitationCodes",
Expand Down
Loading

0 comments on commit 7b5b688

Please sign in to comment.