debounce, remove console logs
This commit is contained in:
parent
7bc7ad35ef
commit
a4f4769989
2 changed files with 20 additions and 26 deletions
|
|
@ -372,16 +372,9 @@ class Mediator {
|
||||||
console.error('Unknown Device', error)
|
console.error('Unknown Device', error)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
console.log('Emitting Data...', data)
|
|
||||||
if (typeof data === 'string') {
|
if (typeof data === 'string') {
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
}
|
}
|
||||||
console.log('Event:', eventName)
|
|
||||||
console.log('Data:', data)
|
|
||||||
console.log('Decrypt params:', {
|
|
||||||
deviceId,
|
|
||||||
message: data.encryptedKey
|
|
||||||
})
|
|
||||||
const decryptedKey = Encryption.decryptKey({
|
const decryptedKey = Encryption.decryptKey({
|
||||||
deviceId,
|
deviceId,
|
||||||
message: data.encryptedKey
|
message: data.encryptedKey
|
||||||
|
|
@ -415,7 +408,7 @@ class Mediator {
|
||||||
deviceId
|
deviceId
|
||||||
})
|
})
|
||||||
: data
|
: data
|
||||||
console.log('Sending Message...', eventName, data, encryptedMessage)
|
|
||||||
socket.emit(eventName, encryptedMessage)
|
socket.emit(eventName, encryptedMessage)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
@ -928,19 +921,21 @@ class Mediator {
|
||||||
|
|
||||||
await throwOnInvalidToken(token)
|
await throwOnInvalidToken(token)
|
||||||
|
|
||||||
await API.Events.onSimplerSentRequests(sentRequests => {
|
await API.Events.onSimplerSentRequests(
|
||||||
if (Config.SHOW_LOG) {
|
debounce(sentRequests => {
|
||||||
console.log('---sentRequests---')
|
if (Config.SHOW_LOG) {
|
||||||
console.log(sentRequests)
|
console.log('---sentRequests---')
|
||||||
console.log('-----------------------')
|
console.log(sentRequests)
|
||||||
}
|
console.log('-----------------------')
|
||||||
|
}
|
||||||
|
|
||||||
this.socket.emit(Event.ON_SENT_REQUESTS, {
|
this.socket.emit(Event.ON_SENT_REQUESTS, {
|
||||||
msg: sentRequests,
|
msg: sentRequests,
|
||||||
ok: true,
|
ok: true,
|
||||||
origBody: body
|
origBody: body
|
||||||
})
|
})
|
||||||
})
|
}, 200)
|
||||||
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
this.socket.emit(Event.ON_SENT_REQUESTS, {
|
this.socket.emit(Event.ON_SENT_REQUESTS, {
|
||||||
|
|
|
||||||
|
|
@ -514,6 +514,11 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
||||||
timestamp
|
timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const encryptedForMeRecipientPublicKey = await SEA.encrypt(
|
||||||
|
recipientPublicKey,
|
||||||
|
mySecret
|
||||||
|
)
|
||||||
|
|
||||||
console.log('sendHR() -> before newHandshakeRequestID')
|
console.log('sendHR() -> before newHandshakeRequestID')
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
const newHandshakeRequestID = await new Promise((res, rej) => {
|
const newHandshakeRequestID = await new Promise((res, rej) => {
|
||||||
|
|
@ -542,14 +547,8 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const encryptedForMeRecipientPublicKey = await SEA.encrypt(
|
|
||||||
recipientPublicKey,
|
|
||||||
mySecret
|
|
||||||
)
|
|
||||||
|
|
||||||
// This needs to come before the write to sent requests. Because that write
|
// This needs to come before the write to sent requests. Because that write
|
||||||
// triggers Jobs.onAcceptedRequests and it in turn reads from request-to-user
|
// triggers Jobs.onAcceptedRequests and it in turn reads from request-to-user
|
||||||
// This also triggers Events.onSimplerSentRequests
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {StoredReq}
|
* @type {StoredReq}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue