Run prettier

This commit is contained in:
Yarmo Mackenbach 2020-12-20 23:19:07 +01:00
parent de5d358b31
commit 347c48ff4e
4 changed files with 74 additions and 55 deletions

View file

@ -213,39 +213,60 @@ const verify = async (input, fingerprint, opts) => {
case 'adaptive':
if (spData.proof.useProxy) {
try {
proofData = await serviceproviders.proxyRequestHandler(spData, opts)
proofData = await serviceproviders.proxyRequestHandler(
spData,
opts
)
} catch (er) {}
} else {
try {
proofData = await serviceproviders.directRequestHandler(spData, opts)
proofData = await serviceproviders.directRequestHandler(
spData,
opts
)
} catch (er) {}
if (!proofData) {
try {
proofData = await serviceproviders.proxyRequestHandler(spData, opts)
proofData = await serviceproviders.proxyRequestHandler(
spData,
opts
)
} catch (er) {}
}
}
break;
break
case 'fallback':
try {
proofData = await serviceproviders.directRequestHandler(spData, opts)
proofData = await serviceproviders.directRequestHandler(
spData,
opts
)
} catch (er) {}
if (!proofData) {
try {
proofData = await serviceproviders.proxyRequestHandler(spData, opts)
proofData = await serviceproviders.proxyRequestHandler(
spData,
opts
)
} catch (er) {}
}
break;
break
case 'always':
try {
proofData = await serviceproviders.proxyRequestHandler(spData, opts)
proofData = await serviceproviders.proxyRequestHandler(
spData,
opts
)
} catch (er) {}
break;
break
case 'never':
try {
proofData = await serviceproviders.directRequestHandler(spData, opts)
proofData = await serviceproviders.directRequestHandler(
spData,
opts
)
} catch (er) {}
break;
break
default:
objResult.errors.push('invalid_proxy_policy')
}

View file

@ -120,7 +120,9 @@ const fetchURI = (uri) => {
switch (match[1]) {
case 'hkp':
resolve(fetchHKP(match[3] ? match[3] : match[2], match[3] ? match[2] : null))
resolve(
fetchHKP(match[3] ? match[3] : match[2], match[3] ? match[2] : null)
)
break
case 'wkd':
resolve(fetchWKD(match[2]))

View file

@ -108,11 +108,9 @@ const directRequestHandler = (spData, opts) => {
const proxyRequestHandler = (spData, opts) => {
return new Promise(async (resolve, reject) => {
const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri
req(
utils.generateProxyURL(spData.proof.format, url, opts),
null,
{ Accept: 'application/json' }
)
req(utils.generateProxyURL(spData.proof.format, url, opts), null, {
Accept: 'application/json',
})
.then(async (res) => {
return await res.json()
})

View file

@ -26,11 +26,9 @@ const customRequestHandler = async (spData, opts) => {
try {
resUser = await req(urlUser, null, { Accept: 'application/json' })
} catch (e) {
resUser = await req(
utils.generateProxyURL('web', urlUser, opts),
null,
{ Accept: 'application/json' }
)
resUser = await req(utils.generateProxyURL('web', urlUser, opts), null, {
Accept: 'application/json',
})
}
const jsonUser = await resUser.json()