Run prettier

This commit is contained in:
Yarmo Mackenbach 2021-03-06 00:04:56 +01:00
parent f05585bf60
commit 7641d1639a
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
3 changed files with 27 additions and 16 deletions

View file

@ -28,7 +28,11 @@ const processURI = (uri, opts) => {
if (match[2]) {
const params = queryString.parse(match[2])
if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) {
proofUrl = utils.generateProxyURL('matrix', [params['org.keyoxide.r'], params['org.keyoxide.e']], opts)
proofUrl = utils.generateProxyURL(
'matrix',
[params['org.keyoxide.r'], params['org.keyoxide.e']],
opts
)
}
}
@ -64,7 +68,8 @@ const tests = [
shouldMatch: true,
},
{
uri: 'matrix:u/@alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123',
uri:
'matrix:u/@alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123',
shouldMatch: true,
},
{

View file

@ -25,10 +25,14 @@ const customRequestHandler = async (spData, opts) => {
// Attempt direct verification if policy allows it
if (opts.proxyPolicy !== 'always') {
if ('twitterBearerToken' in opts && opts.twitterBearerToken) {
const res = await req(`https://api.twitter.com/1.1/statuses/show.json?id=${match[2]}`, null, {
Accept: 'application/json',
Authorization: `Bearer ${opts.twitterBearerToken}`
})
const res = await req(
`https://api.twitter.com/1.1/statuses/show.json?id=${match[2]}`,
null,
{
Accept: 'application/json',
Authorization: `Bearer ${opts.twitterBearerToken}`,
}
)
const json = await res.json()
return json.text
} else if ('nitterInstance' in opts && opts.nitterInstance) {
@ -43,15 +47,15 @@ const customRequestHandler = async (spData, opts) => {
return req(utils.generateProxyURL('twitter', match[2], opts), null, {
Accept: 'application/json',
})
.then(async (res) => {
return await res.json()
})
.then((res) => {
return res.data.text
})
.catch((e) => {
reject(e)
})
.then(async (res) => {
return await res.json()
})
.then((res) => {
return res.data.text
})
.catch((e) => {
reject(e)
})
}
// No verification

View file

@ -26,7 +26,9 @@ const generateProxyURL = (type, urlElements, opts) => {
urlElements = [urlElements]
}
urlElements = urlElements.map((x) => { return encodeURIComponent(x) })
urlElements = urlElements.map((x) => {
return encodeURIComponent(x)
})
return `https://${
opts.doipProxyHostname