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> => {
|
export const fetchMscz = async (): Promise<ArrayBuffer> => {
|
||||||
if (!msczBufferP) {
|
if (!msczBufferP) {
|
||||||
const url = scoreinfo.msczUrl
|
const url = scoreinfo.msczCidUrl
|
||||||
msczBufferP = (async (): Promise<ArrayBuffer> => {
|
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()
|
const data = await r.arrayBuffer()
|
||||||
return data
|
return data
|
||||||
})()
|
})()
|
||||||
|
|
|
@ -71,8 +71,8 @@ export const scoreinfo = {
|
||||||
return `/ipns/${IPNS_KEY}/${this.id}.mscz`
|
return `/ipns/${IPNS_KEY}/${this.id}.mscz`
|
||||||
},
|
},
|
||||||
|
|
||||||
get msczUrl (this: typeof scoreinfo): string {
|
get msczCidUrl (this: typeof scoreinfo): string {
|
||||||
return `https://ipfs.infura.io:5001/api/v0/cat?arg=${this.msczIpfsRef}`
|
return `https://ipfs.infura.io:5001/api/v0/dag/resolve?arg=${this.msczIpfsRef}`
|
||||||
},
|
},
|
||||||
|
|
||||||
get sheetImgType (): 'svg' | 'png' {
|
get sheetImgType (): 'svg' | 'png' {
|
||||||
|
|
Loading…
Reference in a new issue