kopia lustrzana https://github.com/Stopka/fedicrawl
Porównaj commity
2 Commity
3ed37c04ce
...
b2725e5acf
Autor | SHA1 | Data |
---|---|---|
Štěpán Škorpil | b2725e5acf | |
Štěpán Škorpil | cc42eebe0e |
|
@ -24,9 +24,11 @@ const schema = z.object({
|
|||
|
||||
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 })
|
||||
const nodeInfoResponse = await axios.get(url, { timeout: getDefaultTimeoutMilliseconds() })
|
||||
const nodeInfoResponse = await axios.get(url, {
|
||||
timeout: getDefaultTimeoutMilliseconds()
|
||||
})
|
||||
assertSuccessJsonResponse(nodeInfoResponse)
|
||||
return schema.parse(nodeInfoResponse.data)
|
||||
}
|
||||
|
|
|
@ -14,10 +14,13 @@ const wellKnownSchema = z.object({
|
|||
|
||||
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 })
|
||||
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)
|
||||
return wellKnownSchema.parse(wellKnownResponse.data)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue