migu-api-enhanced 1.2.5 → 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 +51 -437
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +51 -437
- package/dist/index.js.map +1 -1
- package/package.json +64 -62
package/README.md
CHANGED
|
@@ -46,6 +46,10 @@ migu-api-enhanced/
|
|
|
46
46
|
└── package.json
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## API 接口
|
|
50
|
+
|
|
51
|
+
[API 文档](https://domdkw.github.io/miguMusic-api-enhanced/api/search.md)
|
|
52
|
+
|
|
49
53
|
## 快速开始
|
|
50
54
|
|
|
51
55
|
### 安装依赖
|
|
@@ -60,6 +64,9 @@ pnpm install
|
|
|
60
64
|
# Node.js 环境
|
|
61
65
|
pnpm run dev
|
|
62
66
|
|
|
67
|
+
# Bun 环境
|
|
68
|
+
pnpm run start:bun --watch
|
|
69
|
+
|
|
63
70
|
# Cloudflare Workers
|
|
64
71
|
pnpm run dev:cf
|
|
65
72
|
|
|
@@ -112,10 +119,6 @@ pnpm run deploy:deno
|
|
|
112
119
|
ALLOWED_ORIGINS=https://example.com pnpm start
|
|
113
120
|
```
|
|
114
121
|
|
|
115
|
-
## API 接口
|
|
116
|
-
|
|
117
|
-
[API 文档](https://domdkw.github.io/miguMusic-api-enhanced/api/search.md)
|
|
118
|
-
|
|
119
122
|
## TypeScript 配置
|
|
120
123
|
|
|
121
124
|
本项目使用 TypeScript 5.x,配置分为两部分:
|
|
@@ -154,7 +157,7 @@ npm install migu-api-enhanced
|
|
|
154
157
|
>[!NOTE]
|
|
155
158
|
> 建议使用最新版本。后续会更新接口。请加上```@latest```获取最新版本。(npm i migu-api-enhanced@latest)
|
|
156
159
|
|
|
157
|
-
###
|
|
160
|
+
### 方式一:命名导入
|
|
158
161
|
|
|
159
162
|
```ts
|
|
160
163
|
import { getAlbumInfo, getUrlV2 } from 'migu-api-enhanced';
|
package/dist/index.cjs
CHANGED
|
@@ -535,438 +535,52 @@ var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012",
|
|
|
535
535
|
);
|
|
536
536
|
};
|
|
537
537
|
|
|
538
|
-
// src/utils/rsalib.
|
|
538
|
+
// src/utils/rsalib.ts
|
|
539
539
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
for (let i = 0; i < arr.length; i++) {
|
|
561
|
-
arr[i] = bytes[i];
|
|
562
|
-
}
|
|
563
|
-
return arr;
|
|
564
|
-
},
|
|
565
|
-
random: function(len) {
|
|
566
|
-
const bytes = import_crypto.default.randomBytes(len);
|
|
567
|
-
return Array.from(bytes, (b) => String.fromCharCode(b)).join("");
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
define("lib/rsa/rsa", [], function(a, b, c) {
|
|
571
|
-
function d(a2, b2, c2) {
|
|
572
|
-
null != a2 && ("number" == typeof a2 ? this.fromNumber(a2, b2, c2) : null == b2 && "string" != typeof a2 ? this.fromString(a2, 256) : this.fromString(a2, b2));
|
|
573
|
-
}
|
|
574
|
-
function e() {
|
|
575
|
-
return new d(null);
|
|
576
|
-
}
|
|
577
|
-
function f(a2, b2, c2, d2, e2, f2) {
|
|
578
|
-
for (; --f2 >= 0; ) {
|
|
579
|
-
var g2 = b2 * this[a2++] + c2[d2] + e2;
|
|
580
|
-
e2 = Math.floor(g2 / 67108864), c2[d2++] = 67108863 & g2;
|
|
581
|
-
}
|
|
582
|
-
return e2;
|
|
583
|
-
}
|
|
584
|
-
function g(a2, b2, c2, d2, e2, f2) {
|
|
585
|
-
for (var g2 = 32767 & b2, h2 = b2 >> 15; --f2 >= 0; ) {
|
|
586
|
-
var i2 = 32767 & this[a2], j2 = this[a2++] >> 15, k2 = h2 * i2 + j2 * g2;
|
|
587
|
-
i2 = g2 * i2 + ((32767 & k2) << 15) + c2[d2] + (1073741823 & e2), e2 = (i2 >>> 30) + (k2 >>> 15) + h2 * j2 + (e2 >>> 30), c2[d2++] = 1073741823 & i2;
|
|
588
|
-
}
|
|
589
|
-
return e2;
|
|
590
|
-
}
|
|
591
|
-
function h(a2, b2, c2, d2, e2, f2) {
|
|
592
|
-
for (var g2 = 16383 & b2, h2 = b2 >> 14; --f2 >= 0; ) {
|
|
593
|
-
var i2 = 16383 & this[a2], j2 = this[a2++] >> 14, k2 = h2 * i2 + j2 * g2;
|
|
594
|
-
i2 = g2 * i2 + ((16383 & k2) << 14) + c2[d2] + e2, e2 = (i2 >> 28) + (k2 >> 14) + h2 * j2, c2[d2++] = 268435455 & i2;
|
|
595
|
-
}
|
|
596
|
-
return e2;
|
|
597
|
-
}
|
|
598
|
-
function i(a2) {
|
|
599
|
-
return nb.charAt(a2);
|
|
600
|
-
}
|
|
601
|
-
function j(a2, b2) {
|
|
602
|
-
var c2 = ob[a2.charCodeAt(b2)];
|
|
603
|
-
return null == c2 ? -1 : c2;
|
|
604
|
-
}
|
|
605
|
-
function k(a2) {
|
|
606
|
-
for (var b2 = this.t - 1; b2 >= 0; --b2)
|
|
607
|
-
a2[b2] = this[b2];
|
|
608
|
-
a2.t = this.t, a2.s = this.s;
|
|
609
|
-
}
|
|
610
|
-
function l(a2) {
|
|
611
|
-
this.t = 1, this.s = 0 > a2 ? -1 : 0, a2 > 0 ? this[0] = a2 : -1 > a2 ? this[0] = a2 + this.DV : this.t = 0;
|
|
612
|
-
}
|
|
613
|
-
function m(a2) {
|
|
614
|
-
var b2 = e();
|
|
615
|
-
return b2.fromInt(a2), b2;
|
|
616
|
-
}
|
|
617
|
-
function n(a2, b2) {
|
|
618
|
-
var c2;
|
|
619
|
-
if (16 == b2)
|
|
620
|
-
c2 = 4;
|
|
621
|
-
else if (8 == b2)
|
|
622
|
-
c2 = 3;
|
|
623
|
-
else if (256 == b2)
|
|
624
|
-
c2 = 8;
|
|
625
|
-
else if (2 == b2)
|
|
626
|
-
c2 = 1;
|
|
627
|
-
else if (32 == b2)
|
|
628
|
-
c2 = 5;
|
|
629
|
-
else {
|
|
630
|
-
if (4 != b2)
|
|
631
|
-
return void this.fromRadix(a2, b2);
|
|
632
|
-
c2 = 2;
|
|
633
|
-
}
|
|
634
|
-
this.t = 0, this.s = 0;
|
|
635
|
-
for (var e2 = a2.length, f2 = false, g2 = 0; --e2 >= 0; ) {
|
|
636
|
-
var h2 = 8 == c2 ? 255 & a2[e2] : j(a2, e2);
|
|
637
|
-
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));
|
|
638
|
-
}
|
|
639
|
-
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);
|
|
640
|
-
}
|
|
641
|
-
function o() {
|
|
642
|
-
for (var a2 = this.s & this.DM; this.t > 0 && this[this.t - 1] == a2; )
|
|
643
|
-
--this.t;
|
|
644
|
-
}
|
|
645
|
-
function p(a2) {
|
|
646
|
-
if (this.s < 0)
|
|
647
|
-
return "-" + this.negate().toString(a2);
|
|
648
|
-
var b2;
|
|
649
|
-
if (16 == a2)
|
|
650
|
-
b2 = 4;
|
|
651
|
-
else if (8 == a2)
|
|
652
|
-
b2 = 3;
|
|
653
|
-
else if (2 == a2)
|
|
654
|
-
b2 = 1;
|
|
655
|
-
else if (32 == a2)
|
|
656
|
-
b2 = 5;
|
|
657
|
-
else {
|
|
658
|
-
if (4 != a2)
|
|
659
|
-
return this.toRadix(a2);
|
|
660
|
-
b2 = 2;
|
|
661
|
-
}
|
|
662
|
-
var c2, d2 = (1 << b2) - 1, e2 = false, f2 = "", g2 = this.t, h2 = this.DB - g2 * this.DB % b2;
|
|
663
|
-
if (g2-- > 0)
|
|
664
|
-
for (h2 < this.DB && (c2 = this[g2] >> h2) > 0 && (e2 = true, f2 = i(c2)); g2 >= 0; )
|
|
665
|
-
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));
|
|
666
|
-
return e2 ? f2 : "0";
|
|
667
|
-
}
|
|
668
|
-
function q() {
|
|
669
|
-
var a2 = e();
|
|
670
|
-
return d.ZERO.subTo(this, a2), a2;
|
|
671
|
-
}
|
|
672
|
-
function r() {
|
|
673
|
-
return this.s < 0 ? this.negate() : this;
|
|
674
|
-
}
|
|
675
|
-
function s(a2) {
|
|
676
|
-
var b2 = this.s - a2.s;
|
|
677
|
-
if (0 != b2)
|
|
678
|
-
return b2;
|
|
679
|
-
var c2 = this.t;
|
|
680
|
-
if (b2 = c2 - a2.t, 0 != b2)
|
|
681
|
-
return this.s < 0 ? -b2 : b2;
|
|
682
|
-
for (; --c2 >= 0; )
|
|
683
|
-
if (0 != (b2 = this[c2] - a2[c2]))
|
|
684
|
-
return b2;
|
|
685
|
-
return 0;
|
|
686
|
-
}
|
|
687
|
-
function t(a2) {
|
|
688
|
-
var b2, c2 = 1;
|
|
689
|
-
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;
|
|
690
|
-
}
|
|
691
|
-
function u() {
|
|
692
|
-
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + t(this[this.t - 1] ^ this.s & this.DM);
|
|
693
|
-
}
|
|
694
|
-
function v(a2, b2) {
|
|
695
|
-
var c2;
|
|
696
|
-
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
697
|
-
b2[c2 + a2] = this[c2];
|
|
698
|
-
for (c2 = a2 - 1; c2 >= 0; --c2)
|
|
699
|
-
b2[c2] = 0;
|
|
700
|
-
b2.t = this.t + a2, b2.s = this.s;
|
|
701
|
-
}
|
|
702
|
-
function w(a2, b2) {
|
|
703
|
-
for (var c2 = a2; c2 < this.t; ++c2)
|
|
704
|
-
b2[c2 - a2] = this[c2];
|
|
705
|
-
b2.t = Math.max(this.t - a2, 0), b2.s = this.s;
|
|
706
|
-
}
|
|
707
|
-
function x(a2, b2) {
|
|
708
|
-
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;
|
|
709
|
-
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
710
|
-
b2[c2 + g2 + 1] = this[c2] >> e2 | h2, h2 = (this[c2] & f2) << d2;
|
|
711
|
-
for (c2 = g2 - 1; c2 >= 0; --c2)
|
|
712
|
-
b2[c2] = 0;
|
|
713
|
-
b2[g2] = h2, b2.t = this.t + g2 + 1, b2.s = this.s, b2.clamp();
|
|
714
|
-
}
|
|
715
|
-
function y(a2, b2) {
|
|
716
|
-
b2.s = this.s;
|
|
717
|
-
var c2 = Math.floor(a2 / this.DB);
|
|
718
|
-
if (c2 >= this.t)
|
|
719
|
-
return void (b2.t = 0);
|
|
720
|
-
var d2 = a2 % this.DB, e2 = this.DB - d2, f2 = (1 << d2) - 1;
|
|
721
|
-
b2[0] = this[c2] >> d2;
|
|
722
|
-
for (var g2 = c2 + 1; g2 < this.t; ++g2)
|
|
723
|
-
b2[g2 - c2 - 1] |= (this[g2] & f2) << e2, b2[g2 - c2] = this[g2] >> d2;
|
|
724
|
-
d2 > 0 && (b2[this.t - c2 - 1] |= (this.s & f2) << e2), b2.t = this.t - c2, b2.clamp();
|
|
725
|
-
}
|
|
726
|
-
function z(a2, b2) {
|
|
727
|
-
for (var c2 = 0, d2 = 0, e2 = Math.min(a2.t, this.t); e2 > c2; )
|
|
728
|
-
d2 += this[c2] - a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
729
|
-
if (a2.t < this.t) {
|
|
730
|
-
for (d2 -= a2.s; c2 < this.t; )
|
|
731
|
-
d2 += this[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
732
|
-
d2 += this.s;
|
|
733
|
-
} else {
|
|
734
|
-
for (d2 += this.s; c2 < a2.t; )
|
|
735
|
-
d2 -= a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
736
|
-
d2 -= a2.s;
|
|
737
|
-
}
|
|
738
|
-
b2.s = 0 > d2 ? -1 : 0, -1 > d2 ? b2[c2++] = this.DV + d2 : d2 > 0 && (b2[c2++] = d2), b2.t = c2, b2.clamp();
|
|
739
|
-
}
|
|
740
|
-
function A(a2, b2) {
|
|
741
|
-
var c2 = this.abs(), e2 = a2.abs(), f2 = c2.t;
|
|
742
|
-
for (b2.t = f2 + e2.t; --f2 >= 0; )
|
|
743
|
-
b2[f2] = 0;
|
|
744
|
-
for (f2 = 0; f2 < e2.t; ++f2)
|
|
745
|
-
b2[f2 + c2.t] = c2.am(0, e2[f2], b2, f2, 0, c2.t);
|
|
746
|
-
b2.s = 0, b2.clamp(), this.s != a2.s && d.ZERO.subTo(b2, b2);
|
|
747
|
-
}
|
|
748
|
-
function B(a2) {
|
|
749
|
-
for (var b2 = this.abs(), c2 = a2.t = 2 * b2.t; --c2 >= 0; )
|
|
750
|
-
a2[c2] = 0;
|
|
751
|
-
for (c2 = 0; c2 < b2.t - 1; ++c2) {
|
|
752
|
-
var d2 = b2.am(c2, b2[c2], a2, 2 * c2, 0, 1);
|
|
753
|
-
(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);
|
|
754
|
-
}
|
|
755
|
-
a2.t > 0 && (a2[a2.t - 1] += b2.am(c2, b2[c2], a2, 2 * c2, 0, 1)), a2.s = 0, a2.clamp();
|
|
756
|
-
}
|
|
757
|
-
function C(a2, b2, c2) {
|
|
758
|
-
var f2 = a2.abs();
|
|
759
|
-
if (!(f2.t <= 0)) {
|
|
760
|
-
var g2 = this.abs();
|
|
761
|
-
if (g2.t < f2.t)
|
|
762
|
-
return null != b2 && b2.fromInt(0), void (null != c2 && this.copyTo(c2));
|
|
763
|
-
null == c2 && (c2 = e());
|
|
764
|
-
var h2 = e(), i2 = this.s, j2 = a2.s, k2 = this.DB - t(f2[f2.t - 1]);
|
|
765
|
-
k2 > 0 ? (f2.lShiftTo(k2, h2), g2.lShiftTo(k2, c2)) : (f2.copyTo(h2), g2.copyTo(c2));
|
|
766
|
-
var l2 = h2.t, m2 = h2[l2 - 1];
|
|
767
|
-
if (0 != m2) {
|
|
768
|
-
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;
|
|
769
|
-
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; )
|
|
770
|
-
h2[h2.t++] = 0;
|
|
771
|
-
for (; --s2 >= 0; ) {
|
|
772
|
-
var v2 = c2[--r2] == m2 ? this.DM : Math.floor(c2[r2] * o2 + (c2[r2 - 1] + q2) * p2);
|
|
773
|
-
if ((c2[r2] += h2.am(0, v2, c2, s2, 0, l2)) < v2)
|
|
774
|
-
for (h2.dlShiftTo(s2, u2), c2.subTo(u2, c2); c2[r2] < --v2; )
|
|
775
|
-
c2.subTo(u2, c2);
|
|
776
|
-
}
|
|
777
|
-
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);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
function D(a2) {
|
|
782
|
-
var b2 = e();
|
|
783
|
-
return this.abs().divRemTo(a2, null, b2), this.s < 0 && b2.compareTo(d.ZERO) > 0 && a2.subTo(b2, b2), b2;
|
|
784
|
-
}
|
|
785
|
-
function E(a2) {
|
|
786
|
-
this.m = a2;
|
|
787
|
-
}
|
|
788
|
-
function F(a2) {
|
|
789
|
-
return a2.s < 0 || a2.compareTo(this.m) >= 0 ? a2.mod(this.m) : a2;
|
|
790
|
-
}
|
|
791
|
-
function G(a2) {
|
|
792
|
-
return a2;
|
|
793
|
-
}
|
|
794
|
-
function H(a2) {
|
|
795
|
-
a2.divRemTo(this.m, null, a2);
|
|
796
|
-
}
|
|
797
|
-
function I(a2, b2, c2) {
|
|
798
|
-
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
799
|
-
}
|
|
800
|
-
function J(a2, b2) {
|
|
801
|
-
a2.squareTo(b2), this.reduce(b2);
|
|
802
|
-
}
|
|
803
|
-
function K() {
|
|
804
|
-
if (this.t < 1)
|
|
805
|
-
return 0;
|
|
806
|
-
var a2 = this[0];
|
|
807
|
-
if (0 == (1 & a2))
|
|
808
|
-
return 0;
|
|
809
|
-
var b2 = 3 & a2;
|
|
810
|
-
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;
|
|
811
|
-
}
|
|
812
|
-
function L(a2) {
|
|
813
|
-
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;
|
|
814
|
-
}
|
|
815
|
-
function M(a2) {
|
|
816
|
-
var b2 = e();
|
|
817
|
-
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;
|
|
818
|
-
}
|
|
819
|
-
function N(a2) {
|
|
820
|
-
var b2 = e();
|
|
821
|
-
return a2.copyTo(b2), this.reduce(b2), b2;
|
|
822
|
-
}
|
|
823
|
-
function O(a2) {
|
|
824
|
-
for (; a2.t <= this.mt2; )
|
|
825
|
-
a2[a2.t++] = 0;
|
|
826
|
-
for (var b2 = 0; b2 < this.m.t; ++b2) {
|
|
827
|
-
var c2 = 32767 & a2[b2], d2 = c2 * this.mpl + ((c2 * this.mph + (a2[b2] >> 15) * this.mpl & this.um) << 15) & a2.DM;
|
|
828
|
-
for (c2 = b2 + this.m.t, a2[c2] += this.m.am(0, d2, a2, b2, 0, this.m.t); a2[c2] >= a2.DV; )
|
|
829
|
-
a2[c2] -= a2.DV, a2[++c2]++;
|
|
830
|
-
}
|
|
831
|
-
a2.clamp(), a2.drShiftTo(this.m.t, a2), a2.compareTo(this.m) >= 0 && a2.subTo(this.m, a2);
|
|
832
|
-
}
|
|
833
|
-
function P(a2, b2) {
|
|
834
|
-
a2.squareTo(b2), this.reduce(b2);
|
|
835
|
-
}
|
|
836
|
-
function Q(a2, b2, c2) {
|
|
837
|
-
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
838
|
-
}
|
|
839
|
-
function R() {
|
|
840
|
-
return 0 == (this.t > 0 ? 1 & this[0] : this.s);
|
|
841
|
-
}
|
|
842
|
-
function S(a2, b2) {
|
|
843
|
-
if (a2 > 4294967295 || 1 > a2)
|
|
844
|
-
return d.ONE;
|
|
845
|
-
var c2 = e(), f2 = e(), g2 = b2.convert(this), h2 = t(a2) - 1;
|
|
846
|
-
for (g2.copyTo(c2); --h2 >= 0; )
|
|
847
|
-
if (b2.sqrTo(c2, f2), (a2 & 1 << h2) > 0)
|
|
848
|
-
b2.mulTo(f2, g2, c2);
|
|
849
|
-
else {
|
|
850
|
-
var i2 = c2;
|
|
851
|
-
c2 = f2, f2 = i2;
|
|
852
|
-
}
|
|
853
|
-
return b2.revert(c2);
|
|
854
|
-
}
|
|
855
|
-
function T(a2, b2) {
|
|
856
|
-
var c2;
|
|
857
|
-
return c2 = 256 > a2 || b2.isEven() ? new E(b2) : new L(b2), this.exp(a2, c2);
|
|
858
|
-
}
|
|
859
|
-
function U() {
|
|
860
|
-
this.i = 0, this.j = 0, this.S = new Array();
|
|
861
|
-
}
|
|
862
|
-
function V(a2) {
|
|
863
|
-
var b2, c2, d2;
|
|
864
|
-
for (b2 = 0; 256 > b2; ++b2)
|
|
865
|
-
this.S[b2] = b2;
|
|
866
|
-
for (c2 = 0, b2 = 0; 256 > b2; ++b2)
|
|
867
|
-
c2 = c2 + this.S[b2] + a2[b2 % a2.length] & 255, d2 = this.S[b2], this.S[b2] = this.S[c2], this.S[c2] = d2;
|
|
868
|
-
this.i = 0, this.j = 0;
|
|
869
|
-
}
|
|
870
|
-
function W() {
|
|
871
|
-
var a2;
|
|
872
|
-
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];
|
|
873
|
-
}
|
|
874
|
-
function X() {
|
|
875
|
-
return new U();
|
|
876
|
-
}
|
|
877
|
-
function Y(a2) {
|
|
878
|
-
qb[rb++] ^= 255 & a2, qb[rb++] ^= a2 >> 8 & 255, qb[rb++] ^= a2 >> 16 & 255, qb[rb++] ^= a2 >> 24 & 255, rb >= sb && (rb -= sb);
|
|
879
|
-
}
|
|
880
|
-
function Z() {
|
|
881
|
-
Y((/* @__PURE__ */ new Date()).getTime());
|
|
882
|
-
}
|
|
883
|
-
function $() {
|
|
884
|
-
if (null == pb) {
|
|
885
|
-
for (Z(), pb = X(), pb.init(qb), rb = 0; rb < qb.length; ++rb)
|
|
886
|
-
qb[rb] = 0;
|
|
887
|
-
rb = 0;
|
|
888
|
-
}
|
|
889
|
-
return pb.next();
|
|
890
|
-
}
|
|
891
|
-
function _(a2) {
|
|
892
|
-
var b2;
|
|
893
|
-
for (b2 = 0; b2 < a2.length; ++b2)
|
|
894
|
-
a2[b2] = $();
|
|
895
|
-
}
|
|
896
|
-
function ab() {
|
|
897
|
-
}
|
|
898
|
-
function bb(a2, b2) {
|
|
899
|
-
return new d(a2, b2);
|
|
900
|
-
}
|
|
901
|
-
function cb(a2, b2) {
|
|
902
|
-
if (b2 < a2.length + 11)
|
|
903
|
-
return console.error("Message too long for RSA"), null;
|
|
904
|
-
for (var c2 = new Array(), e2 = a2.length - 1; e2 >= 0 && b2 > 0; ) {
|
|
905
|
-
var f2 = a2.charCodeAt(e2--);
|
|
906
|
-
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);
|
|
907
|
-
}
|
|
908
|
-
c2[--b2] = 0;
|
|
909
|
-
for (var g2 = new ab(), h2 = new Array(); b2 > 2; ) {
|
|
910
|
-
for (h2[0] = 0; 0 == h2[0]; )
|
|
911
|
-
g2.nextBytes(h2);
|
|
912
|
-
c2[--b2] = h2[0];
|
|
540
|
+
function hexToBase64Url(hex) {
|
|
541
|
+
const buffer = Buffer.from(hex, "hex");
|
|
542
|
+
return buffer.toString("base64url");
|
|
543
|
+
}
|
|
544
|
+
var RSAKey = class {
|
|
545
|
+
publicKey = null;
|
|
546
|
+
setPublic(modulus, exponent) {
|
|
547
|
+
try {
|
|
548
|
+
const jwkKey = {
|
|
549
|
+
kty: "RSA",
|
|
550
|
+
n: hexToBase64Url(modulus),
|
|
551
|
+
e: hexToBase64Url(exponent)
|
|
552
|
+
};
|
|
553
|
+
this.publicKey = import_crypto.default.createPublicKey({
|
|
554
|
+
key: jwkKey,
|
|
555
|
+
format: "jwk"
|
|
556
|
+
});
|
|
557
|
+
} catch (error) {
|
|
558
|
+
console.error("Failed to create public key:", error);
|
|
559
|
+
this.publicKey = null;
|
|
913
560
|
}
|
|
914
|
-
return c2[--b2] = 2, c2[--b2] = 0, new d(c2);
|
|
915
|
-
}
|
|
916
|
-
function db() {
|
|
917
|
-
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
918
|
-
}
|
|
919
|
-
function eb(a2, b2) {
|
|
920
|
-
null != a2 && null != b2 && a2.length > 0 && b2.length > 0 ? (this.n = bb(a2, 16), this.e = parseInt(b2, 16)) : console.error("net error");
|
|
921
561
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
function gb(a2) {
|
|
926
|
-
var b2 = cb(a2, this.n.bitLength() + 7 >> 3);
|
|
927
|
-
if (null == b2)
|
|
928
|
-
return null;
|
|
929
|
-
var c2 = this.doPublic(b2);
|
|
930
|
-
if (null == c2)
|
|
562
|
+
encrypt(text) {
|
|
563
|
+
if (!this.publicKey) {
|
|
564
|
+
console.error("Public key not set");
|
|
931
565
|
return null;
|
|
932
|
-
var d2 = c2.toString(16);
|
|
933
|
-
return 0 == (1 & d2.length) ? d2 : "0" + d2;
|
|
934
|
-
}
|
|
935
|
-
var hb, ib = 244837814094590, jb = 15715070 == (16777215 & ib);
|
|
936
|
-
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;
|
|
937
|
-
var kb = 52;
|
|
938
|
-
d.prototype.FV = Math.pow(2, kb), d.prototype.F1 = kb - hb, d.prototype.F2 = 2 * hb - kb;
|
|
939
|
-
var lb, mb, nb = "0123456789abcdefghijklmnopqrstuvwxyz", ob = new Array();
|
|
940
|
-
for (lb = "0".charCodeAt(0), mb = 0; 9 >= mb; ++mb)
|
|
941
|
-
ob[lb++] = mb;
|
|
942
|
-
for (lb = "a".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
943
|
-
ob[lb++] = mb;
|
|
944
|
-
for (lb = "A".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
945
|
-
ob[lb++] = mb;
|
|
946
|
-
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;
|
|
947
|
-
var pb, qb, rb, sb = 256;
|
|
948
|
-
if (null == qb) {
|
|
949
|
-
qb = new Array(), rb = 0;
|
|
950
|
-
var tb;
|
|
951
|
-
if (window.crypto && window.crypto.getRandomValues) {
|
|
952
|
-
var ub = new Uint8Array(32);
|
|
953
|
-
for (window.crypto.getRandomValues(ub), tb = 0; 32 > tb; ++tb)
|
|
954
|
-
qb[rb++] = ub[tb];
|
|
955
566
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
567
|
+
try {
|
|
568
|
+
const buffer = Buffer.from(text, "utf-8");
|
|
569
|
+
const encrypted = import_crypto.default.publicEncrypt(
|
|
570
|
+
{
|
|
571
|
+
key: this.publicKey,
|
|
572
|
+
padding: import_crypto.default.constants.RSA_PKCS1_PADDING
|
|
573
|
+
},
|
|
574
|
+
buffer
|
|
575
|
+
);
|
|
576
|
+
return encrypted.toString("hex");
|
|
577
|
+
} catch (error) {
|
|
578
|
+
console.error("RSA encryption failed:", error);
|
|
579
|
+
return null;
|
|
960
580
|
}
|
|
961
|
-
for (; sb > rb; )
|
|
962
|
-
tb = Math.floor(65536 * Math.random()), qb[rb++] = tb >>> 8, qb[rb++] = 255 & tb;
|
|
963
|
-
rb = 0, Z();
|
|
964
581
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
};
|
|
968
|
-
});
|
|
969
|
-
var rsalib_default = rsa;
|
|
582
|
+
};
|
|
583
|
+
var rsalib_default = { RSAKey };
|
|
970
584
|
|
|
971
585
|
// src/utils/publicKey.ts
|
|
972
586
|
var getPublicKey = async () => {
|
|
@@ -993,7 +607,7 @@ function URLParams($) {
|
|
|
993
607
|
}
|
|
994
608
|
|
|
995
609
|
// src/modules/login_np.ts
|
|
996
|
-
var
|
|
610
|
+
var RSAKey2 = rsalib_default.RSAKey;
|
|
997
611
|
function randomString() {
|
|
998
612
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
999
613
|
return random.toLowerCase();
|
|
@@ -1023,15 +637,15 @@ var loginNP = {
|
|
|
1023
637
|
if (!modulus || !publicExponent) {
|
|
1024
638
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
1025
639
|
}
|
|
1026
|
-
var
|
|
1027
|
-
|
|
1028
|
-
const rsa_pwd =
|
|
1029
|
-
const rsa_username =
|
|
640
|
+
var rsa = new RSAKey2();
|
|
641
|
+
rsa.setPublic(modulus, publicExponent);
|
|
642
|
+
const rsa_pwd = rsa.encrypt(password);
|
|
643
|
+
const rsa_username = rsa.encrypt(username);
|
|
1030
644
|
const fakeFingerprint = randomString();
|
|
1031
645
|
$.fingerPrint = fakeFingerprint;
|
|
1032
646
|
$.fingerPrintDetail = fakeFingerprint;
|
|
1033
|
-
$.enpassword = rsa_pwd;
|
|
1034
|
-
$.loginID = rsa_username;
|
|
647
|
+
$.enpassword = rsa_pwd || "";
|
|
648
|
+
$.loginID = rsa_username || "";
|
|
1035
649
|
const form = URLParams($);
|
|
1036
650
|
const res = await fetch(
|
|
1037
651
|
`https://passport.migu.cn/authn`,
|
|
@@ -1187,7 +801,7 @@ var getTodayRecommend = async (pacmtoken) => {
|
|
|
1187
801
|
};
|
|
1188
802
|
|
|
1189
803
|
// src/modules/login_sim.ts
|
|
1190
|
-
var
|
|
804
|
+
var RSAKey3 = rsalib_default.RSAKey;
|
|
1191
805
|
function randomString2() {
|
|
1192
806
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
1193
807
|
return random.toLowerCase();
|
|
@@ -1210,13 +824,13 @@ var loginSim = {
|
|
|
1210
824
|
if (!modulus || !publicExponent) {
|
|
1211
825
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
1212
826
|
}
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
const encPhone =
|
|
827
|
+
const rsa = new RSAKey3();
|
|
828
|
+
rsa.setPublic(modulus, publicExponent);
|
|
829
|
+
const encPhone = rsa.encrypt(phone);
|
|
1216
830
|
const fakeFingerprint = randomString2();
|
|
1217
831
|
$.fingerPrint = fakeFingerprint;
|
|
1218
832
|
$.fingerPrintDetail = fakeFingerprint;
|
|
1219
|
-
$.encMsisdn = encPhone;
|
|
833
|
+
$.encMsisdn = encPhone || "";
|
|
1220
834
|
const form = URLParams($);
|
|
1221
835
|
const send = await fetch(
|
|
1222
836
|
`https://passport.migu.cn/api/simauth/send`,
|