mirror of
https://github.com/LibreScore/dl-librescore
synced 2024-09-18 13:41:33 +02:00
fix: cli invalid url error and incorrect authorization URL
feat: update user agent
This commit is contained in:
parent
5f72b4f8e6
commit
aa4fc038e0
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "dl-librescore",
|
"name": "dl-librescore",
|
||||||
"version": "0.35.0",
|
"version": "0.35.16",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dl-librescore",
|
"name": "dl-librescore",
|
||||||
"version": "0.35.0",
|
"version": "0.35.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@librescore/fonts": "^0.4.1",
|
"@librescore/fonts": "^0.4.1",
|
||||||
|
20
src/file.ts
20
src/file.ts
@ -11,7 +11,7 @@ const getSuffix = async (scoreUrl: string): Promise<string> => {
|
|||||||
let suffixUrl;
|
let suffixUrl;
|
||||||
if (scoreUrl !== "") {
|
if (scoreUrl !== "") {
|
||||||
suffixUrl = (await (await fetch(scoreUrl)).text()).match(
|
suffixUrl = (await (await fetch(scoreUrl)).text()).match(
|
||||||
'<link href="(https://musescore.com/static/public/build/musescore(?:_es6)?/20.+?.js)"'
|
'<link href="(https://musescore.com/static/public/build/musescore.*?(?:_es6)?/20.+?.js)"'
|
||||||
)?.[1]!;
|
)?.[1]!;
|
||||||
} else {
|
} else {
|
||||||
const suffixElement =
|
const suffixElement =
|
||||||
@ -20,6 +20,12 @@ const getSuffix = async (scoreUrl: string): Promise<string> => {
|
|||||||
) as HTMLLinkElement) ??
|
) as HTMLLinkElement) ??
|
||||||
(document.head.querySelector(
|
(document.head.querySelector(
|
||||||
"link[href^='https://musescore.com/static/public/build/musescore/20']"
|
"link[href^='https://musescore.com/static/public/build/musescore/20']"
|
||||||
|
) as HTMLLinkElement) ??
|
||||||
|
(document.head.querySelector(
|
||||||
|
"link[href^='https://musescore.com/static/public/build/musescore_fonts_es6/20']"
|
||||||
|
) as HTMLLinkElement) ??
|
||||||
|
(document.head.querySelector(
|
||||||
|
"link[href^='https://musescore.com/static/public/build/musescore_fonts/20']"
|
||||||
) as HTMLLinkElement);
|
) as HTMLLinkElement);
|
||||||
suffixUrl = suffixElement?.href;
|
suffixUrl = suffixElement?.href;
|
||||||
}
|
}
|
||||||
@ -61,18 +67,18 @@ const getApiAuthNetwork = async (
|
|||||||
if (!fsBtn) {
|
if (!fsBtn) {
|
||||||
throw Error;
|
throw Error;
|
||||||
}
|
}
|
||||||
const el =
|
const el =
|
||||||
fsBtn.parentElement?.parentElement?.querySelector(
|
fsBtn.parentElement?.parentElement?.querySelector(
|
||||||
"button"
|
"button"
|
||||||
) as HTMLButtonElement;
|
) as HTMLButtonElement;
|
||||||
el.click();
|
el.click();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "mp3": {
|
case "mp3": {
|
||||||
const el = document.querySelector(
|
const el = document.querySelector(
|
||||||
'button[title="Toggle Play"]'
|
'button[title="Toggle Play"]'
|
||||||
) as HTMLButtonElement;
|
) as HTMLButtonElement;
|
||||||
el.click();
|
el.click();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "img": {
|
case "img": {
|
||||||
|
@ -17,8 +17,8 @@ export const getIndexPath = (id: number): string => {
|
|||||||
|
|
||||||
const NODE_FETCH_HEADERS = {
|
const NODE_FETCH_HEADERS = {
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0",
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.2535.85",
|
||||||
"Accept-Language": "en-US,en;q=0.8",
|
"Accept-Language": "en-US;q=0.8",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getFetch = (): typeof fetch => {
|
export const getFetch = (): typeof fetch => {
|
||||||
|
Loading…
Reference in New Issue
Block a user