fix: mscz file ref

This commit is contained in:
Xmader 2020-11-14 17:44:25 -05:00
parent 7705320ce9
commit e10b975eeb
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 7 additions and 1 deletions

View File

@ -14,6 +14,7 @@ export const ugappJsStore: Record<string, any> | null = (() => {
})()
const IPNS_KEY = 'QmSdXtvzC8v8iTTZuj5cVmiugnzbR1QATYRcGix4bBsioP'
const RADIX = 20
export const scoreinfo = {
@ -32,6 +33,11 @@ export const scoreinfo = {
}
},
get idLastDigit (this: typeof scoreinfo): number {
const idStr = (+this.id).toString(RADIX)
return parseInt(idStr[idStr.length - 1], RADIX)
},
get title (this: typeof scoreinfo): string {
try {
return this.playerdata.title
@ -68,7 +74,7 @@ export const scoreinfo = {
},
get msczIpfsRef (this: typeof scoreinfo): string {
return `/ipns/${IPNS_KEY}/${this.id}.mscz`
return `/ipns/${IPNS_KEY}/${this.idLastDigit}/${this.id}.mscz`
},
get msczCidUrl (this: typeof scoreinfo): string {