Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dl-librescore

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dl-librescore - npm Package Compare versions

Comparing version 0.34.62 to 0.35.1

4

package.json
{
"name": "dl-librescore",
"version": "0.34.62",
"version": "0.35.1",
"description": "Download sheet music",

@@ -40,2 +40,3 @@ "main": "dist/main.user.js",

"inquirer": "^8.2.4",
"md5": "^2.3.0",
"node-fetch": "^2.6.7",

@@ -52,2 +53,3 @@ "ora": "^5.4.1",

"@types/inquirer": "^8.2.1",
"@types/md5": "^2.3.5",
"@types/pdfkit": "^0.12.6",

@@ -54,0 +56,0 @@ "@types/yargs": "^17.0.10",

/* eslint-disable no-extend-native */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import isNodeJs from "detect-node";
import md5 from "md5";
import { getFetch } from "./utils";

@@ -14,10 +14,14 @@ import { auths } from "./file-magics";

const getApiAuth = (id: number, type: FileType, index: number): string => {
const suffix = "et";
const code = `${id}${type}${index}${suffix}`;
return md5(code).slice(0, 4);
};
let imgInProgress = false;
const getApiAuth = async (type: FileType, index: number): Promise<string> => {
if (isNodeJs) {
// fix later
throw Error;
}
const getApiAuthNetwork = async (
type: FileType,
index: number
): Promise<string> => {
let numPages = 0;

@@ -122,17 +126,27 @@ let pageCooldown = 25;

): Promise<string> => {
let r;
const url = getApiUrl(id, type, index);
const auth = await getApiAuth(type, index);
if (type === "img" && index === 0) {
// auth is the URL for the first page
r = await _fetch(auth);
} else {
r = await _fetch(url, {
headers: {
Authorization: auth,
},
});
let auth = getApiAuth(id, type, index);
let r = await _fetch(url, {
headers: {
Authorization: auth,
},
});
if (!r.ok) {
auth = await getApiAuthNetwork(type, index);
if (type === "img" && index === 0) {
// auth is the URL for the first page
r = await _fetch(auth);
} else {
r = await _fetch(url, {
headers: {
Authorization: auth,
},
});
}
}
const { info } = await r.json();
return info.url as string;
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc