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]) { if (match[2]) {
const params = queryString.parse(match[2]) const params = queryString.parse(match[2])
if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) { 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, 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, shouldMatch: true,
}, },
{ {

View file

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

View file

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