From 7641d1639aebe0eaa7284cd02f6df2880c0333a9 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Sat, 6 Mar 2021 00:04:56 +0100 Subject: [PATCH] Run prettier --- src/serviceproviders/matrix.js | 9 +++++++-- src/serviceproviders/twitter.js | 30 +++++++++++++++++------------- src/utils.js | 4 +++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/serviceproviders/matrix.js b/src/serviceproviders/matrix.js index 23f29d1..aa21037 100644 --- a/src/serviceproviders/matrix.js +++ b/src/serviceproviders/matrix.js @@ -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, }, { diff --git a/src/serviceproviders/twitter.js b/src/serviceproviders/twitter.js index c4e38e8..8adc7fa 100644 --- a/src/serviceproviders/twitter.js +++ b/src/serviceproviders/twitter.js @@ -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 diff --git a/src/utils.js b/src/utils.js index b5b3d28..9283227 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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