feat: update librescore link

This commit is contained in:
Xmader 2021-05-13 23:54:39 -04:00
parent ffbac084fb
commit 1bf3050513
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
2 changed files with 5 additions and 4 deletions

View File

@ -2,8 +2,9 @@ import { assertRes, getFetch } from './utils'
import { getMainCid } from './mscz' import { getMainCid } from './mscz'
import { ScoreInfo } from './scoreinfo' import { ScoreInfo } from './scoreinfo'
const _getLink = (scorepack: string) => { const _getLink = (indexingInfo: string) => {
return `https://librescore.org/score/${scorepack}` const { scorepack } = JSON.parse(indexingInfo)
return `https://librescore.org/score/${scorepack as string}`
} }
export const getLibreScoreLink = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Promise<string> => { export const getLibreScoreLink = async (scoreinfo: ScoreInfo, _fetch = getFetch()): Promise<string> => {

View File

@ -4,7 +4,7 @@ import { getMainCid } from './mscz'
export abstract class ScoreInfo { export abstract class ScoreInfo {
private readonly RADIX = 20; private readonly RADIX = 20;
private readonly INDEX_RADIX = 128; private readonly INDEX_RADIX = 32;
abstract id: number; abstract id: number;
abstract title: string; abstract title: string;
@ -28,7 +28,7 @@ export abstract class ScoreInfo {
} }
public getScorepackRef (mainCid: string): string { public getScorepackRef (mainCid: string): string {
return `/ipfs/${mainCid}/index/${(+this.id) % this.INDEX_RADIX}/${this.id}/scorepack` return `/ipfs/${mainCid}/index/${(+this.id) % this.INDEX_RADIX}/${this.id}`
} }
} }