Skip to content

Commit

Permalink
update cdnURL
Browse files Browse the repository at this point in the history
  • Loading branch information
guanzo committed Sep 8, 2023
1 parent ced3e53 commit 98ff5a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Saturn {
constructor (opts = {}) {
this.opts = Object.assign({}, {
clientId: randomUUID(),
cdnURL: 'strn.pl',
cdnURL: 'saturn.ms',
connectTimeout: 5_000,
downloadTimeout: 0
}, opts)
Expand All @@ -39,7 +39,6 @@ class Saturn {
CID.parse(cid)

const options = Object.assign({}, this.opts, { format: 'car' }, opts)

const url = `https://${options.cdnURL}/ipfs/${cid}?clientId=${options.clientId}&format=${options.format}`

const log = {
Expand Down Expand Up @@ -81,7 +80,10 @@ class Saturn {
throw new Error(`Non OK response received: ${res.status} ${res.statusText}`)
}

const validationResult = await (options.downloadTimeout ? Promise.race([validateBody(res.body), setTimeoutPromise(options.downloadTimeout, false, { ref: false })]) : validateBody(res.body))
const validationResult = await (options.downloadTimeout
? Promise.race([validateBody(res.body), setTimeoutPromise(options.downloadTimeout, false, { ref: false })])
: validateBody(res.body))

if (!validationResult) {
controller.abort()
throw new Error('Couldn\'t download and validate test CID in time')
Expand Down

0 comments on commit 98ff5a4

Please sign in to comment.