mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-23 06:59:29 -07:00
Run prettier
This commit is contained in:
parent
f05585bf60
commit
7641d1639a
3 changed files with 27 additions and 16 deletions
|
@ -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,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue