feat: update librescore link
This commit is contained in:
parent
ffbac084fb
commit
1bf3050513
|
@ -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> => {
|
||||||
|
|
|
@ -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}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue