Merge pull request #343 from shocknet/fix/chatter-check

less chatter, pub check
This commit is contained in:
CapDog 2021-04-21 16:38:21 -04:00 committed by GitHub
commit c30a56ad76
2 changed files with 19 additions and 6 deletions

View file

@ -120,8 +120,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) { if (shouldRetry(resolvedValue)) {
logger.info( logger.info(
'force retrying' + 'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
) )
} else { } else {
return resolvedValue return resolvedValue
@ -135,8 +136,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
} }
logger.info( logger.info(
`\n retrying \n` + `\n retrying \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
) )
await delay(200) await delay(200)
@ -151,8 +153,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) { if (shouldRetry(resolvedValue)) {
logger.info( logger.info(
'force retrying' + 'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
) )
} else { } else {
return resolvedValue return resolvedValue
@ -165,8 +168,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
} }
logger.info( logger.info(
`\n retrying \n` + `\n retrying \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
) )
await delay(3000) await delay(3000)
@ -181,8 +185,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
if (shouldRetry(resolvedValue)) { if (shouldRetry(resolvedValue)) {
logger.info( logger.info(
'force retrying' + 'force retrying' /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()} \n resolvedValue: ${resolvedValue}, type: ${typeof resolvedValue}`
*/
) )
} else { } else {
return resolvedValue return resolvedValue
@ -195,8 +200,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
} }
logger.info( logger.info(
`\n NOT recreating a fresh gun but retrying one last time \n` + `\n NOT recreating a fresh gun but retrying one last time \n` /* +
` args: ${promGen.toString()} -- ${shouldRetry.toString()}` ` args: ${promGen.toString()} -- ${shouldRetry.toString()}`
*/
) )
const { gun, user } = require('../../Mediator/index').freshGun() const { gun, user } = require('../../Mediator/index').freshGun()

View file

@ -3160,6 +3160,13 @@ module.exports = async (
const publicKeyForDecryption = req.header(PUBKEY_FOR_DECRYPT_HEADER) const publicKeyForDecryption = req.header(PUBKEY_FOR_DECRYPT_HEADER)
const { path, publicKey, type } = req.params const { path, publicKey, type } = req.params
if (!publicKey || publicKey === 'undefined') {
res.status(400).json({
errorMessage: 'Invalid publicKey specified'
})
return
}
if (!allowedTypes.includes(type)) { if (!allowedTypes.includes(type)) {
res.status(400).json({ res.status(400).json({
errorMessage: 'Invalid type specified' errorMessage: 'Invalid type specified'