Skip to content

Commit

Permalink
fix: handle mobile auth suffix link
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterNjeim committed Apr 16, 2024
1 parent 3d5919d commit 395b24b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import { auths } from "./file-magics";
export type FileType = "img" | "mp3" | "midi";

const getSuffix = async (): Promise<string> => {
const suffixUrl = (
document.head.querySelector(
const suffixElement =
(document.head.querySelector(
"link[href^='https://musescore.com/static/public/build/musescore_es6/20']"
) as HTMLLinkElement
)?.href;
) as HTMLLinkElement) ??
(document.head.querySelector(
"link[href^='https://musescore.com/static/public/build/musescore/20']"
) as HTMLLinkElement);
const suffixUrl = suffixElement?.href;
const suffixJs = await fetch(suffixUrl);
return (await suffixJs.text()).match(
'(?:.*)"(.+)"\\)\\.substr\\(0,4\\)'
Expand Down

0 comments on commit 395b24b

Please sign in to comment.