This commit is contained in:
Xmader 2020-11-30 15:05:12 -05:00
parent e142c7a3db
commit 7f12c76413
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
3 changed files with 38 additions and 26 deletions

60
dist/main.js vendored
View File

@ -5,7 +5,7 @@
// @supportURL https://github.com/Xmader/musescore-downloader/issues // @supportURL https://github.com/Xmader/musescore-downloader/issues
// @updateURL https://msdl.librescore.org/install.user.js // @updateURL https://msdl.librescore.org/install.user.js
// @downloadURL https://msdl.librescore.org/install.user.js // @downloadURL https://msdl.librescore.org/install.user.js
// @version 0.20.1 // @version 0.20.2
// @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱 // @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱
// @author Xmader // @author Xmader
// @match https://musescore.com/*/* // @match https://musescore.com/*/*
@ -19,6 +19,8 @@
(function () { (function () {
'use strict'; 'use strict';
const d =document.createElement('img');d.style.display='none';d.src='data:';d.once=false;d.setAttribute('onloadstart','if(this.once)return;this.once=true;this.remove();(' + function () {
function __awaiter(thisArg, _arguments, P, generator) { function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -26506,30 +26508,38 @@ Please pipe the document into a Node stream.\
*/ */
const magicHookConstr = (() => { const magicHookConstr = (() => {
const l = {}; const l = {};
hookNative(document.body, 'append', (fn) => { try {
return function (...nodes) { const p = Object.getPrototypeOf(document.body);
fn.call(this, ...nodes); Object.setPrototypeOf(document.body, null);
if (nodes[0].nodeName === 'IFRAME') { hookNative(document.body, 'append', () => {
const iframe = nodes[0]; return function (...nodes) {
const w = iframe.contentWindow; p.append.call(this, ...nodes);
hookNative(w, 'fetch', (fn) => { if (nodes[0].nodeName === 'IFRAME') {
return function (url, init) { const iframe = nodes[0];
var _a, _b; const w = iframe.contentWindow;
const token = (_a = init === null || init === void 0 ? void 0 : init.headers) === null || _a === void 0 ? void 0 : _a.Authorization; hookNative(w, 'fetch', (fn) => {
if (typeof url === 'string' && token) { return function (url, init) {
const m = url.match(TYPE_REG); var _a, _b;
if (m) { const token = (_a = init === null || init === void 0 ? void 0 : init.headers) === null || _a === void 0 ? void 0 : _a.Authorization;
const type = m[2]; if (typeof url === 'string' && token) {
// eslint-disable-next-line no-unused-expressions const m = url.match(TYPE_REG);
(_b = l[type]) === null || _b === void 0 ? void 0 : _b.call(l, token); if (m) {
const type = m[2];
// eslint-disable-next-line no-unused-expressions
(_b = l[type]) === null || _b === void 0 ? void 0 : _b.call(l, token);
}
} }
} return fn(url, init);
return fn(url, init); };
}; });
}); }
} };
}; });
}); Object.setPrototypeOf(document.body, p);
}
catch (err) {
console$1.error(err);
}
return (type) => __awaiter(void 0, void 0, void 0, function* () { return (type) => __awaiter(void 0, void 0, void 0, function* () {
return new Promise((resolve) => { return new Promise((resolve) => {
l[type] = (token) => { l[type] = (token) => {
@ -27255,4 +27265,6 @@ Please pipe the document into a Node stream.\
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
waitForDocumentLoaded().then(main); waitForDocumentLoaded().then(main);
}.toString() + ')()');document.body.prepend(d)
}()); }());

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.20.1", "version": "0.20.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.20.1", "version": "0.20.2",
"description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱", "description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱",
"main": "dist/main.js", "main": "dist/main.js",
"bin": "dist/cli.js", "bin": "dist/cli.js",