fix: mscz ipfs
This commit is contained in:
parent
5003e6572f
commit
59c4e62912
2 changed files with 6 additions and 4 deletions
|
@ -6,9 +6,11 @@ let msczBufferP: Promise<ArrayBuffer> | undefined
|
|||
|
||||
export const fetchMscz = async (): Promise<ArrayBuffer> => {
|
||||
if (!msczBufferP) {
|
||||
const url = scoreinfo.msczUrl
|
||||
const url = scoreinfo.msczCidUrl
|
||||
msczBufferP = (async (): Promise<ArrayBuffer> => {
|
||||
const r = await fetch(url)
|
||||
const r0 = await fetch(url)
|
||||
const { Cid: { '/': cid } } = await r0.json()
|
||||
const r = await fetch(`https://ipfs.infura.io/ipfs/${cid as string}`)
|
||||
const data = await r.arrayBuffer()
|
||||
return data
|
||||
})()
|
||||
|
|
|
@ -71,8 +71,8 @@ export const scoreinfo = {
|
|||
return `/ipns/${IPNS_KEY}/${this.id}.mscz`
|
||||
},
|
||||
|
||||
get msczUrl (this: typeof scoreinfo): string {
|
||||
return `https://ipfs.infura.io:5001/api/v0/cat?arg=${this.msczIpfsRef}`
|
||||
get msczCidUrl (this: typeof scoreinfo): string {
|
||||
return `https://ipfs.infura.io:5001/api/v0/dag/resolve?arg=${this.msczIpfsRef}`
|
||||
},
|
||||
|
||||
get sheetImgType (): 'svg' | 'png' {
|
||||
|
|
Loading…
Reference in a new issue