migu-api-enhanced 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/index.cjs +286 -479
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -7
- package/dist/index.d.ts +75 -7
- package/dist/index.js +284 -479
- package/dist/index.js.map +1 -1
- package/package.json +64 -62
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/modules/index.ts
|
|
8
8
|
var modules_exports = {};
|
|
9
9
|
__export(modules_exports, {
|
|
10
|
+
YDRZ: () => YDRZ,
|
|
10
11
|
checkCanListen: () => checkCanListen,
|
|
11
12
|
checkToken: () => checkToken,
|
|
12
13
|
getAlbumInfo: () => getAlbumInfo,
|
|
@@ -44,6 +45,7 @@ __export(modules_exports, {
|
|
|
44
45
|
getUserMyList: () => getUserMyList,
|
|
45
46
|
getVersion: () => getVersion,
|
|
46
47
|
loginNP: () => loginNP,
|
|
48
|
+
loginOneClick: () => loginOneClick,
|
|
47
49
|
loginSim: () => loginSim,
|
|
48
50
|
queryUserInfo: () => queryUserInfo,
|
|
49
51
|
searchAlbum: () => searchAlbum,
|
|
@@ -189,10 +191,17 @@ var getRecommendPlaylist = async () => {
|
|
|
189
191
|
};
|
|
190
192
|
|
|
191
193
|
// src/utils/deviceID.ts
|
|
192
|
-
function getDeviceId() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
function getDeviceId(a, b) {
|
|
195
|
+
var c, d = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), e = [];
|
|
196
|
+
if (b = b || d.length, a)
|
|
197
|
+
for (c = 0; a > c; c++)
|
|
198
|
+
e[c] = d[0 | Math.random() * b];
|
|
199
|
+
else {
|
|
200
|
+
var f;
|
|
201
|
+
for (e[8] = e[13] = e[18] = e[23] = "-", e[14] = "4", c = 0; 36 > c; c++)
|
|
202
|
+
e[c] || (f = 0 | 16 * Math.random(), e[c] = d[19 == c ? 3 & f | 8 : f]);
|
|
203
|
+
}
|
|
204
|
+
return e.join("");
|
|
196
205
|
}
|
|
197
206
|
|
|
198
207
|
// src/modules/recommend_song.ts
|
|
@@ -298,7 +307,9 @@ var getUrlV2 = async (contentId, copyrightId, resourceType = "2", pacmtoken = ""
|
|
|
298
307
|
"timestamp": timestamp.toString(),
|
|
299
308
|
"Content-Type": "application/json;charset=UTF-8",
|
|
300
309
|
"referer": "https://music.migu.cn/",
|
|
301
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0"
|
|
310
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0",
|
|
311
|
+
"location-data": "30.6698676660,104.1229614820",
|
|
312
|
+
"location-info": ""
|
|
302
313
|
};
|
|
303
314
|
const res = await fetch(
|
|
304
315
|
`https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}©rightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=PQ`,
|
|
@@ -350,7 +361,9 @@ var getUrlH5V24 = async (contentId, copyrightId, resourceType = "2") => {
|
|
|
350
361
|
const headers = {
|
|
351
362
|
"birth": "h5page",
|
|
352
363
|
"channel": "014X031",
|
|
353
|
-
"Referer": "https://y.migu.cn/"
|
|
364
|
+
"Referer": "https://y.migu.cn/",
|
|
365
|
+
"location-data": "30.6698676660,104.1229614820",
|
|
366
|
+
"location-info": ""
|
|
354
367
|
};
|
|
355
368
|
const res = await fetch(
|
|
356
369
|
`https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,
|
|
@@ -424,30 +437,8 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
|
|
|
424
437
|
};
|
|
425
438
|
|
|
426
439
|
// src/modules/mv_info.ts
|
|
427
|
-
var getMvInfo = async (mvIds
|
|
428
|
-
|
|
429
|
-
}) => {
|
|
430
|
-
const res = await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvIds}&resourceType=D&needSimple=01`);
|
|
431
|
-
if (!res) return { error: "\u8BF7\u6C42\u5931\u8D25" };
|
|
432
|
-
if (res.error) return { error: res.error };
|
|
433
|
-
const resource = res.resource || [];
|
|
434
|
-
if (resource.length === 0) return { error: "resource\u4E0D\u5B58\u5728" };
|
|
435
|
-
if (needAbsoluteUrl) {
|
|
436
|
-
resource.forEach((item) => {
|
|
437
|
-
if (!item.rateFormats) return;
|
|
438
|
-
item.rateFormats.forEach((rateFormat) => {
|
|
439
|
-
if (!rateFormat.url) return;
|
|
440
|
-
if (!rateFormat.url.startsWith("http") && !rateFormat.url.startsWith("https")) {
|
|
441
|
-
if (rateFormat.url[0] === "/" && rateFormat.url[1] !== "/") {
|
|
442
|
-
rateFormat.absoluteUrl = `https://freevod.nf.migu.cn${rateFormat.url}`;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
res.resource = resource;
|
|
448
|
-
return res;
|
|
449
|
-
}
|
|
450
|
-
return res;
|
|
440
|
+
var getMvInfo = async (mvIds) => {
|
|
441
|
+
return h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvIds}&resourceType=D&needSimple=01`);
|
|
451
442
|
};
|
|
452
443
|
|
|
453
444
|
// src/modules/mv_hls.ts
|
|
@@ -464,438 +455,52 @@ var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012",
|
|
|
464
455
|
);
|
|
465
456
|
};
|
|
466
457
|
|
|
467
|
-
// src/utils/rsalib.
|
|
458
|
+
// src/utils/rsalib.ts
|
|
468
459
|
import crypto from "crypto";
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
for (let i = 0; i < arr.length; i++) {
|
|
490
|
-
arr[i] = bytes[i];
|
|
491
|
-
}
|
|
492
|
-
return arr;
|
|
493
|
-
},
|
|
494
|
-
random: function(len) {
|
|
495
|
-
const bytes = crypto.randomBytes(len);
|
|
496
|
-
return Array.from(bytes, (b) => String.fromCharCode(b)).join("");
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
define("lib/rsa/rsa", [], function(a, b, c) {
|
|
500
|
-
function d(a2, b2, c2) {
|
|
501
|
-
null != a2 && ("number" == typeof a2 ? this.fromNumber(a2, b2, c2) : null == b2 && "string" != typeof a2 ? this.fromString(a2, 256) : this.fromString(a2, b2));
|
|
502
|
-
}
|
|
503
|
-
function e() {
|
|
504
|
-
return new d(null);
|
|
505
|
-
}
|
|
506
|
-
function f(a2, b2, c2, d2, e2, f2) {
|
|
507
|
-
for (; --f2 >= 0; ) {
|
|
508
|
-
var g2 = b2 * this[a2++] + c2[d2] + e2;
|
|
509
|
-
e2 = Math.floor(g2 / 67108864), c2[d2++] = 67108863 & g2;
|
|
510
|
-
}
|
|
511
|
-
return e2;
|
|
512
|
-
}
|
|
513
|
-
function g(a2, b2, c2, d2, e2, f2) {
|
|
514
|
-
for (var g2 = 32767 & b2, h2 = b2 >> 15; --f2 >= 0; ) {
|
|
515
|
-
var i2 = 32767 & this[a2], j2 = this[a2++] >> 15, k2 = h2 * i2 + j2 * g2;
|
|
516
|
-
i2 = g2 * i2 + ((32767 & k2) << 15) + c2[d2] + (1073741823 & e2), e2 = (i2 >>> 30) + (k2 >>> 15) + h2 * j2 + (e2 >>> 30), c2[d2++] = 1073741823 & i2;
|
|
517
|
-
}
|
|
518
|
-
return e2;
|
|
519
|
-
}
|
|
520
|
-
function h(a2, b2, c2, d2, e2, f2) {
|
|
521
|
-
for (var g2 = 16383 & b2, h2 = b2 >> 14; --f2 >= 0; ) {
|
|
522
|
-
var i2 = 16383 & this[a2], j2 = this[a2++] >> 14, k2 = h2 * i2 + j2 * g2;
|
|
523
|
-
i2 = g2 * i2 + ((16383 & k2) << 14) + c2[d2] + e2, e2 = (i2 >> 28) + (k2 >> 14) + h2 * j2, c2[d2++] = 268435455 & i2;
|
|
524
|
-
}
|
|
525
|
-
return e2;
|
|
526
|
-
}
|
|
527
|
-
function i(a2) {
|
|
528
|
-
return nb.charAt(a2);
|
|
529
|
-
}
|
|
530
|
-
function j(a2, b2) {
|
|
531
|
-
var c2 = ob[a2.charCodeAt(b2)];
|
|
532
|
-
return null == c2 ? -1 : c2;
|
|
533
|
-
}
|
|
534
|
-
function k(a2) {
|
|
535
|
-
for (var b2 = this.t - 1; b2 >= 0; --b2)
|
|
536
|
-
a2[b2] = this[b2];
|
|
537
|
-
a2.t = this.t, a2.s = this.s;
|
|
538
|
-
}
|
|
539
|
-
function l(a2) {
|
|
540
|
-
this.t = 1, this.s = 0 > a2 ? -1 : 0, a2 > 0 ? this[0] = a2 : -1 > a2 ? this[0] = a2 + this.DV : this.t = 0;
|
|
541
|
-
}
|
|
542
|
-
function m(a2) {
|
|
543
|
-
var b2 = e();
|
|
544
|
-
return b2.fromInt(a2), b2;
|
|
545
|
-
}
|
|
546
|
-
function n(a2, b2) {
|
|
547
|
-
var c2;
|
|
548
|
-
if (16 == b2)
|
|
549
|
-
c2 = 4;
|
|
550
|
-
else if (8 == b2)
|
|
551
|
-
c2 = 3;
|
|
552
|
-
else if (256 == b2)
|
|
553
|
-
c2 = 8;
|
|
554
|
-
else if (2 == b2)
|
|
555
|
-
c2 = 1;
|
|
556
|
-
else if (32 == b2)
|
|
557
|
-
c2 = 5;
|
|
558
|
-
else {
|
|
559
|
-
if (4 != b2)
|
|
560
|
-
return void this.fromRadix(a2, b2);
|
|
561
|
-
c2 = 2;
|
|
562
|
-
}
|
|
563
|
-
this.t = 0, this.s = 0;
|
|
564
|
-
for (var e2 = a2.length, f2 = false, g2 = 0; --e2 >= 0; ) {
|
|
565
|
-
var h2 = 8 == c2 ? 255 & a2[e2] : j(a2, e2);
|
|
566
|
-
0 > h2 ? "-" == a2.charAt(e2) && (f2 = true) : (f2 = false, 0 == g2 ? this[this.t++] = h2 : g2 + c2 > this.DB ? (this[this.t - 1] |= (h2 & (1 << this.DB - g2) - 1) << g2, this[this.t++] = h2 >> this.DB - g2) : this[this.t - 1] |= h2 << g2, g2 += c2, g2 >= this.DB && (g2 -= this.DB));
|
|
567
|
-
}
|
|
568
|
-
8 == c2 && 0 != (128 & a2[0]) && (this.s = -1, g2 > 0 && (this[this.t - 1] |= (1 << this.DB - g2) - 1 << g2)), this.clamp(), f2 && d.ZERO.subTo(this, this);
|
|
569
|
-
}
|
|
570
|
-
function o() {
|
|
571
|
-
for (var a2 = this.s & this.DM; this.t > 0 && this[this.t - 1] == a2; )
|
|
572
|
-
--this.t;
|
|
573
|
-
}
|
|
574
|
-
function p(a2) {
|
|
575
|
-
if (this.s < 0)
|
|
576
|
-
return "-" + this.negate().toString(a2);
|
|
577
|
-
var b2;
|
|
578
|
-
if (16 == a2)
|
|
579
|
-
b2 = 4;
|
|
580
|
-
else if (8 == a2)
|
|
581
|
-
b2 = 3;
|
|
582
|
-
else if (2 == a2)
|
|
583
|
-
b2 = 1;
|
|
584
|
-
else if (32 == a2)
|
|
585
|
-
b2 = 5;
|
|
586
|
-
else {
|
|
587
|
-
if (4 != a2)
|
|
588
|
-
return this.toRadix(a2);
|
|
589
|
-
b2 = 2;
|
|
590
|
-
}
|
|
591
|
-
var c2, d2 = (1 << b2) - 1, e2 = false, f2 = "", g2 = this.t, h2 = this.DB - g2 * this.DB % b2;
|
|
592
|
-
if (g2-- > 0)
|
|
593
|
-
for (h2 < this.DB && (c2 = this[g2] >> h2) > 0 && (e2 = true, f2 = i(c2)); g2 >= 0; )
|
|
594
|
-
b2 > h2 ? (c2 = (this[g2] & (1 << h2) - 1) << b2 - h2, c2 |= this[--g2] >> (h2 += this.DB - b2)) : (c2 = this[g2] >> (h2 -= b2) & d2, 0 >= h2 && (h2 += this.DB, --g2)), c2 > 0 && (e2 = true), e2 && (f2 += i(c2));
|
|
595
|
-
return e2 ? f2 : "0";
|
|
596
|
-
}
|
|
597
|
-
function q() {
|
|
598
|
-
var a2 = e();
|
|
599
|
-
return d.ZERO.subTo(this, a2), a2;
|
|
600
|
-
}
|
|
601
|
-
function r() {
|
|
602
|
-
return this.s < 0 ? this.negate() : this;
|
|
603
|
-
}
|
|
604
|
-
function s(a2) {
|
|
605
|
-
var b2 = this.s - a2.s;
|
|
606
|
-
if (0 != b2)
|
|
607
|
-
return b2;
|
|
608
|
-
var c2 = this.t;
|
|
609
|
-
if (b2 = c2 - a2.t, 0 != b2)
|
|
610
|
-
return this.s < 0 ? -b2 : b2;
|
|
611
|
-
for (; --c2 >= 0; )
|
|
612
|
-
if (0 != (b2 = this[c2] - a2[c2]))
|
|
613
|
-
return b2;
|
|
614
|
-
return 0;
|
|
615
|
-
}
|
|
616
|
-
function t(a2) {
|
|
617
|
-
var b2, c2 = 1;
|
|
618
|
-
return 0 != (b2 = a2 >>> 16) && (a2 = b2, c2 += 16), 0 != (b2 = a2 >> 8) && (a2 = b2, c2 += 8), 0 != (b2 = a2 >> 4) && (a2 = b2, c2 += 4), 0 != (b2 = a2 >> 2) && (a2 = b2, c2 += 2), 0 != (b2 = a2 >> 1) && (a2 = b2, c2 += 1), c2;
|
|
619
|
-
}
|
|
620
|
-
function u() {
|
|
621
|
-
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + t(this[this.t - 1] ^ this.s & this.DM);
|
|
622
|
-
}
|
|
623
|
-
function v(a2, b2) {
|
|
624
|
-
var c2;
|
|
625
|
-
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
626
|
-
b2[c2 + a2] = this[c2];
|
|
627
|
-
for (c2 = a2 - 1; c2 >= 0; --c2)
|
|
628
|
-
b2[c2] = 0;
|
|
629
|
-
b2.t = this.t + a2, b2.s = this.s;
|
|
630
|
-
}
|
|
631
|
-
function w(a2, b2) {
|
|
632
|
-
for (var c2 = a2; c2 < this.t; ++c2)
|
|
633
|
-
b2[c2 - a2] = this[c2];
|
|
634
|
-
b2.t = Math.max(this.t - a2, 0), b2.s = this.s;
|
|
635
|
-
}
|
|
636
|
-
function x(a2, b2) {
|
|
637
|
-
var c2, d2 = a2 % this.DB, e2 = this.DB - d2, f2 = (1 << e2) - 1, g2 = Math.floor(a2 / this.DB), h2 = this.s << d2 & this.DM;
|
|
638
|
-
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
639
|
-
b2[c2 + g2 + 1] = this[c2] >> e2 | h2, h2 = (this[c2] & f2) << d2;
|
|
640
|
-
for (c2 = g2 - 1; c2 >= 0; --c2)
|
|
641
|
-
b2[c2] = 0;
|
|
642
|
-
b2[g2] = h2, b2.t = this.t + g2 + 1, b2.s = this.s, b2.clamp();
|
|
643
|
-
}
|
|
644
|
-
function y(a2, b2) {
|
|
645
|
-
b2.s = this.s;
|
|
646
|
-
var c2 = Math.floor(a2 / this.DB);
|
|
647
|
-
if (c2 >= this.t)
|
|
648
|
-
return void (b2.t = 0);
|
|
649
|
-
var d2 = a2 % this.DB, e2 = this.DB - d2, f2 = (1 << d2) - 1;
|
|
650
|
-
b2[0] = this[c2] >> d2;
|
|
651
|
-
for (var g2 = c2 + 1; g2 < this.t; ++g2)
|
|
652
|
-
b2[g2 - c2 - 1] |= (this[g2] & f2) << e2, b2[g2 - c2] = this[g2] >> d2;
|
|
653
|
-
d2 > 0 && (b2[this.t - c2 - 1] |= (this.s & f2) << e2), b2.t = this.t - c2, b2.clamp();
|
|
654
|
-
}
|
|
655
|
-
function z(a2, b2) {
|
|
656
|
-
for (var c2 = 0, d2 = 0, e2 = Math.min(a2.t, this.t); e2 > c2; )
|
|
657
|
-
d2 += this[c2] - a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
658
|
-
if (a2.t < this.t) {
|
|
659
|
-
for (d2 -= a2.s; c2 < this.t; )
|
|
660
|
-
d2 += this[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
661
|
-
d2 += this.s;
|
|
662
|
-
} else {
|
|
663
|
-
for (d2 += this.s; c2 < a2.t; )
|
|
664
|
-
d2 -= a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
665
|
-
d2 -= a2.s;
|
|
666
|
-
}
|
|
667
|
-
b2.s = 0 > d2 ? -1 : 0, -1 > d2 ? b2[c2++] = this.DV + d2 : d2 > 0 && (b2[c2++] = d2), b2.t = c2, b2.clamp();
|
|
668
|
-
}
|
|
669
|
-
function A(a2, b2) {
|
|
670
|
-
var c2 = this.abs(), e2 = a2.abs(), f2 = c2.t;
|
|
671
|
-
for (b2.t = f2 + e2.t; --f2 >= 0; )
|
|
672
|
-
b2[f2] = 0;
|
|
673
|
-
for (f2 = 0; f2 < e2.t; ++f2)
|
|
674
|
-
b2[f2 + c2.t] = c2.am(0, e2[f2], b2, f2, 0, c2.t);
|
|
675
|
-
b2.s = 0, b2.clamp(), this.s != a2.s && d.ZERO.subTo(b2, b2);
|
|
676
|
-
}
|
|
677
|
-
function B(a2) {
|
|
678
|
-
for (var b2 = this.abs(), c2 = a2.t = 2 * b2.t; --c2 >= 0; )
|
|
679
|
-
a2[c2] = 0;
|
|
680
|
-
for (c2 = 0; c2 < b2.t - 1; ++c2) {
|
|
681
|
-
var d2 = b2.am(c2, b2[c2], a2, 2 * c2, 0, 1);
|
|
682
|
-
(a2[c2 + b2.t] += b2.am(c2 + 1, 2 * b2[c2], a2, 2 * c2 + 1, d2, b2.t - c2 - 1)) >= b2.DV && (a2[c2 + b2.t] -= b2.DV, a2[c2 + b2.t + 1] = 1);
|
|
683
|
-
}
|
|
684
|
-
a2.t > 0 && (a2[a2.t - 1] += b2.am(c2, b2[c2], a2, 2 * c2, 0, 1)), a2.s = 0, a2.clamp();
|
|
685
|
-
}
|
|
686
|
-
function C(a2, b2, c2) {
|
|
687
|
-
var f2 = a2.abs();
|
|
688
|
-
if (!(f2.t <= 0)) {
|
|
689
|
-
var g2 = this.abs();
|
|
690
|
-
if (g2.t < f2.t)
|
|
691
|
-
return null != b2 && b2.fromInt(0), void (null != c2 && this.copyTo(c2));
|
|
692
|
-
null == c2 && (c2 = e());
|
|
693
|
-
var h2 = e(), i2 = this.s, j2 = a2.s, k2 = this.DB - t(f2[f2.t - 1]);
|
|
694
|
-
k2 > 0 ? (f2.lShiftTo(k2, h2), g2.lShiftTo(k2, c2)) : (f2.copyTo(h2), g2.copyTo(c2));
|
|
695
|
-
var l2 = h2.t, m2 = h2[l2 - 1];
|
|
696
|
-
if (0 != m2) {
|
|
697
|
-
var n2 = m2 * (1 << this.F1) + (l2 > 1 ? h2[l2 - 2] >> this.F2 : 0), o2 = this.FV / n2, p2 = (1 << this.F1) / n2, q2 = 1 << this.F2, r2 = c2.t, s2 = r2 - l2, u2 = null == b2 ? e() : b2;
|
|
698
|
-
for (h2.dlShiftTo(s2, u2), c2.compareTo(u2) >= 0 && (c2[c2.t++] = 1, c2.subTo(u2, c2)), d.ONE.dlShiftTo(l2, u2), u2.subTo(h2, h2); h2.t < l2; )
|
|
699
|
-
h2[h2.t++] = 0;
|
|
700
|
-
for (; --s2 >= 0; ) {
|
|
701
|
-
var v2 = c2[--r2] == m2 ? this.DM : Math.floor(c2[r2] * o2 + (c2[r2 - 1] + q2) * p2);
|
|
702
|
-
if ((c2[r2] += h2.am(0, v2, c2, s2, 0, l2)) < v2)
|
|
703
|
-
for (h2.dlShiftTo(s2, u2), c2.subTo(u2, c2); c2[r2] < --v2; )
|
|
704
|
-
c2.subTo(u2, c2);
|
|
705
|
-
}
|
|
706
|
-
null != b2 && (c2.drShiftTo(l2, b2), i2 != j2 && d.ZERO.subTo(b2, b2)), c2.t = l2, c2.clamp(), k2 > 0 && c2.rShiftTo(k2, c2), 0 > i2 && d.ZERO.subTo(c2, c2);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
function D(a2) {
|
|
711
|
-
var b2 = e();
|
|
712
|
-
return this.abs().divRemTo(a2, null, b2), this.s < 0 && b2.compareTo(d.ZERO) > 0 && a2.subTo(b2, b2), b2;
|
|
713
|
-
}
|
|
714
|
-
function E(a2) {
|
|
715
|
-
this.m = a2;
|
|
716
|
-
}
|
|
717
|
-
function F(a2) {
|
|
718
|
-
return a2.s < 0 || a2.compareTo(this.m) >= 0 ? a2.mod(this.m) : a2;
|
|
719
|
-
}
|
|
720
|
-
function G(a2) {
|
|
721
|
-
return a2;
|
|
722
|
-
}
|
|
723
|
-
function H(a2) {
|
|
724
|
-
a2.divRemTo(this.m, null, a2);
|
|
725
|
-
}
|
|
726
|
-
function I(a2, b2, c2) {
|
|
727
|
-
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
728
|
-
}
|
|
729
|
-
function J(a2, b2) {
|
|
730
|
-
a2.squareTo(b2), this.reduce(b2);
|
|
731
|
-
}
|
|
732
|
-
function K() {
|
|
733
|
-
if (this.t < 1)
|
|
734
|
-
return 0;
|
|
735
|
-
var a2 = this[0];
|
|
736
|
-
if (0 == (1 & a2))
|
|
737
|
-
return 0;
|
|
738
|
-
var b2 = 3 & a2;
|
|
739
|
-
return b2 = b2 * (2 - (15 & a2) * b2) & 15, b2 = b2 * (2 - (255 & a2) * b2) & 255, b2 = b2 * (2 - ((65535 & a2) * b2 & 65535)) & 65535, b2 = b2 * (2 - a2 * b2 % this.DV) % this.DV, b2 > 0 ? this.DV - b2 : -b2;
|
|
740
|
-
}
|
|
741
|
-
function L(a2) {
|
|
742
|
-
this.m = a2, this.mp = a2.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << a2.DB - 15) - 1, this.mt2 = 2 * a2.t;
|
|
743
|
-
}
|
|
744
|
-
function M(a2) {
|
|
745
|
-
var b2 = e();
|
|
746
|
-
return a2.abs().dlShiftTo(this.m.t, b2), b2.divRemTo(this.m, null, b2), a2.s < 0 && b2.compareTo(d.ZERO) > 0 && this.m.subTo(b2, b2), b2;
|
|
747
|
-
}
|
|
748
|
-
function N(a2) {
|
|
749
|
-
var b2 = e();
|
|
750
|
-
return a2.copyTo(b2), this.reduce(b2), b2;
|
|
751
|
-
}
|
|
752
|
-
function O(a2) {
|
|
753
|
-
for (; a2.t <= this.mt2; )
|
|
754
|
-
a2[a2.t++] = 0;
|
|
755
|
-
for (var b2 = 0; b2 < this.m.t; ++b2) {
|
|
756
|
-
var c2 = 32767 & a2[b2], d2 = c2 * this.mpl + ((c2 * this.mph + (a2[b2] >> 15) * this.mpl & this.um) << 15) & a2.DM;
|
|
757
|
-
for (c2 = b2 + this.m.t, a2[c2] += this.m.am(0, d2, a2, b2, 0, this.m.t); a2[c2] >= a2.DV; )
|
|
758
|
-
a2[c2] -= a2.DV, a2[++c2]++;
|
|
759
|
-
}
|
|
760
|
-
a2.clamp(), a2.drShiftTo(this.m.t, a2), a2.compareTo(this.m) >= 0 && a2.subTo(this.m, a2);
|
|
761
|
-
}
|
|
762
|
-
function P(a2, b2) {
|
|
763
|
-
a2.squareTo(b2), this.reduce(b2);
|
|
764
|
-
}
|
|
765
|
-
function Q(a2, b2, c2) {
|
|
766
|
-
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
767
|
-
}
|
|
768
|
-
function R() {
|
|
769
|
-
return 0 == (this.t > 0 ? 1 & this[0] : this.s);
|
|
770
|
-
}
|
|
771
|
-
function S(a2, b2) {
|
|
772
|
-
if (a2 > 4294967295 || 1 > a2)
|
|
773
|
-
return d.ONE;
|
|
774
|
-
var c2 = e(), f2 = e(), g2 = b2.convert(this), h2 = t(a2) - 1;
|
|
775
|
-
for (g2.copyTo(c2); --h2 >= 0; )
|
|
776
|
-
if (b2.sqrTo(c2, f2), (a2 & 1 << h2) > 0)
|
|
777
|
-
b2.mulTo(f2, g2, c2);
|
|
778
|
-
else {
|
|
779
|
-
var i2 = c2;
|
|
780
|
-
c2 = f2, f2 = i2;
|
|
781
|
-
}
|
|
782
|
-
return b2.revert(c2);
|
|
783
|
-
}
|
|
784
|
-
function T(a2, b2) {
|
|
785
|
-
var c2;
|
|
786
|
-
return c2 = 256 > a2 || b2.isEven() ? new E(b2) : new L(b2), this.exp(a2, c2);
|
|
787
|
-
}
|
|
788
|
-
function U() {
|
|
789
|
-
this.i = 0, this.j = 0, this.S = new Array();
|
|
790
|
-
}
|
|
791
|
-
function V(a2) {
|
|
792
|
-
var b2, c2, d2;
|
|
793
|
-
for (b2 = 0; 256 > b2; ++b2)
|
|
794
|
-
this.S[b2] = b2;
|
|
795
|
-
for (c2 = 0, b2 = 0; 256 > b2; ++b2)
|
|
796
|
-
c2 = c2 + this.S[b2] + a2[b2 % a2.length] & 255, d2 = this.S[b2], this.S[b2] = this.S[c2], this.S[c2] = d2;
|
|
797
|
-
this.i = 0, this.j = 0;
|
|
798
|
-
}
|
|
799
|
-
function W() {
|
|
800
|
-
var a2;
|
|
801
|
-
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, a2 = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = a2, this.S[a2 + this.S[this.i] & 255];
|
|
802
|
-
}
|
|
803
|
-
function X() {
|
|
804
|
-
return new U();
|
|
805
|
-
}
|
|
806
|
-
function Y(a2) {
|
|
807
|
-
qb[rb++] ^= 255 & a2, qb[rb++] ^= a2 >> 8 & 255, qb[rb++] ^= a2 >> 16 & 255, qb[rb++] ^= a2 >> 24 & 255, rb >= sb && (rb -= sb);
|
|
808
|
-
}
|
|
809
|
-
function Z() {
|
|
810
|
-
Y((/* @__PURE__ */ new Date()).getTime());
|
|
811
|
-
}
|
|
812
|
-
function $() {
|
|
813
|
-
if (null == pb) {
|
|
814
|
-
for (Z(), pb = X(), pb.init(qb), rb = 0; rb < qb.length; ++rb)
|
|
815
|
-
qb[rb] = 0;
|
|
816
|
-
rb = 0;
|
|
817
|
-
}
|
|
818
|
-
return pb.next();
|
|
819
|
-
}
|
|
820
|
-
function _(a2) {
|
|
821
|
-
var b2;
|
|
822
|
-
for (b2 = 0; b2 < a2.length; ++b2)
|
|
823
|
-
a2[b2] = $();
|
|
824
|
-
}
|
|
825
|
-
function ab() {
|
|
826
|
-
}
|
|
827
|
-
function bb(a2, b2) {
|
|
828
|
-
return new d(a2, b2);
|
|
829
|
-
}
|
|
830
|
-
function cb(a2, b2) {
|
|
831
|
-
if (b2 < a2.length + 11)
|
|
832
|
-
return console.error("Message too long for RSA"), null;
|
|
833
|
-
for (var c2 = new Array(), e2 = a2.length - 1; e2 >= 0 && b2 > 0; ) {
|
|
834
|
-
var f2 = a2.charCodeAt(e2--);
|
|
835
|
-
128 > f2 ? c2[--b2] = f2 : f2 > 127 && 2048 > f2 ? (c2[--b2] = 63 & f2 | 128, c2[--b2] = f2 >> 6 | 192) : (c2[--b2] = 63 & f2 | 128, c2[--b2] = f2 >> 6 & 63 | 128, c2[--b2] = f2 >> 12 | 224);
|
|
836
|
-
}
|
|
837
|
-
c2[--b2] = 0;
|
|
838
|
-
for (var g2 = new ab(), h2 = new Array(); b2 > 2; ) {
|
|
839
|
-
for (h2[0] = 0; 0 == h2[0]; )
|
|
840
|
-
g2.nextBytes(h2);
|
|
841
|
-
c2[--b2] = h2[0];
|
|
460
|
+
function hexToBase64Url(hex) {
|
|
461
|
+
const buffer = Buffer.from(hex, "hex");
|
|
462
|
+
return buffer.toString("base64url");
|
|
463
|
+
}
|
|
464
|
+
var RSAKey = class {
|
|
465
|
+
publicKey = null;
|
|
466
|
+
setPublic(modulus, exponent) {
|
|
467
|
+
try {
|
|
468
|
+
const jwkKey = {
|
|
469
|
+
kty: "RSA",
|
|
470
|
+
n: hexToBase64Url(modulus),
|
|
471
|
+
e: hexToBase64Url(exponent)
|
|
472
|
+
};
|
|
473
|
+
this.publicKey = crypto.createPublicKey({
|
|
474
|
+
key: jwkKey,
|
|
475
|
+
format: "jwk"
|
|
476
|
+
});
|
|
477
|
+
} catch (error) {
|
|
478
|
+
console.error("Failed to create public key:", error);
|
|
479
|
+
this.publicKey = null;
|
|
842
480
|
}
|
|
843
|
-
return c2[--b2] = 2, c2[--b2] = 0, new d(c2);
|
|
844
|
-
}
|
|
845
|
-
function db() {
|
|
846
|
-
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
847
|
-
}
|
|
848
|
-
function eb(a2, b2) {
|
|
849
|
-
null != a2 && null != b2 && a2.length > 0 && b2.length > 0 ? (this.n = bb(a2, 16), this.e = parseInt(b2, 16)) : console.error("net error");
|
|
850
481
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
function gb(a2) {
|
|
855
|
-
var b2 = cb(a2, this.n.bitLength() + 7 >> 3);
|
|
856
|
-
if (null == b2)
|
|
857
|
-
return null;
|
|
858
|
-
var c2 = this.doPublic(b2);
|
|
859
|
-
if (null == c2)
|
|
482
|
+
encrypt(text) {
|
|
483
|
+
if (!this.publicKey) {
|
|
484
|
+
console.error("Public key not set");
|
|
860
485
|
return null;
|
|
861
|
-
var d2 = c2.toString(16);
|
|
862
|
-
return 0 == (1 & d2.length) ? d2 : "0" + d2;
|
|
863
|
-
}
|
|
864
|
-
var hb, ib = 244837814094590, jb = 15715070 == (16777215 & ib);
|
|
865
|
-
jb && "Microsoft Internet Explorer" == navigator.appName ? (d.prototype.am = g, hb = 30) : jb && "Netscape" != navigator.appName ? (d.prototype.am = f, hb = 26) : (d.prototype.am = h, hb = 28), d.prototype.DB = hb, d.prototype.DM = (1 << hb) - 1, d.prototype.DV = 1 << hb;
|
|
866
|
-
var kb = 52;
|
|
867
|
-
d.prototype.FV = Math.pow(2, kb), d.prototype.F1 = kb - hb, d.prototype.F2 = 2 * hb - kb;
|
|
868
|
-
var lb, mb, nb = "0123456789abcdefghijklmnopqrstuvwxyz", ob = new Array();
|
|
869
|
-
for (lb = "0".charCodeAt(0), mb = 0; 9 >= mb; ++mb)
|
|
870
|
-
ob[lb++] = mb;
|
|
871
|
-
for (lb = "a".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
872
|
-
ob[lb++] = mb;
|
|
873
|
-
for (lb = "A".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
874
|
-
ob[lb++] = mb;
|
|
875
|
-
E.prototype.convert = F, E.prototype.revert = G, E.prototype.reduce = H, E.prototype.mulTo = I, E.prototype.sqrTo = J, L.prototype.convert = M, L.prototype.revert = N, L.prototype.reduce = O, L.prototype.mulTo = Q, L.prototype.sqrTo = P, d.prototype.copyTo = k, d.prototype.fromInt = l, d.prototype.fromString = n, d.prototype.clamp = o, d.prototype.dlShiftTo = v, d.prototype.drShiftTo = w, d.prototype.lShiftTo = x, d.prototype.rShiftTo = y, d.prototype.subTo = z, d.prototype.multiplyTo = A, d.prototype.squareTo = B, d.prototype.divRemTo = C, d.prototype.invDigit = K, d.prototype.isEven = R, d.prototype.exp = S, d.prototype.toString = p, d.prototype.negate = q, d.prototype.abs = r, d.prototype.compareTo = s, d.prototype.bitLength = u, d.prototype.mod = D, d.prototype.modPowInt = T, d.ZERO = m(0), d.ONE = m(1), U.prototype.init = V, U.prototype.next = W;
|
|
876
|
-
var pb, qb, rb, sb = 256;
|
|
877
|
-
if (null == qb) {
|
|
878
|
-
qb = new Array(), rb = 0;
|
|
879
|
-
var tb;
|
|
880
|
-
if (window.crypto && window.crypto.getRandomValues) {
|
|
881
|
-
var ub = new Uint8Array(32);
|
|
882
|
-
for (window.crypto.getRandomValues(ub), tb = 0; 32 > tb; ++tb)
|
|
883
|
-
qb[rb++] = ub[tb];
|
|
884
486
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
487
|
+
try {
|
|
488
|
+
const buffer = Buffer.from(text, "utf-8");
|
|
489
|
+
const encrypted = crypto.publicEncrypt(
|
|
490
|
+
{
|
|
491
|
+
key: this.publicKey,
|
|
492
|
+
padding: crypto.constants.RSA_PKCS1_PADDING
|
|
493
|
+
},
|
|
494
|
+
buffer
|
|
495
|
+
);
|
|
496
|
+
return encrypted.toString("hex");
|
|
497
|
+
} catch (error) {
|
|
498
|
+
console.error("RSA encryption failed:", error);
|
|
499
|
+
return null;
|
|
889
500
|
}
|
|
890
|
-
for (; sb > rb; )
|
|
891
|
-
tb = Math.floor(65536 * Math.random()), qb[rb++] = tb >>> 8, qb[rb++] = 255 & tb;
|
|
892
|
-
rb = 0, Z();
|
|
893
501
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
};
|
|
897
|
-
});
|
|
898
|
-
var rsalib_default = rsa;
|
|
502
|
+
};
|
|
503
|
+
var rsalib_default = { RSAKey };
|
|
899
504
|
|
|
900
505
|
// src/utils/publicKey.ts
|
|
901
506
|
var getPublicKey = async () => {
|
|
@@ -912,15 +517,29 @@ var getPublicKey = async () => {
|
|
|
912
517
|
return { publicExponent, modulus };
|
|
913
518
|
};
|
|
914
519
|
|
|
520
|
+
// src/utils/URLParams.ts
|
|
521
|
+
function URLParams($) {
|
|
522
|
+
const form = new URLSearchParams();
|
|
523
|
+
for (const [key, value] of Object.entries($)) {
|
|
524
|
+
form.append(key, String(value));
|
|
525
|
+
}
|
|
526
|
+
return form.toString();
|
|
527
|
+
}
|
|
528
|
+
|
|
915
529
|
// src/modules/login_np.ts
|
|
916
|
-
var
|
|
530
|
+
var RSAKey2 = rsalib_default.RSAKey;
|
|
917
531
|
function randomString() {
|
|
918
532
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
919
533
|
return random.toLowerCase();
|
|
920
534
|
}
|
|
921
535
|
var loginNP = {
|
|
536
|
+
/**
|
|
537
|
+
* 账号密码登录
|
|
538
|
+
* @param username 用户名
|
|
539
|
+
* @param password 密码
|
|
540
|
+
* @returns 登录成功后的 pacmtoken
|
|
541
|
+
*/
|
|
922
542
|
async authn(username, password) {
|
|
923
|
-
var error = "";
|
|
924
543
|
var $ = {
|
|
925
544
|
"isAsync": true,
|
|
926
545
|
"enpassword": "",
|
|
@@ -936,22 +555,18 @@ var loginNP = {
|
|
|
936
555
|
const p = await getPublicKey();
|
|
937
556
|
const { publicExponent, modulus } = p || {};
|
|
938
557
|
if (!modulus || !publicExponent) {
|
|
939
|
-
error
|
|
940
|
-
return { error };
|
|
558
|
+
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
941
559
|
}
|
|
942
|
-
var
|
|
943
|
-
|
|
944
|
-
const rsa_pwd =
|
|
945
|
-
const rsa_username =
|
|
560
|
+
var rsa = new RSAKey2();
|
|
561
|
+
rsa.setPublic(modulus, publicExponent);
|
|
562
|
+
const rsa_pwd = rsa.encrypt(password);
|
|
563
|
+
const rsa_username = rsa.encrypt(username);
|
|
946
564
|
const fakeFingerprint = randomString();
|
|
947
565
|
$.fingerPrint = fakeFingerprint;
|
|
948
566
|
$.fingerPrintDetail = fakeFingerprint;
|
|
949
|
-
$.enpassword = rsa_pwd;
|
|
950
|
-
$.loginID = rsa_username;
|
|
951
|
-
const form =
|
|
952
|
-
for (const [key, value] of Object.entries($)) {
|
|
953
|
-
form.append(key, String(value));
|
|
954
|
-
}
|
|
567
|
+
$.enpassword = rsa_pwd || "";
|
|
568
|
+
$.loginID = rsa_username || "";
|
|
569
|
+
const form = URLParams($);
|
|
955
570
|
const res = await fetch(
|
|
956
571
|
`https://passport.migu.cn/authn`,
|
|
957
572
|
{
|
|
@@ -962,7 +577,7 @@ var loginNP = {
|
|
|
962
577
|
body: form
|
|
963
578
|
}
|
|
964
579
|
);
|
|
965
|
-
if (!res.ok) return { error:
|
|
580
|
+
if (!res.ok) return { error: "\u8BF7\u6C42\u767B\u5F55\u5931\u8D25" };
|
|
966
581
|
const body = await res.json();
|
|
967
582
|
return body;
|
|
968
583
|
}
|
|
@@ -1106,7 +721,7 @@ var getTodayRecommend = async (pacmtoken) => {
|
|
|
1106
721
|
};
|
|
1107
722
|
|
|
1108
723
|
// src/modules/login_sim.ts
|
|
1109
|
-
var
|
|
724
|
+
var RSAKey3 = rsalib_default.RSAKey;
|
|
1110
725
|
function randomString2() {
|
|
1111
726
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
1112
727
|
return random.toLowerCase();
|
|
@@ -1129,17 +744,14 @@ var loginSim = {
|
|
|
1129
744
|
if (!modulus || !publicExponent) {
|
|
1130
745
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
1131
746
|
}
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
const encPhone =
|
|
747
|
+
const rsa = new RSAKey3();
|
|
748
|
+
rsa.setPublic(modulus, publicExponent);
|
|
749
|
+
const encPhone = rsa.encrypt(phone);
|
|
1135
750
|
const fakeFingerprint = randomString2();
|
|
1136
751
|
$.fingerPrint = fakeFingerprint;
|
|
1137
752
|
$.fingerPrintDetail = fakeFingerprint;
|
|
1138
|
-
$.encMsisdn = encPhone;
|
|
1139
|
-
const form =
|
|
1140
|
-
for (const [key, value] of Object.entries($)) {
|
|
1141
|
-
form.append(key, String(value));
|
|
1142
|
-
}
|
|
753
|
+
$.encMsisdn = encPhone || "";
|
|
754
|
+
const form = URLParams($);
|
|
1143
755
|
const send = await fetch(
|
|
1144
756
|
`https://passport.migu.cn/api/simauth/send`,
|
|
1145
757
|
{
|
|
@@ -1244,11 +856,203 @@ var getSimilarSongRecommend = async (contentId = "") => {
|
|
|
1244
856
|
);
|
|
1245
857
|
};
|
|
1246
858
|
|
|
859
|
+
// src/modules/login_oneclick.ts
|
|
860
|
+
import crypto2 from "crypto";
|
|
861
|
+
var nav = {
|
|
862
|
+
"platform": "iPhone",
|
|
863
|
+
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
|
|
864
|
+
"appVersion": "5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
|
|
865
|
+
"cookieEnabled": true,
|
|
866
|
+
"empty": null,
|
|
867
|
+
"hardwareConcurrency": 6,
|
|
868
|
+
"language": "zh-CN",
|
|
869
|
+
"plugins": "",
|
|
870
|
+
"availWidth": 390,
|
|
871
|
+
"availHeight": 844,
|
|
872
|
+
"colorDepth": 24,
|
|
873
|
+
"timezoneOffset": -480
|
|
874
|
+
};
|
|
875
|
+
var YDRZ = {
|
|
876
|
+
"optparams": {
|
|
877
|
+
"uuid": "",
|
|
878
|
+
"msgId": "",
|
|
879
|
+
"traceId": "",
|
|
880
|
+
"businessType": "10",
|
|
881
|
+
"appId": "",
|
|
882
|
+
"timestamp": yTime(),
|
|
883
|
+
"isimge": false,
|
|
884
|
+
"expandParams": "",
|
|
885
|
+
"userInformations": "",
|
|
886
|
+
"CMRequestApi": ""
|
|
887
|
+
},
|
|
888
|
+
randomString(len, range = 32) {
|
|
889
|
+
var i, bite = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), list = [];
|
|
890
|
+
for (i = 0; i < len; i++)
|
|
891
|
+
list[i] = bite[0 | Math.random() * range];
|
|
892
|
+
return list.join("");
|
|
893
|
+
},
|
|
894
|
+
randomRange(min, max) {
|
|
895
|
+
return Math.floor(Math.random() * (min - max) + max);
|
|
896
|
+
},
|
|
897
|
+
getUA() {
|
|
898
|
+
const ua = nav.userAgent, l = [
|
|
899
|
+
nav.platform,
|
|
900
|
+
ua,
|
|
901
|
+
nav.appVersion,
|
|
902
|
+
nav.cookieEnabled,
|
|
903
|
+
void 0,
|
|
904
|
+
nav.hardwareConcurrency,
|
|
905
|
+
nav.language,
|
|
906
|
+
nav.plugins,
|
|
907
|
+
nav.availWidth,
|
|
908
|
+
nav.availHeight,
|
|
909
|
+
nav.colorDepth,
|
|
910
|
+
nav.timezoneOffset
|
|
911
|
+
], key = l.join("@@"), finalUA = ua.length > 100 ? ua.substring(0, 100) : ua;
|
|
912
|
+
return nav.platform + "@@" + finalUA + "@@" + md5(key);
|
|
913
|
+
},
|
|
914
|
+
uaE(str) {
|
|
915
|
+
var b, c, d, r4, r1, r2, r3, result = "", bite = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", i = 0;
|
|
916
|
+
for (; i < str.length; )
|
|
917
|
+
r4 = (b = str.charCodeAt(i++)) >> 2, r1 = (3 & b) << 4 | (c = str.charCodeAt(i++)) >> 4, r2 = (15 & c) << 2 | (d = str.charCodeAt(i++)) >> 6, r3 = 63 & d, isNaN(c) ? r2 = r3 = 64 : isNaN(d) && (r3 = 64), result = result + bite.charAt(r4) + bite.charAt(r1) + bite.charAt(r2) + bite.charAt(r3);
|
|
918
|
+
return result;
|
|
919
|
+
},
|
|
920
|
+
getUserInfo() {
|
|
921
|
+
return encodeURIComponent(this.uaE(this.getUA()));
|
|
922
|
+
},
|
|
923
|
+
getSign(appID, version) {
|
|
924
|
+
const optparams = this.optparams;
|
|
925
|
+
optparams.uuid = this.randomString(32, 32);
|
|
926
|
+
optparams.msgId = this.randomString(32, 32);
|
|
927
|
+
this.optparams = optparams;
|
|
928
|
+
return appID + optparams.msgId + optparams.timestamp + optparams.uuid + version;
|
|
929
|
+
},
|
|
930
|
+
async getTokenInfo(data) {
|
|
931
|
+
const optparams = this.optparams;
|
|
932
|
+
const requestData = {
|
|
933
|
+
"version": data.version,
|
|
934
|
+
"appId": data.appId,
|
|
935
|
+
"openType": data.openType,
|
|
936
|
+
"expandParams": data.expandParams,
|
|
937
|
+
"isTest": data.isTest,
|
|
938
|
+
"sign": data.sign,
|
|
939
|
+
"getNetworkType": data.getNetworkType,
|
|
940
|
+
"getMsisdnMask": data.getMsisdnMask,
|
|
941
|
+
"traceId": optparams.uuid,
|
|
942
|
+
"msgId": optparams.msgId,
|
|
943
|
+
"timestamp": optparams.timestamp,
|
|
944
|
+
"uuid": optparams.uuid,
|
|
945
|
+
"businessType": optparams.businessType,
|
|
946
|
+
"userInformations": this.getUserInfo()
|
|
947
|
+
};
|
|
948
|
+
const res = await fetch(
|
|
949
|
+
"https://verify.cmpassport.com/h5/getPreMobile",
|
|
950
|
+
{
|
|
951
|
+
method: "POST",
|
|
952
|
+
headers: {
|
|
953
|
+
"Referer": "https://passport.migu.cn/",
|
|
954
|
+
"Origin": "https://passport.migu.cn"
|
|
955
|
+
},
|
|
956
|
+
body: JSON.stringify(requestData)
|
|
957
|
+
}
|
|
958
|
+
);
|
|
959
|
+
if (!res.ok) return;
|
|
960
|
+
const json = await res.json(), token = json.body?.token || "";
|
|
961
|
+
if (!token) return;
|
|
962
|
+
return token;
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
function yTime() {
|
|
966
|
+
const date = /* @__PURE__ */ new Date(), a = [
|
|
967
|
+
date.getFullYear(),
|
|
968
|
+
date.getMonth() + 1,
|
|
969
|
+
date.getDate(),
|
|
970
|
+
date.getHours(),
|
|
971
|
+
date.getMinutes(),
|
|
972
|
+
date.getSeconds(),
|
|
973
|
+
date.getMilliseconds()
|
|
974
|
+
];
|
|
975
|
+
const f = a.map((t) => {
|
|
976
|
+
return t.toString().padStart(2, "0");
|
|
977
|
+
});
|
|
978
|
+
f[6] = f[6].toString().padStart(3, "0");
|
|
979
|
+
return f.join("");
|
|
980
|
+
}
|
|
981
|
+
function md5(s) {
|
|
982
|
+
return crypto2.createHash("md5").update(s, "utf-8").digest("hex");
|
|
983
|
+
}
|
|
984
|
+
var genInternetSign = async () => {
|
|
985
|
+
const time = yTime(), e = time, c = "220029", msgId = getDeviceId(), d = msgId;
|
|
986
|
+
const preSign = YDRZ.getSign("300012033963", "1.2"), b = preSign;
|
|
987
|
+
let key = "interfacename=genInternetSign&sourceid=" + c + "&systemtime=" + e + "&msgid=" + d + "&preSign=" + b;
|
|
988
|
+
key = encodeURIComponent(key);
|
|
989
|
+
const signature = md5(key);
|
|
990
|
+
const url = `https://passport.migu.cn/api/genInternetSign?preSign=${preSign}&msgid=${msgId}&systemtime=${time}&sourceid=220029&signature=${signature}`;
|
|
991
|
+
const res = await fetch(url);
|
|
992
|
+
if (!res.ok) return void 0;
|
|
993
|
+
const data = await res.json();
|
|
994
|
+
if (!data || data.status !== 2e3) return void 0;
|
|
995
|
+
const rsaSign = data.result?.rsaSign || "";
|
|
996
|
+
return rsaSign;
|
|
997
|
+
};
|
|
998
|
+
var getSTToken = async (uniToken) => {
|
|
999
|
+
const $ = {
|
|
1000
|
+
"sourceID": "220029",
|
|
1001
|
+
"appType": 0,
|
|
1002
|
+
"relayState": "",
|
|
1003
|
+
"token": uniToken,
|
|
1004
|
+
"userInformation": YDRZ.getUserInfo(),
|
|
1005
|
+
"isFirst": 1
|
|
1006
|
+
};
|
|
1007
|
+
const form = URLParams($);
|
|
1008
|
+
const res = await fetch(
|
|
1009
|
+
"https://passport.migu.cn/authn/uniTokenValidate",
|
|
1010
|
+
{
|
|
1011
|
+
method: "POST",
|
|
1012
|
+
headers: {
|
|
1013
|
+
"content-type": "application/x-www-form-urlencoded; charset=UTF-8"
|
|
1014
|
+
},
|
|
1015
|
+
body: form
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
if (!res.ok) return { error: "fetch uni e" };
|
|
1019
|
+
const json = await res.json(), status = json.status?.toString() || "", token = json.result?.token || "", msisdn = json.result?.msisdn || "";
|
|
1020
|
+
if (status !== "2000") return { error: "status e" };
|
|
1021
|
+
return { token, msisdn, status };
|
|
1022
|
+
};
|
|
1023
|
+
var authn = async () => {
|
|
1024
|
+
const rsaSign = await genInternetSign();
|
|
1025
|
+
if (!rsaSign) return { error: "genInternetSign failed" };
|
|
1026
|
+
const uniToken = await YDRZ.getTokenInfo({
|
|
1027
|
+
version: "1.2",
|
|
1028
|
+
appId: "300012033963",
|
|
1029
|
+
sign: rsaSign,
|
|
1030
|
+
openType: "1",
|
|
1031
|
+
expandParams: "",
|
|
1032
|
+
isTest: false,
|
|
1033
|
+
getNetworkType: "",
|
|
1034
|
+
getMsisdnMask: ""
|
|
1035
|
+
});
|
|
1036
|
+
if (!uniToken) return { error: "getTokenInfo failed" };
|
|
1037
|
+
const result = await getSTToken(uniToken);
|
|
1038
|
+
if ("error" in result) return result;
|
|
1039
|
+
const { token, msisdn, status } = result;
|
|
1040
|
+
if (!token) return { error: "no token" };
|
|
1041
|
+
if (!msisdn) return { error: "no msisdn" };
|
|
1042
|
+
return { token, msisdn, status };
|
|
1043
|
+
};
|
|
1044
|
+
var loginOneClick = {
|
|
1045
|
+
genInternetSign,
|
|
1046
|
+
getSTToken,
|
|
1047
|
+
authn
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1247
1050
|
// src/index.ts
|
|
1248
1051
|
function createClient() {
|
|
1249
1052
|
return modules_exports;
|
|
1250
1053
|
}
|
|
1251
1054
|
export {
|
|
1055
|
+
YDRZ,
|
|
1252
1056
|
checkCanListen,
|
|
1253
1057
|
checkToken,
|
|
1254
1058
|
createClient,
|
|
@@ -1287,6 +1091,7 @@ export {
|
|
|
1287
1091
|
getUserMyList,
|
|
1288
1092
|
getVersion,
|
|
1289
1093
|
loginNP,
|
|
1094
|
+
loginOneClick,
|
|
1290
1095
|
loginSim,
|
|
1291
1096
|
modules_exports as modules,
|
|
1292
1097
|
queryUserInfo,
|