kopia lustrzana https://github.com/Stopka/fedicrawl
Added nodeinfo content length limit (5k) solving issues with global redirects to endless streams
rodzic
cc42eebe0e
commit
b2725e5acf
|
@ -27,8 +27,7 @@ export type NodeInfo = z.infer<typeof schema>
|
||||||
export const retrieveNodeInfo = async (url: string): Promise<NodeInfo> => {
|
export const retrieveNodeInfo = async (url: string): Promise<NodeInfo> => {
|
||||||
console.info('Retrieving node info', { url: url })
|
console.info('Retrieving node info', { url: url })
|
||||||
const nodeInfoResponse = await axios.get(url, {
|
const nodeInfoResponse = await axios.get(url, {
|
||||||
timeout: getDefaultTimeoutMilliseconds(),
|
timeout: getDefaultTimeoutMilliseconds()
|
||||||
maxContentLength: 5000
|
|
||||||
})
|
})
|
||||||
assertSuccessJsonResponse(nodeInfoResponse)
|
assertSuccessJsonResponse(nodeInfoResponse)
|
||||||
return schema.parse(nodeInfoResponse.data)
|
return schema.parse(nodeInfoResponse.data)
|
||||||
|
|
|
@ -14,10 +14,13 @@ const wellKnownSchema = z.object({
|
||||||
|
|
||||||
export type WellKnown = z.infer<typeof wellKnownSchema>
|
export type WellKnown = z.infer<typeof wellKnownSchema>
|
||||||
|
|
||||||
export const retrieveWellKnown = async (domain:string):Promise<WellKnown> => {
|
export const retrieveWellKnown = async (domain: string): Promise<WellKnown> => {
|
||||||
console.info('Retrieving well known', { domain: domain })
|
console.info('Retrieving well known', { domain: domain })
|
||||||
const wellKnownUrl = `https://${domain}/.well-known/nodeinfo`
|
const wellKnownUrl = `https://${domain}/.well-known/nodeinfo`
|
||||||
const wellKnownResponse = await axios.get(wellKnownUrl, { timeout: getDefaultTimeoutMilliseconds() })
|
const wellKnownResponse = await axios.get(wellKnownUrl, {
|
||||||
|
timeout: getDefaultTimeoutMilliseconds(),
|
||||||
|
maxContentLength: 5000
|
||||||
|
})
|
||||||
assertSuccessJsonResponse(wellKnownResponse)
|
assertSuccessJsonResponse(wellKnownResponse)
|
||||||
return wellKnownSchema.parse(wellKnownResponse.data)
|
return wellKnownSchema.parse(wellKnownResponse.data)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue