Spaces:
Running
Running
记住已查到的频道,避免触发限制
Browse files
server.js
CHANGED
|
@@ -45727,7 +45727,7 @@ var require_inspect = __commonJS({
|
|
| 45727 |
var require_BigInteger = __commonJS({
|
| 45728 |
"node_modules/big-integer/BigInteger.js"(exports2, module2) {
|
| 45729 |
init_define_import_meta_env();
|
| 45730 |
-
var
|
| 45731 |
"use strict";
|
| 45732 |
var BASE2 = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
|
| 45733 |
var supportsNativeBigInt = typeof BigInt === "function";
|
|
@@ -46471,7 +46471,7 @@ var require_BigInteger = __commonJS({
|
|
| 46471 |
while (b.isEven()) b = b.divide(2), r++;
|
| 46472 |
next: for (i2 = 0; i2 < a.length; i2++) {
|
| 46473 |
if (n.lesser(a[i2])) continue;
|
| 46474 |
-
x =
|
| 46475 |
if (x.isUnit() || x.equals(nPrev)) continue;
|
| 46476 |
for (d = r - 1; d != 0; d--) {
|
| 46477 |
x = x.square().mod(n);
|
|
@@ -46492,7 +46492,7 @@ var require_BigInteger = __commonJS({
|
|
| 46492 |
var logN = Math.log(2) * bits.toJSNumber();
|
| 46493 |
var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
|
| 46494 |
for (var a = [], i2 = 0; i2 < t; i2++) {
|
| 46495 |
-
a.push(
|
| 46496 |
}
|
| 46497 |
return millerRabinTest(n, a);
|
| 46498 |
};
|
|
@@ -46503,13 +46503,13 @@ var require_BigInteger = __commonJS({
|
|
| 46503 |
var n = this.abs();
|
| 46504 |
var t = iterations === undefined2 ? 5 : iterations;
|
| 46505 |
for (var a = [], i2 = 0; i2 < t; i2++) {
|
| 46506 |
-
a.push(
|
| 46507 |
}
|
| 46508 |
return millerRabinTest(n, a);
|
| 46509 |
};
|
| 46510 |
NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
|
| 46511 |
BigInteger.prototype.modInv = function(n) {
|
| 46512 |
-
var t =
|
| 46513 |
while (!newR.isZero()) {
|
| 46514 |
q = r.divide(newR);
|
| 46515 |
lastT = t;
|
|
@@ -46620,9 +46620,9 @@ var require_BigInteger = __commonJS({
|
|
| 46620 |
yRem = yDivMod[0];
|
| 46621 |
result.push(fn(xDigit, yDigit));
|
| 46622 |
}
|
| 46623 |
-
var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ?
|
| 46624 |
for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
|
| 46625 |
-
sum = sum.multiply(highestPower2).add(
|
| 46626 |
}
|
| 46627 |
return sum;
|
| 46628 |
}
|
|
@@ -46661,17 +46661,17 @@ var require_BigInteger = __commonJS({
|
|
| 46661 |
var t = p.multiply(base);
|
| 46662 |
return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 };
|
| 46663 |
}
|
| 46664 |
-
return { p:
|
| 46665 |
}
|
| 46666 |
BigInteger.prototype.bitLength = function() {
|
| 46667 |
var n = this;
|
| 46668 |
-
if (n.compareTo(
|
| 46669 |
-
n = n.negate().subtract(
|
| 46670 |
}
|
| 46671 |
-
if (n.compareTo(
|
| 46672 |
-
return
|
| 46673 |
}
|
| 46674 |
-
return
|
| 46675 |
};
|
| 46676 |
NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
|
| 46677 |
function max(a, b) {
|
|
@@ -46791,7 +46791,7 @@ var require_BigInteger = __commonJS({
|
|
| 46791 |
return "<" + digit + ">";
|
| 46792 |
}
|
| 46793 |
function toBase(n, base) {
|
| 46794 |
-
base =
|
| 46795 |
if (base.isZero()) {
|
| 46796 |
if (n.isZero()) return { value: [0], isNegative: false };
|
| 46797 |
throw new Error("Cannot convert nonzero numbers to base 0.");
|
|
@@ -46970,11 +46970,11 @@ var require_BigInteger = __commonJS({
|
|
| 46970 |
return Integer;
|
| 46971 |
})();
|
| 46972 |
if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) {
|
| 46973 |
-
module2.exports =
|
| 46974 |
}
|
| 46975 |
if (typeof define === "function" && define.amd) {
|
| 46976 |
define(function() {
|
| 46977 |
-
return
|
| 46978 |
});
|
| 46979 |
}
|
| 46980 |
}
|
|
@@ -49798,7 +49798,7 @@ var require_api = __commonJS({
|
|
| 49798 |
"use strict";
|
| 49799 |
init_define_import_meta_env();
|
| 49800 |
var { inspect } = require_inspect();
|
| 49801 |
-
var
|
| 49802 |
var { generateRandomBytes, readBigIntFromBuffer, isArrayLike, betterConsoleLog } = require_Helpers();
|
| 49803 |
var tlContent = require_apiTl();
|
| 49804 |
var schemeContent = require_schemaTl();
|
|
@@ -49983,7 +49983,7 @@ var require_api = __commonJS({
|
|
| 49983 |
correct = typeof value === type;
|
| 49984 |
break;
|
| 49985 |
case "bigInt":
|
| 49986 |
-
correct =
|
| 49987 |
break;
|
| 49988 |
case "true":
|
| 49989 |
break;
|
|
@@ -68883,11 +68883,11 @@ var require_ipv4 = __commonJS({
|
|
| 68883 |
* @param {bigint} bigInt - a BigInt to convert
|
| 68884 |
* @returns {Address4}
|
| 68885 |
*/
|
| 68886 |
-
static fromBigInt(
|
| 68887 |
-
if (
|
| 68888 |
throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");
|
| 68889 |
}
|
| 68890 |
-
return _Address4.fromHex(
|
| 68891 |
}
|
| 68892 |
/**
|
| 68893 |
* Convert a byte array to an Address4 object. Throws `AddressError` unless
|
|
@@ -69461,11 +69461,11 @@ var require_ipv6 = __commonJS({
|
|
| 69461 |
* var address = Address6.fromBigInt(bigInt);
|
| 69462 |
* address.correctForm(); // '::e8:d4a5:1000'
|
| 69463 |
*/
|
| 69464 |
-
static fromBigInt(
|
| 69465 |
-
if (
|
| 69466 |
throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");
|
| 69467 |
}
|
| 69468 |
-
const hex =
|
| 69469 |
const groups = [];
|
| 69470 |
for (let i = 0; i < constants6.GROUPS; i++) {
|
| 69471 |
groups.push(hex.slice(i * 4, (i + 1) * 4));
|
|
@@ -83442,6 +83442,7 @@ var import_telegram2 = __toESM(require_telegram());
|
|
| 83442 |
// tgaccount.ts
|
| 83443 |
init_define_import_meta_env();
|
| 83444 |
var import_crypto = __toESM(require("crypto"));
|
|
|
|
| 83445 |
var import_telegram = __toESM(require_telegram());
|
| 83446 |
var import_sessions = __toESM(require_sessions());
|
| 83447 |
var FILE = "telegram-account.json";
|
|
@@ -83505,6 +83506,37 @@ function describeMe(me) {
|
|
| 83505 |
}
|
| 83506 |
var maskPhone = (p) => p.length > 6 ? `${p.slice(0, 3)}****${p.slice(-3)}` : p;
|
| 83507 |
var entities = /* @__PURE__ */ new Map();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83508 |
var nextCall = 0;
|
| 83509 |
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
| 83510 |
async function throttle() {
|
|
@@ -83537,12 +83569,7 @@ async function fetchViaAccount(channel, before) {
|
|
| 83537 |
if (!c) throw new Error("Telegram \u8D26\u53F7\u672A\u767B\u5F55");
|
| 83538 |
try {
|
| 83539 |
const key = channel.toLowerCase();
|
| 83540 |
-
|
| 83541 |
-
if (!peer) {
|
| 83542 |
-
await throttle();
|
| 83543 |
-
peer = await c.getInputEntity(channel);
|
| 83544 |
-
entities.set(key, peer);
|
| 83545 |
-
}
|
| 83546 |
let title = channel;
|
| 83547 |
let description = "";
|
| 83548 |
let avatar = "";
|
|
@@ -83606,6 +83633,9 @@ async function activate(c, s) {
|
|
| 83606 |
saved = s;
|
| 83607 |
lastError = null;
|
| 83608 |
entities.clear();
|
|
|
|
|
|
|
|
|
|
| 83609 |
setAccountFetcher(fetchViaAccount);
|
| 83610 |
}
|
| 83611 |
async function initAccount(secret) {
|
|
@@ -83899,8 +83929,9 @@ async function viaWeb(c) {
|
|
| 83899 |
async function viaAccount(c) {
|
| 83900 |
const cl = getClient();
|
| 83901 |
if (!cl) throw new Error("\u9700\u8981\u767B\u5F55 Telegram \u8D26\u53F7");
|
| 83902 |
-
await sleep3(
|
| 83903 |
-
const
|
|
|
|
| 83904 |
if (ent instanceof import_telegram2.Api.User) throw new Error("\u8FD9\u662F\u4E2A\u4EBA\u8D26\u53F7\u6216\u673A\u5668\u4EBA");
|
| 83905 |
const msgs = await throttled(() => cl.getMessages(ent, { limit: 80 }));
|
| 83906 |
const texts = msgs.filter((m) => m instanceof import_telegram2.Api.Message && !!m.message?.trim()).slice(0, 30).map((m) => m.message);
|
|
|
|
| 45727 |
var require_BigInteger = __commonJS({
|
| 45728 |
"node_modules/big-integer/BigInteger.js"(exports2, module2) {
|
| 45729 |
init_define_import_meta_env();
|
| 45730 |
+
var bigInt2 = (function(undefined2) {
|
| 45731 |
"use strict";
|
| 45732 |
var BASE2 = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
|
| 45733 |
var supportsNativeBigInt = typeof BigInt === "function";
|
|
|
|
| 46471 |
while (b.isEven()) b = b.divide(2), r++;
|
| 46472 |
next: for (i2 = 0; i2 < a.length; i2++) {
|
| 46473 |
if (n.lesser(a[i2])) continue;
|
| 46474 |
+
x = bigInt2(a[i2]).modPow(b, n);
|
| 46475 |
if (x.isUnit() || x.equals(nPrev)) continue;
|
| 46476 |
for (d = r - 1; d != 0; d--) {
|
| 46477 |
x = x.square().mod(n);
|
|
|
|
| 46492 |
var logN = Math.log(2) * bits.toJSNumber();
|
| 46493 |
var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
|
| 46494 |
for (var a = [], i2 = 0; i2 < t; i2++) {
|
| 46495 |
+
a.push(bigInt2(i2 + 2));
|
| 46496 |
}
|
| 46497 |
return millerRabinTest(n, a);
|
| 46498 |
};
|
|
|
|
| 46503 |
var n = this.abs();
|
| 46504 |
var t = iterations === undefined2 ? 5 : iterations;
|
| 46505 |
for (var a = [], i2 = 0; i2 < t; i2++) {
|
| 46506 |
+
a.push(bigInt2.randBetween(2, n.minus(2), rng));
|
| 46507 |
}
|
| 46508 |
return millerRabinTest(n, a);
|
| 46509 |
};
|
| 46510 |
NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
|
| 46511 |
BigInteger.prototype.modInv = function(n) {
|
| 46512 |
+
var t = bigInt2.zero, newT = bigInt2.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
|
| 46513 |
while (!newR.isZero()) {
|
| 46514 |
q = r.divide(newR);
|
| 46515 |
lastT = t;
|
|
|
|
| 46620 |
yRem = yDivMod[0];
|
| 46621 |
result.push(fn(xDigit, yDigit));
|
| 46622 |
}
|
| 46623 |
+
var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt2(-1) : bigInt2(0);
|
| 46624 |
for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
|
| 46625 |
+
sum = sum.multiply(highestPower2).add(bigInt2(result[i2]));
|
| 46626 |
}
|
| 46627 |
return sum;
|
| 46628 |
}
|
|
|
|
| 46661 |
var t = p.multiply(base);
|
| 46662 |
return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 };
|
| 46663 |
}
|
| 46664 |
+
return { p: bigInt2(1), e: 0 };
|
| 46665 |
}
|
| 46666 |
BigInteger.prototype.bitLength = function() {
|
| 46667 |
var n = this;
|
| 46668 |
+
if (n.compareTo(bigInt2(0)) < 0) {
|
| 46669 |
+
n = n.negate().subtract(bigInt2(1));
|
| 46670 |
}
|
| 46671 |
+
if (n.compareTo(bigInt2(0)) === 0) {
|
| 46672 |
+
return bigInt2(0);
|
| 46673 |
}
|
| 46674 |
+
return bigInt2(integerLogarithm(n, bigInt2(2)).e).add(bigInt2(1));
|
| 46675 |
};
|
| 46676 |
NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
|
| 46677 |
function max(a, b) {
|
|
|
|
| 46791 |
return "<" + digit + ">";
|
| 46792 |
}
|
| 46793 |
function toBase(n, base) {
|
| 46794 |
+
base = bigInt2(base);
|
| 46795 |
if (base.isZero()) {
|
| 46796 |
if (n.isZero()) return { value: [0], isNegative: false };
|
| 46797 |
throw new Error("Cannot convert nonzero numbers to base 0.");
|
|
|
|
| 46970 |
return Integer;
|
| 46971 |
})();
|
| 46972 |
if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) {
|
| 46973 |
+
module2.exports = bigInt2;
|
| 46974 |
}
|
| 46975 |
if (typeof define === "function" && define.amd) {
|
| 46976 |
define(function() {
|
| 46977 |
+
return bigInt2;
|
| 46978 |
});
|
| 46979 |
}
|
| 46980 |
}
|
|
|
|
| 49798 |
"use strict";
|
| 49799 |
init_define_import_meta_env();
|
| 49800 |
var { inspect } = require_inspect();
|
| 49801 |
+
var bigInt2 = require_BigInteger();
|
| 49802 |
var { generateRandomBytes, readBigIntFromBuffer, isArrayLike, betterConsoleLog } = require_Helpers();
|
| 49803 |
var tlContent = require_apiTl();
|
| 49804 |
var schemeContent = require_schemaTl();
|
|
|
|
| 49983 |
correct = typeof value === type;
|
| 49984 |
break;
|
| 49985 |
case "bigInt":
|
| 49986 |
+
correct = bigInt2.isInstance(value) || typeof value === "bigint" || typeof value === "number" || typeof value === "string" || value === void 0;
|
| 49987 |
break;
|
| 49988 |
case "true":
|
| 49989 |
break;
|
|
|
|
| 68883 |
* @param {bigint} bigInt - a BigInt to convert
|
| 68884 |
* @returns {Address4}
|
| 68885 |
*/
|
| 68886 |
+
static fromBigInt(bigInt2) {
|
| 68887 |
+
if (bigInt2 < BigInt(0) || bigInt2 > BigInt(4294967295)) {
|
| 68888 |
throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");
|
| 68889 |
}
|
| 68890 |
+
return _Address4.fromHex(bigInt2.toString(16).padStart(8, "0"));
|
| 68891 |
}
|
| 68892 |
/**
|
| 68893 |
* Convert a byte array to an Address4 object. Throws `AddressError` unless
|
|
|
|
| 69461 |
* var address = Address6.fromBigInt(bigInt);
|
| 69462 |
* address.correctForm(); // '::e8:d4a5:1000'
|
| 69463 |
*/
|
| 69464 |
+
static fromBigInt(bigInt2) {
|
| 69465 |
+
if (bigInt2 < BigInt(0) || bigInt2 > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {
|
| 69466 |
throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");
|
| 69467 |
}
|
| 69468 |
+
const hex = bigInt2.toString(16).padStart(32, "0");
|
| 69469 |
const groups = [];
|
| 69470 |
for (let i = 0; i < constants6.GROUPS; i++) {
|
| 69471 |
groups.push(hex.slice(i * 4, (i + 1) * 4));
|
|
|
|
| 83442 |
// tgaccount.ts
|
| 83443 |
init_define_import_meta_env();
|
| 83444 |
var import_crypto = __toESM(require("crypto"));
|
| 83445 |
+
var import_big_integer = __toESM(require_BigInteger());
|
| 83446 |
var import_telegram = __toESM(require_telegram());
|
| 83447 |
var import_sessions = __toESM(require_sessions());
|
| 83448 |
var FILE = "telegram-account.json";
|
|
|
|
| 83506 |
}
|
| 83507 |
var maskPhone = (p) => p.length > 6 ? `${p.slice(0, 3)}****${p.slice(-3)}` : p;
|
| 83508 |
var entities = /* @__PURE__ */ new Map();
|
| 83509 |
+
var PEERS = "telegram-peers.json";
|
| 83510 |
+
var peerStore = { owner: "", peers: {} };
|
| 83511 |
+
var peerSaveTimer = null;
|
| 83512 |
+
function rememberPeer(key, p) {
|
| 83513 |
+
let rec = null;
|
| 83514 |
+
if (p instanceof import_telegram.Api.InputPeerChannel) rec = { id: p.channelId.toString(), hash: p.accessHash.toString(), type: "channel" };
|
| 83515 |
+
else if (p instanceof import_telegram.Api.InputPeerChat) rec = { id: p.chatId.toString(), hash: "0", type: "chat" };
|
| 83516 |
+
if (!rec) return;
|
| 83517 |
+
peerStore.peers[key] = rec;
|
| 83518 |
+
if (peerSaveTimer) clearTimeout(peerSaveTimer);
|
| 83519 |
+
peerSaveTimer = setTimeout(() => storePrivate(PEERS, peerStore).catch(() => {
|
| 83520 |
+
}), 5e3);
|
| 83521 |
+
}
|
| 83522 |
+
async function resolvePeer(username) {
|
| 83523 |
+
const c = client;
|
| 83524 |
+
if (!c) throw new Error("Telegram \u8D26\u53F7\u672A\u767B\u5F55");
|
| 83525 |
+
const key = username.toLowerCase();
|
| 83526 |
+
const hit = entities.get(key);
|
| 83527 |
+
if (hit) return hit;
|
| 83528 |
+
const rec = peerStore.peers[key];
|
| 83529 |
+
if (rec) {
|
| 83530 |
+
const p2 = rec.type === "channel" ? new import_telegram.Api.InputPeerChannel({ channelId: (0, import_big_integer.default)(rec.id), accessHash: (0, import_big_integer.default)(rec.hash) }) : new import_telegram.Api.InputPeerChat({ chatId: (0, import_big_integer.default)(rec.id) });
|
| 83531 |
+
entities.set(key, p2);
|
| 83532 |
+
return p2;
|
| 83533 |
+
}
|
| 83534 |
+
await throttle();
|
| 83535 |
+
const p = await c.getInputEntity(username);
|
| 83536 |
+
entities.set(key, p);
|
| 83537 |
+
rememberPeer(key, p);
|
| 83538 |
+
return p;
|
| 83539 |
+
}
|
| 83540 |
var nextCall = 0;
|
| 83541 |
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
| 83542 |
async function throttle() {
|
|
|
|
| 83569 |
if (!c) throw new Error("Telegram \u8D26\u53F7\u672A\u767B\u5F55");
|
| 83570 |
try {
|
| 83571 |
const key = channel.toLowerCase();
|
| 83572 |
+
const peer = await resolvePeer(channel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83573 |
let title = channel;
|
| 83574 |
let description = "";
|
| 83575 |
let avatar = "";
|
|
|
|
| 83633 |
saved = s;
|
| 83634 |
lastError = null;
|
| 83635 |
entities.clear();
|
| 83636 |
+
const owner = s.username || s.phone;
|
| 83637 |
+
peerStore = await loadPrivate(PEERS, { owner, peers: {} }).catch(() => ({ owner, peers: {} }));
|
| 83638 |
+
if (peerStore.owner !== owner) peerStore = { owner, peers: {} };
|
| 83639 |
setAccountFetcher(fetchViaAccount);
|
| 83640 |
}
|
| 83641 |
async function initAccount(secret) {
|
|
|
|
| 83929 |
async function viaAccount(c) {
|
| 83930 |
const cl = getClient();
|
| 83931 |
if (!cl) throw new Error("\u9700\u8981\u767B\u5F55 Telegram \u8D26\u53F7");
|
| 83932 |
+
await sleep3(1500);
|
| 83933 |
+
const peer = await resolvePeer(c.username);
|
| 83934 |
+
const ent = await throttled(() => cl.getEntity(peer));
|
| 83935 |
if (ent instanceof import_telegram2.Api.User) throw new Error("\u8FD9\u662F\u4E2A\u4EBA\u8D26\u53F7\u6216\u673A\u5668\u4EBA");
|
| 83936 |
const msgs = await throttled(() => cl.getMessages(ent, { limit: 80 }));
|
| 83937 |
const texts = msgs.filter((m) => m instanceof import_telegram2.Api.Message && !!m.message?.trim()).slice(0, 30).map((m) => m.message);
|