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",
|
||||
"version": "0.35.0",
|
||||
"version": "0.35.16",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dl-librescore",
|
||||
"version": "0.35.0",
|
||||
"version": "0.35.16",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@librescore/fonts": "^0.4.1",
|
||||
|
@ -11,7 +11,7 @@ const getSuffix = async (scoreUrl: string): Promise<string> => {
|
||||
let suffixUrl;
|
||||
if (scoreUrl !== "") {
|
||||
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]!;
|
||||
} else {
|
||||
const suffixElement =
|
||||
@ -20,6 +20,12 @@ const getSuffix = async (scoreUrl: string): Promise<string> => {
|
||||
) as HTMLLinkElement) ??
|
||||
(document.head.querySelector(
|
||||
"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);
|
||||
suffixUrl = suffixElement?.href;
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ export const getIndexPath = (id: number): string => {
|
||||
|
||||
const NODE_FETCH_HEADERS = {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0",
|
||||
"Accept-Language": "en-US,en;q=0.8",
|
||||
"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;q=0.8",
|
||||
};
|
||||
|
||||
export const getFetch = (): typeof fetch => {
|
||||
|
Loading…
Reference in New Issue
Block a user