@asunajs/caiyun
Version:
移动云盘签到
1,222 lines (1,143 loc) • 46.9 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
var _chunkZLR4PK5Acjs = require('./chunk-ZLR4PK5A.cjs');
var _chunkXX3CNBUFcjs = require('./chunk-XX3CNBUF.cjs');
// index.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var _conf = require('@asunajs/conf');
// service/utils.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
// ../../core/caiyun/options.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var defuConfig = {
shake: {
enable: !0,
num: 15,
delay: 2
},
garden: {
enable: !1,
inviteCodes: [],
开启果园助力: !1
},
aiRedPack: {
enable: !0
},
backupWaitTime: 20,
tasks: {
skipTasks: [],
每月上传任务单日数量: 5
},
catalog: "00019700101000000001",
cloudPhoneRedpack: {
enable: !1
},
是否打印今日云朵: !0,
剩余多少天刷新token: 10,
微信抽奖: {
次数: 1,
间隔: 500
},
云朵大作战: {
目标排名: 500,
开启兑换: !1,
邀请用户: [],
游戏时间: 300
},
文件获取方式: 1
};
// ../../packages/unstorage/index.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var _fs = require('fs');
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/dist/index.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
// ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
function jsonParseTransform(key, value) {
if (key === "__proto__" || key === "constructor" && value && typeof value == "object" && "prototype" in value) {
warnKeyDropped(key);
return;
}
return value;
}
function warnKeyDropped(key) {
console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
}
function destr(value, options = {}) {
if (typeof value != "string")
return value;
if (value[0] === '"' && value[value.length - 1] === '"' && value.indexOf("\\") === -1)
return value.slice(1, -1);
let _value = value.trim();
if (_value.length <= 9)
switch (_value.toLowerCase()) {
case "true":
return !0;
case "false":
return !1;
case "undefined":
return;
case "null":
return null;
case "nan":
return Number.NaN;
case "infinity":
return Number.POSITIVE_INFINITY;
case "-infinity":
return Number.NEGATIVE_INFINITY;
}
if (!JsonSigRx.test(value)) {
if (options.strict)
throw new SyntaxError("[destr] Invalid JSON");
return value;
}
try {
if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
if (options.strict)
throw new Error("[destr] Possible prototype pollution");
return JSON.parse(value, jsonParseTransform);
}
return JSON.parse(value);
} catch (error) {
if (options.strict)
throw error;
return value;
}
}
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/dist/shared/unstorage.mNKHTF5Y.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function wrapToPromise(value) {
return !value || typeof value.then != "function" ? Promise.resolve(value) : value;
}
function asyncCall(function_, ...arguments_) {
try {
return wrapToPromise(function_(...arguments_));
} catch (error) {
return Promise.reject(error);
}
}
function isPrimitive(value) {
let type = typeof value;
return value === null || type !== "object" && type !== "function";
}
function isPureObject(value) {
let proto = Object.getPrototypeOf(value);
return !proto || proto.isPrototypeOf(Object);
}
function stringify(value) {
if (isPrimitive(value))
return String(value);
if (isPureObject(value) || Array.isArray(value))
return JSON.stringify(value);
if (typeof value.toJSON == "function")
return stringify(value.toJSON());
throw new Error("[unstorage] Cannot stringify value!");
}
var BASE64_PREFIX = "base64:";
function serializeRaw(value) {
return typeof value == "string" ? value : BASE64_PREFIX + base64Encode(value);
}
function deserializeRaw(value) {
return typeof value != "string" || !value.startsWith(BASE64_PREFIX) ? value : base64Decode(value.slice(BASE64_PREFIX.length));
}
function base64Decode(input) {
return globalThis.Buffer ? Buffer.from(input, "base64") : Uint8Array.from(
globalThis.atob(input),
(c) => c.codePointAt(0)
);
}
function base64Encode(input) {
return globalThis.Buffer ? Buffer.from(input).toString("base64") : globalThis.btoa(String.fromCodePoint(...input));
}
var storageKeyProperties = [
"has",
"hasItem",
"get",
"getItem",
"getItemRaw",
"set",
"setItem",
"setItemRaw",
"del",
"remove",
"removeItem",
"getMeta",
"setMeta",
"removeMeta",
"getKeys",
"clear",
"mount",
"unmount"
];
function prefixStorage(storage2, base) {
if (base = normalizeBaseKey(base), !base)
return storage2;
let nsStorage = { ...storage2 };
for (let property of storageKeyProperties)
nsStorage[property] = (key = "", ...args) => (
// @ts-ignore
storage2[property](base + key, ...args)
);
return nsStorage.getKeys = (key = "", ...arguments_) => storage2.getKeys(base + key, ...arguments_).then((keys) => keys.map((key2) => key2.slice(base.length))), nsStorage;
}
function normalizeKey(key) {
return key && _optionalChain([key, 'access', _ => _.split, 'call', _2 => _2("?"), 'access', _3 => _3[0], 'optionalAccess', _4 => _4.replace, 'call', _5 => _5(/[/\\]/g, ":"), 'access', _6 => _6.replace, 'call', _7 => _7(/:+/g, ":"), 'access', _8 => _8.replace, 'call', _9 => _9(/^:|:$/g, "")]) || "";
}
function joinKeys(...keys) {
return normalizeKey(keys.join(":"));
}
function normalizeBaseKey(base) {
return base = normalizeKey(base), base ? base + ":" : "";
}
function filterKeyByDepth(key, depth) {
if (depth === void 0)
return !0;
let substrCount = 0, index = key.indexOf(":");
for (; index > -1; )
substrCount++, index = key.indexOf(":", index + 1);
return substrCount <= depth;
}
function filterKeyByBase(key, base) {
return base ? key.startsWith(base) && key[key.length - 1] !== "$" : key[key.length - 1] !== "$";
}
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/dist/index.mjs
var DRIVER_NAME = "memory", memory = () => {
let data = /* @__PURE__ */ new Map();
return {
name: DRIVER_NAME,
getInstance: () => data,
hasItem(key) {
return data.has(key);
},
getItem(key) {
return _nullishCoalesce(data.get(key), () => ( null));
},
getItemRaw(key) {
return _nullishCoalesce(data.get(key), () => ( null));
},
setItem(key, value) {
data.set(key, value);
},
setItemRaw(key, value) {
data.set(key, value);
},
removeItem(key) {
data.delete(key);
},
getKeys() {
return [...data.keys()];
},
clear() {
data.clear();
},
dispose() {
data.clear();
}
};
};
function createStorage(options = {}) {
let context = {
mounts: { "": options.driver || memory() },
mountpoints: [""],
watching: !1,
watchListeners: [],
unwatch: {}
}, getMount = (key) => {
for (let base of context.mountpoints)
if (key.startsWith(base))
return {
base,
relativeKey: key.slice(base.length),
driver: context.mounts[base]
};
return {
base: "",
relativeKey: key,
driver: context.mounts[""]
};
}, getMounts = (base, includeParent) => context.mountpoints.filter(
(mountpoint) => mountpoint.startsWith(base) || includeParent && base.startsWith(mountpoint)
).map((mountpoint) => ({
relativeBase: base.length > mountpoint.length ? base.slice(mountpoint.length) : void 0,
mountpoint,
driver: context.mounts[mountpoint]
})), onChange = (event, key) => {
if (context.watching) {
key = normalizeKey(key);
for (let listener of context.watchListeners)
listener(event, key);
}
}, startWatch = async () => {
if (!context.watching) {
context.watching = !0;
for (let mountpoint in context.mounts)
context.unwatch[mountpoint] = await watch(
context.mounts[mountpoint],
onChange,
mountpoint
);
}
}, stopWatch = async () => {
if (context.watching) {
for (let mountpoint in context.unwatch)
await context.unwatch[mountpoint]();
context.unwatch = {}, context.watching = !1;
}
}, runBatch = (items, commonOptions, cb) => {
let batches = /* @__PURE__ */ new Map(), getBatch = (mount) => {
let batch = batches.get(mount.base);
return batch || (batch = {
driver: mount.driver,
base: mount.base,
items: []
}, batches.set(mount.base, batch)), batch;
};
for (let item of items) {
let isStringItem = typeof item == "string", key = normalizeKey(isStringItem ? item : item.key), value = isStringItem ? void 0 : item.value, options2 = isStringItem || !item.options ? commonOptions : { ...commonOptions, ...item.options }, mount = getMount(key);
getBatch(mount).items.push({
key,
value,
relativeKey: mount.relativeKey,
options: options2
});
}
return Promise.all([...batches.values()].map((batch) => cb(batch))).then(
(r) => r.flat()
);
}, storage2 = {
// Item
hasItem(key, opts = {}) {
key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
return asyncCall(driver.hasItem, relativeKey, opts);
},
getItem(key, opts = {}) {
key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
return asyncCall(driver.getItem, relativeKey, opts).then(
(value) => destr(value)
);
},
getItems(items, commonOptions = {}) {
return runBatch(items, commonOptions, (batch) => batch.driver.getItems ? asyncCall(
batch.driver.getItems,
batch.items.map((item) => ({
key: item.relativeKey,
options: item.options
})),
commonOptions
).then(
(r) => r.map((item) => ({
key: joinKeys(batch.base, item.key),
value: destr(item.value)
}))
) : Promise.all(
batch.items.map((item) => asyncCall(
batch.driver.getItem,
item.relativeKey,
item.options
).then((value) => ({
key: item.key,
value: destr(value)
})))
));
},
getItemRaw(key, opts = {}) {
key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
return driver.getItemRaw ? asyncCall(driver.getItemRaw, relativeKey, opts) : asyncCall(driver.getItem, relativeKey, opts).then(
(value) => deserializeRaw(value)
);
},
async setItem(key, value, opts = {}) {
if (value === void 0)
return storage2.removeItem(key);
key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
driver.setItem && (await asyncCall(driver.setItem, relativeKey, stringify(value), opts), driver.watch || onChange("update", key));
},
async setItems(items, commonOptions) {
await runBatch(items, commonOptions, async (batch) => {
if (batch.driver.setItems)
return asyncCall(
batch.driver.setItems,
batch.items.map((item) => ({
key: item.relativeKey,
value: stringify(item.value),
options: item.options
})),
commonOptions
);
batch.driver.setItem && await Promise.all(
batch.items.map((item) => asyncCall(
batch.driver.setItem,
item.relativeKey,
stringify(item.value),
item.options
))
);
});
},
async setItemRaw(key, value, opts = {}) {
if (value === void 0)
return storage2.removeItem(key, opts);
key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
if (driver.setItemRaw)
await asyncCall(driver.setItemRaw, relativeKey, value, opts);
else if (driver.setItem)
await asyncCall(driver.setItem, relativeKey, serializeRaw(value), opts);
else
return;
driver.watch || onChange("update", key);
},
async removeItem(key, opts = {}) {
typeof opts == "boolean" && (opts = { removeMeta: opts }), key = normalizeKey(key);
let { relativeKey, driver } = getMount(key);
driver.removeItem && (await asyncCall(driver.removeItem, relativeKey, opts), (opts.removeMeta || opts.removeMata) && await asyncCall(driver.removeItem, relativeKey + "$", opts), driver.watch || onChange("remove", key));
},
// Meta
async getMeta(key, opts = {}) {
typeof opts == "boolean" && (opts = { nativeOnly: opts }), key = normalizeKey(key);
let { relativeKey, driver } = getMount(key), meta = /* @__PURE__ */ Object.create(null);
if (driver.getMeta && Object.assign(meta, await asyncCall(driver.getMeta, relativeKey, opts)), !opts.nativeOnly) {
let value = await asyncCall(
driver.getItem,
relativeKey + "$",
opts
).then((value_) => destr(value_));
value && typeof value == "object" && (typeof value.atime == "string" && (value.atime = new Date(value.atime)), typeof value.mtime == "string" && (value.mtime = new Date(value.mtime)), Object.assign(meta, value));
}
return meta;
},
setMeta(key, value, opts = {}) {
return this.setItem(key + "$", value, opts);
},
removeMeta(key, opts = {}) {
return this.removeItem(key + "$", opts);
},
// Keys
async getKeys(base, opts = {}) {
base = normalizeBaseKey(base);
let mounts = getMounts(base, !0), maskedMounts = [], allKeys = [], allMountsSupportMaxDepth = !0;
for (let mount of mounts) {
_optionalChain([mount, 'access', _10 => _10.driver, 'access', _11 => _11.flags, 'optionalAccess', _12 => _12.maxDepth]) || (allMountsSupportMaxDepth = !1);
let rawKeys = await asyncCall(
mount.driver.getKeys,
mount.relativeBase,
opts
);
for (let key of rawKeys) {
let fullKey = mount.mountpoint + normalizeKey(key);
maskedMounts.some((p) => fullKey.startsWith(p)) || allKeys.push(fullKey);
}
maskedMounts = [
mount.mountpoint,
...maskedMounts.filter((p) => !p.startsWith(mount.mountpoint))
];
}
let shouldFilterByDepth = opts.maxDepth !== void 0 && !allMountsSupportMaxDepth;
return allKeys.filter(
(key) => (!shouldFilterByDepth || filterKeyByDepth(key, opts.maxDepth)) && filterKeyByBase(key, base)
);
},
// Utils
async clear(base, opts = {}) {
base = normalizeBaseKey(base), await Promise.all(
getMounts(base, !1).map(async (m) => {
if (m.driver.clear)
return asyncCall(m.driver.clear, m.relativeBase, opts);
if (m.driver.removeItem) {
let keys = await m.driver.getKeys(m.relativeBase || "", opts);
return Promise.all(
keys.map((key) => m.driver.removeItem(key, opts))
);
}
})
);
},
async dispose() {
await Promise.all(
Object.values(context.mounts).map((driver) => dispose(driver))
);
},
async watch(callback) {
return await startWatch(), context.watchListeners.push(callback), async () => {
context.watchListeners = context.watchListeners.filter(
(listener) => listener !== callback
), context.watchListeners.length === 0 && await stopWatch();
};
},
async unwatch() {
context.watchListeners = [], await stopWatch();
},
// Mount
mount(base, driver) {
if (base = normalizeBaseKey(base), base && context.mounts[base])
throw new Error(`already mounted at ${base}`);
return base && (context.mountpoints.push(base), context.mountpoints.sort((a, b) => b.length - a.length)), context.mounts[base] = driver, context.watching && Promise.resolve(watch(driver, onChange, base)).then((unwatcher) => {
context.unwatch[base] = unwatcher;
}).catch(console.error), storage2;
},
async unmount(base, _dispose = !0) {
base = normalizeBaseKey(base), !(!base || !context.mounts[base]) && (context.watching && base in context.unwatch && (_optionalChain([context, 'access', _13 => _13.unwatch, 'access', _14 => _14[base], 'optionalCall', _15 => _15()]), delete context.unwatch[base]), _dispose && await dispose(context.mounts[base]), context.mountpoints = context.mountpoints.filter((key) => key !== base), delete context.mounts[base]);
},
getMount(key = "") {
key = normalizeKey(key) + ":";
let m = getMount(key);
return {
driver: m.driver,
base: m.base
};
},
getMounts(base = "", opts = {}) {
return base = normalizeKey(base), getMounts(base, opts.parents).map((m) => ({
driver: m.driver,
base: m.mountpoint
}));
},
// Aliases
keys: (base, opts = {}) => storage2.getKeys(base, opts),
get: (key, opts = {}) => storage2.getItem(key, opts),
set: (key, value, opts = {}) => storage2.setItem(key, value, opts),
has: (key, opts = {}) => storage2.hasItem(key, opts),
del: (key, opts = {}) => storage2.removeItem(key, opts),
remove: (key, opts = {}) => storage2.removeItem(key, opts)
};
return storage2;
}
function watch(driver, onChange, base) {
return driver.watch ? driver.watch((event, key) => onChange(event, base + key)) : () => {
};
}
async function dispose(driver) {
typeof driver.dispose == "function" && await asyncCall(driver.dispose);
}
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/drivers/fs-lite.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var _path = require('path');
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/drivers/utils/index.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function createError(driver, message, opts) {
let err = new Error(`[unstorage] [${driver}] ${message}`, opts);
return Error.captureStackTrace && Error.captureStackTrace(err, createError), err;
}
function createRequiredError(driver, name) {
return Array.isArray(name) ? createError(
driver,
`Missing some of the required options ${name.map((n) => "`" + n + "`").join(", ")}`
) : createError(driver, `Missing required option \`${name}\`.`);
}
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/drivers/utils/node-fs.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function ignoreNotfound(err) {
return err.code === "ENOENT" || err.code === "EISDIR" ? null : err;
}
function ignoreExists(err) {
return err.code === "EEXIST" ? null : err;
}
async function writeFile(path, data, encoding) {
return await ensuredir(_path.dirname.call(void 0, path)), _fs.promises.writeFile(path, data, encoding);
}
function readFile(path, encoding) {
return _fs.promises.readFile(path, encoding).catch(ignoreNotfound);
}
function unlink(path) {
return _fs.promises.unlink(path).catch(ignoreNotfound);
}
function readdir(dir) {
return _fs.promises.readdir(dir, { withFileTypes: !0 }).catch(ignoreNotfound).then((r) => r || []);
}
async function ensuredir(dir) {
_fs.existsSync.call(void 0, dir) || (await ensuredir(_path.dirname.call(void 0, dir)).catch(ignoreExists), await _fs.promises.mkdir(dir).catch(ignoreExists));
}
async function readdirRecursive(dir, ignore, maxDepth) {
if (ignore && ignore(dir))
return [];
let entries = await readdir(dir), files = [];
return await Promise.all(
entries.map(async (entry) => {
let entryPath = _path.resolve.call(void 0, dir, entry.name);
if (entry.isDirectory()) {
if (maxDepth === void 0 || maxDepth > 0) {
let dirFiles = await readdirRecursive(
entryPath,
ignore,
maxDepth === void 0 ? void 0 : maxDepth - 1
);
files.push(...dirFiles.map((f) => entry.name + "/" + f));
}
} else
ignore && ignore(entry.name) || files.push(entry.name);
})
), files;
}
async function rmRecursive(dir) {
let entries = await readdir(dir);
await Promise.all(
entries.map((entry) => {
let entryPath = _path.resolve.call(void 0, dir, entry.name);
return entry.isDirectory() ? rmRecursive(entryPath).then(() => _fs.promises.rmdir(entryPath)) : _fs.promises.unlink(entryPath);
})
);
}
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/drivers/fs-lite.mjs
var PATH_TRAVERSE_RE = /\.\.:|\.\.$/, DRIVER_NAME2 = "fs-lite", fs_lite_default = (opts = {}) => {
if (!opts.base)
throw createRequiredError(DRIVER_NAME2, "base");
opts.base = _path.resolve.call(void 0, opts.base);
let r = (key) => {
if (PATH_TRAVERSE_RE.test(key))
throw createError(
DRIVER_NAME2,
`Invalid key: ${JSON.stringify(key)}. It should not contain .. segments`
);
return _path.join.call(void 0, opts.base, key.replace(/:/g, "/"));
};
return {
name: DRIVER_NAME2,
options: opts,
flags: {
maxDepth: !0
},
hasItem(key) {
return _fs.existsSync.call(void 0, r(key));
},
getItem(key) {
return readFile(r(key), "utf8");
},
getItemRaw(key) {
return readFile(r(key));
},
async getMeta(key) {
let { atime, mtime, size, birthtime, ctime } = await _fs.promises.stat(r(key)).catch(() => ({}));
return { atime, mtime, size, birthtime, ctime };
},
setItem(key, value) {
if (!opts.readOnly)
return writeFile(r(key), value, "utf8");
},
setItemRaw(key, value) {
if (!opts.readOnly)
return writeFile(r(key), value);
},
removeItem(key) {
if (!opts.readOnly)
return unlink(r(key));
},
getKeys(_base, topts) {
return readdirRecursive(r("."), opts.ignore, _optionalChain([topts, 'optionalAccess', _16 => _16.maxDepth]));
},
async clear() {
opts.readOnly || opts.noClear || await rmRecursive(r("."));
}
};
};
// ../../node_modules/.pnpm/unstorage@1.15.0_db0@0.3.1_ioredis@5.6.0/node_modules/unstorage/drivers/memory.mjs
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var DRIVER_NAME3 = "memory", memory_default = () => {
let data = /* @__PURE__ */ new Map();
return {
name: DRIVER_NAME3,
getInstance: () => data,
hasItem(key) {
return data.has(key);
},
getItem(key) {
return _nullishCoalesce(data.get(key), () => ( null));
},
getItemRaw(key) {
return _nullishCoalesce(data.get(key), () => ( null));
},
setItem(key, value) {
data.set(key, value);
},
setItemRaw(key, value) {
data.set(key, value);
},
removeItem(key) {
data.delete(key);
},
getKeys() {
return [...data.keys()];
},
clear() {
data.clear();
},
dispose() {
data.clear();
}
};
};
// ../../packages/unstorage/index.ts
function getStorage(prefix) {
let storage2 = createStorage({
driver: canWrite() ? fs_lite_default({ base: "./.temp/asign" }) : memory_default()
});
return prefixStorage(storage2, prefix);
}
function canWrite() {
try {
let file = "asign_file_write.txt";
return _fs.writeFileSync.call(void 0, file, file), _fs.unlinkSync.call(void 0, file), !0;
} catch (e) {
return !1;
}
}
// service/utils.ts
var _http = require('@asunajs/http');
var _push = require('@asunajs/push');
var _defu = require('defu');
// service/upload-task.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var _buffer = require('buffer');
var _crypto = require('crypto');
function getRandomFile($) {
let randomBuffer = _crypto.randomBytes.call(void 0, 16);
return {
randomBuffer,
fileMd5: $.node.myMD5(randomBuffer.toString("hex")),
fileSize: 209715216
};
}
async function _upload($) {
let file = getRandomFile($), uploadInfo = {
digest: file.fileMd5,
contentSize: file.fileSize,
manualRename: 2,
ext: ".mp4",
createTime: _chunkZLR4PK5Acjs.createTime.call(void 0, )
};
$.logger.debug((/* @__PURE__ */ new Date()).toLocaleString(), JSON.stringify(uploadInfo)), await uploadFile($, $.config.catalog, uploadInfo, file.randomBuffer) && $.logger.debug("上传成功");
}
async function uploadTask($, progressNum) {
if (_chunkZLR4PK5Acjs.isWps.call(void 0, )) {
$.logger.debug("当前环境为WPS,不支持上传文件");
return;
}
$.logger.debug("已经上传", progressNum, "字节");
let needM = 1025 - Math.floor(progressNum / 1024 / 1024);
$.logger.debug("需要上传", needM, "MB");
for (let i = 0; i < needM; i += 200)
await _upload($), needM - 200 > 0 && await $.sleep(3e3);
}
async function uploadFile($, parentCatalogID, {
ext = ".png",
digest = _chunkZLR4PK5Acjs.randomHex.call(void 0, 32).toUpperCase(),
contentSize = _chunkZLR4PK5Acjs.randomNumber.call(void 0, 1, 1e3),
manualRename = 2,
contentName = "asign-" + _chunkZLR4PK5Acjs.randomHex.call(void 0, 4) + ext,
createTime: createTime2 = _chunkZLR4PK5Acjs.createTime.call(void 0, )
} = {}, randomBuffer) {
try {
$.logger.debug("开始上传文件", digest);
let { redirectionUrl, uploadTaskID, contentID } = await _chunkZLR4PK5Acjs.uploadFileRequest.call(void 0, $, parentCatalogID, {
ext,
digest,
contentSize,
manualRename,
contentName,
createTime: createTime2
}, !0);
if (!redirectionUrl || !randomBuffer)
return !!contentID;
$.logger.debug("别着急,文件上传中。。。", contentID);
let ok = await uploadFileApi(redirectionUrl.replace(/&/g, "&"), uploadTaskID, randomBuffer);
return ok && contentID && _chunkZLR4PK5Acjs.setStoreArray.call(void 0, $.store, "files", [contentID]), ok;
} catch (error) {
$.logger.error("上传文件异常", error);
}
return !1;
}
async function uploadFileApi(url, id, randomBuffer) {
let stream = _http.got.stream.post(url, {
headers: {
UploadtaskID: id + "-",
"x-huawei-uploadSrc": "1",
"Content-Type": "application/octet-stream",
"x-huawei-channelSrc": "10000023",
"User-Agent": "okhttp/4.12.0",
contentSize: "209715216",
Range: "bytes=0-209715215"
},
body: randomFile(randomBuffer)
});
return stream.resume(), new Promise((resolve3, reject) => {
stream.on("error", reject), stream.on("response", async (res) => {
resolve3(res.ok);
});
});
}
function* randomFile(randomBuffer) {
for (let i = 0; i < 209715200; i += 65536)
yield _buffer.Buffer.alloc(65536);
yield randomBuffer;
}
// utils/ai-userid-aes.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function aesEecrypt(textUtf8, iv) {
let decipher = _crypto.createCipheriv.call(void 0, "aes-128-cbc", _buffer.Buffer.from("xuL97!x7GGxG%8V4", "utf-8"), iv);
return _buffer.Buffer.concat([decipher.update(textUtf8, "utf-8"), decipher.final()]);
}
function encryptAiUserId(userId) {
let iv = _crypto.randomBytes.call(void 0, 16);
return _buffer.Buffer.from(_buffer.Buffer.concat([iv, aesEecrypt(userId, iv)]).toString("base64"), "utf-8").toString("base64");
}
// utils/md5.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function safeAdd(x, y) {
var lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return msw << 16 | lsw & 65535;
}
function bitRotateLeft(num, cnt) {
return num << cnt | num >>> 32 - cnt;
}
function md5cmn(q, a, b, x, s, t) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
}
function md5ff(a, b, c, d, x, s, t) {
return md5cmn(b & c | ~b & d, a, b, x, s, t);
}
function md5gg(a, b, c, d, x, s, t) {
return md5cmn(b & d | c & ~d, a, b, x, s, t);
}
function md5hh(a, b, c, d, x, s, t) {
return md5cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5ii(a, b, c, d, x, s, t) {
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
}
function _binlMD5_for(x, a, b, c, d) {
let olda, oldb, oldc, oldd, i;
for (i = 0; i < x.length; i += 16)
olda = a, oldb = b, oldc = c, oldd = d, a = md5ff(a, b, c, d, x[i], 7, -680876936), d = md5ff(d, a, b, c, x[i + 1], 12, -389564586), c = md5ff(c, d, a, b, x[i + 2], 17, 606105819), b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330), a = md5ff(a, b, c, d, x[i + 4], 7, -176418897), d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426), c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341), b = md5ff(b, c, d, a, x[i + 7], 22, -45705983), a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416), d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417), c = md5ff(c, d, a, b, x[i + 10], 17, -42063), b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162), a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682), d = md5ff(d, a, b, c, x[i + 13], 12, -40341101), c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290), b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329), a = md5gg(a, b, c, d, x[i + 1], 5, -165796510), d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632), c = md5gg(c, d, a, b, x[i + 11], 14, 643717713), b = md5gg(b, c, d, a, x[i], 20, -373897302), a = md5gg(a, b, c, d, x[i + 5], 5, -701558691), d = md5gg(d, a, b, c, x[i + 10], 9, 38016083), c = md5gg(c, d, a, b, x[i + 15], 14, -660478335), b = md5gg(b, c, d, a, x[i + 4], 20, -405537848), a = md5gg(a, b, c, d, x[i + 9], 5, 568446438), d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690), c = md5gg(c, d, a, b, x[i + 3], 14, -187363961), b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501), a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467), d = md5gg(d, a, b, c, x[i + 2], 9, -51403784), c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473), b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734), a = md5hh(a, b, c, d, x[i + 5], 4, -378558), d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463), c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562), b = md5hh(b, c, d, a, x[i + 14], 23, -35309556), a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060), d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353), c = md5hh(c, d, a, b, x[i + 7], 16, -155497632), b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640), a = md5hh(a, b, c, d, x[i + 13], 4, 681279174), d = md5hh(d, a, b, c, x[i], 11, -358537222), c = md5hh(c, d, a, b, x[i + 3], 16, -722521979), b = md5hh(b, c, d, a, x[i + 6], 23, 76029189), a = md5hh(a, b, c, d, x[i + 9], 4, -640364487), d = md5hh(d, a, b, c, x[i + 12], 11, -421815835), c = md5hh(c, d, a, b, x[i + 15], 16, 530742520), b = md5hh(b, c, d, a, x[i + 2], 23, -995338651), a = md5ii(a, b, c, d, x[i], 6, -198630844), d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415), c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905), b = md5ii(b, c, d, a, x[i + 5], 21, -57434055), a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571), d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606), c = md5ii(c, d, a, b, x[i + 10], 15, -1051523), b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799), a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359), d = md5ii(d, a, b, c, x[i + 15], 10, -30611744), c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380), b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649), a = md5ii(a, b, c, d, x[i + 4], 6, -145523070), d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379), c = md5ii(c, d, a, b, x[i + 2], 15, 718787259), b = md5ii(b, c, d, a, x[i + 9], 21, -343485551), a = safeAdd(a, olda), b = safeAdd(b, oldb), c = safeAdd(c, oldc), d = safeAdd(d, oldd);
return [a, b, c, d];
}
function binlMD5(x, len, padding = !0, initialState = { a: 1732584193, b: -271733879, c: -1732584194, d: 271733878 }, fixLen = 0) {
return padding && (x[len >> 5] |= 128 << len % 32, x[(len + 64 >>> 9 << 4) + 14] = len + fixLen), _binlMD5_for(x, initialState.a, initialState.b, initialState.c, initialState.d);
}
function incrementallyComputeMD5(s, fixLen = 0, initialState = { a: 1732584193, b: -271733879, c: -1732584194, d: 271733878 }) {
return rstr2hex(binl2rstr(binlMD5(rstr2binl(decodeURIComponent(s)), s.length * 8, !0, initialState, fixLen)));
}
function binl2rstr(input) {
let output = "", length32 = input.length * 32;
for (let i = 0; i < length32; i += 8)
output += String.fromCharCode(input[i >> 5] >>> i % 32 & 255);
return output;
}
function rstr2hex(input) {
var hexTab = "0123456789abcdef", output = "", x, i;
for (i = 0; i < input.length; i += 1)
x = input.charCodeAt(i), output += hexTab.charAt(x >>> 4 & 15) + hexTab.charAt(x & 15);
return output;
}
function rstr2binl(input) {
let buffer = _buffer.Buffer.from(input, "binary"), outputLength = Math.ceil(buffer.length / 4), output = new Uint32Array(outputLength), outputView = new Uint8Array(output.buffer);
return buffer.copy(outputView, 0, 0, buffer.length), Array.from(output);
}
function myMD5(s) {
return incrementallyComputeMD5(s, 3355443200, {
a: -1235010310,
b: -1633014442,
c: 1919210400,
d: -1138002915
});
}
// service/utils.ts
async function init(userConfig, { logger, localStorage, jwtToken }) {
let config = initConfig(userConfig);
if (!config.phone)
return logger.error("auth 格式解析错误,请查看是否填写正确的 auth"), {};
if (config.phone.length !== 11 || !config.phone.startsWith("1"))
return logger.info("auth 格式解析错误,请查看是否填写正确的 auth"), {};
let DATA = {
baseUA: _chunkZLR4PK5Acjs.CAIYUN_BASE_UA,
mailUaEnd: `(139PE_WebView_Android_${_chunkZLR4PK5Acjs.CAIYUN_APP_VERSION}_mcloud139)`,
mailRequested: "cn.cj.pe",
mcloudRequested: "com.chinamobile.mcloud"
}, http = _http.createRequest.call(void 0, {
hooks: {
beforeRequest: [
(options) => {
["caiyun.feixin.10086.cn", "mrp.mcloud.139.com"].includes(options.url.hostname) ? (jwtToken && (options.headers.jwttoken = jwtToken), options.headers.authorization = "Basic " + config.auth) : options.headers.authorization = config.auth;
}
]
},
headers: {
"user-agent": DATA.baseUA,
"x-requested-with": DATA.mcloudRequested,
charset: "utf-8",
"content-type": "application/json;charset=UTF-8",
"x-yun-client-info": _chunkZLR4PK5Acjs.CAIYUN_CLIENT,
"x-DeviceInfo": _chunkZLR4PK5Acjs.CAIYUN_CLIENT,
"x-NetType": _chunkZLR4PK5Acjs.CAIYUN_NET_TYPE
},
retry: {
limit: 3,
methods: ["POST", "GET", "PATCH", "DELETE", "OPTIONS", "TRACE"]
}
}), $ = {
api: _chunkZLR4PK5Acjs.createApi.call(void 0, http),
config,
gardenApi: _chunkZLR4PK5Acjs.createGardenApi.call(void 0, http),
logger,
DATA,
sleep: _chunkZLR4PK5Acjs.sleep,
node: {
uploadTask,
myMD5,
encryptAiUserId
},
md5: _chunkZLR4PK5Acjs.md5,
store: {},
localStorage: localStorage || getStorage("caiyun-" + config.phone),
http
};
return logger.info("=============="), printNickName($), printExpireTime($, $.config.expire), jwtToken ||= await _chunkZLR4PK5Acjs.getJwtToken.call(void 0, $), {
$,
logger,
jwtToken
};
}
function initConfig(userConfig) {
let config = _defu.defu.call(void 0, userConfig, defuConfig);
return {
...config,
..._chunkZLR4PK5Acjs.getAuthInfo.call(void 0, config.auth)
};
}
async function loadConfig(inputPath) {
let r = await _conf.loadConfig.call(void 0, inputPath);
if (!r.config)
throw new Error("配置文件为空");
return {
config: r.config.caiyun,
message: r.config.message,
path: r.path
};
}
function printNickName({ config, logger }) {
logger.info(`登录账号【${config.nickname || _chunkZLR4PK5Acjs.hidePhone.call(void 0, config.phone)}】`);
}
function printExpireTime({ logger }, expire) {
logger.info("登录过期时间", _chunkZLR4PK5Acjs.formatTime.call(void 0, expire));
}
function pushMessage2({ pushData, message }) {
return _chunkZLR4PK5Acjs.pushMessage.call(void 0, {
pushData,
message,
sendNotify: _push.sendNotify,
createRequest: _http.createRequest
});
}
// service/index.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
// service/exchange.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
function waitToHour(hour = 0, delay = 300) {
let now = /* @__PURE__ */ new Date(), time = new Date(now.getFullYear(), now.getMonth(), now.getDate(), hour, 0, 0, delay).getTime() - now.getTime();
return console.info("等待:", time, "ms"), _chunkZLR4PK5Acjs.sleepSync.call(void 0, time);
}
function waitToNextHour(delay) {
let now = /* @__PURE__ */ new Date();
if (![0, 12, 16, 20, 24].includes(now.getHours()))
return waitToHour(now.getHours() + 1, delay);
}
async function useExchange(config, message) {
let pushData = [{ level: 3, type: "info", date: /* @__PURE__ */ new Date(), msg: "文档地址:https://as.js.cool" }], logger = await _chunkZLR4PK5Acjs.createLogger.call(void 0, { pushData });
try {
let authInfo = _chunkZLR4PK5Acjs.getAuthInfo.call(void 0, config.auth), { $, jwtToken } = await init(
{
...config,
...authInfo
},
{ logger }
);
if (!jwtToken) return;
let { exchangeTask, exchangeApi } = await Promise.resolve().then(() => _interopRequireWildcard(require("./caiyun-WO76F4KA.cjs"))), sendMessage = async (msg) => message ? (message.title = msg || message.title, message.onlyError = !1, _chunkZLR4PK5Acjs.pushMessage.call(void 0, {
pushData,
message,
sendNotify: _push.sendNotify,
createRequest: _http.createRequest
})) : $.logger.debug("未配置推送信息");
return {
exchange: async (ids) => {
let msg = await exchangeTask($, ids);
msg && await sendMessage(msg).catch((err) => logger.error(err));
},
sendMessage,
waitToNextHour,
/** 快速兑换 */
exchangeQuickly: async (prizeId, prizeName) => exchangeApi($, prizeId, prizeName)
};
} catch (error) {
logger.error(error);
}
}
async function useMultiExchange(config, message, { isAsync, delay }) {
let tasks = config.map(({ user, ids }) => async () => {
let { exchange } = await useExchange(user, message) || {};
if (exchange)
return waitToNextHour(), exchange(ids);
});
if (isAsync) return Promise.all(tasks.map((task) => task()));
for (let task of tasks)
await task(), await _chunkZLR4PK5Acjs.sleep.call(void 0, delay || 1e3);
}
// service/hc1t.ts
_chunkXX3CNBUFcjs.init_cjs_shims.call(void 0, );
var storage = getStorage("caiyun-hc1t"), DB_KEY = "invite";
async function exchangeHc1t($, time, rank) {
if (rank < $.config.云朵大作战.目标排名) {
$.logger.debug(`当前排名 ${rank},优于配置排名 ${$.config.云朵大作战.目标排名},不兑换`);
return;
}
if (!$.config.云朵大作战.开启兑换) {
$.logger.debug("未开启兑换,不兑换");
return;
}
if (!(time <= 0))
try {
let { code, msg, result } = await $.api.exchangeHecheng1T(time);
if (code !== 0)
return $.logger.fail("兑换次数失败", code, msg);
let { inviteds, curr, invite } = result;
$.logger.debug("剩余次数", curr), $.logger.debug("今日剩余可被邀请次数", invite), $.logger.debug(
"已被下列用户邀请过:",
inviteds.filter(Boolean).map((i) => _chunkZLR4PK5Acjs.hidePhone.call(void 0, i)).join(",")
);
} catch (error) {
$.logger.error("兑换异常", error);
}
}
async function getHc1tApi($) {
try {
let { code, msg, result } = await $.api.getHecheng1T();
if (code === 0)
return result;
$.logger.fatal("获取云朵大作战信息失败", msg);
} catch (error) {
$.logger.error("获取云朵大作战信息异常", error);
}
return {};
}
async function getHc1t($) {
let { info, history } = await getHc1tApi($);
if (!info)
return {
curr: 0,
exchange: 0,
rank: 1
};
_chunkZLR4PK5Acjs.printHc1t.call(void 0, $.logger, { info, history });
let { exchange, curr } = info;
return {
curr,
exchange,
rank: Number(history[0].rank) || 1
};
}
async function hc1t($, inviter) {
$.logger.start("开始云朵大作战,", inviter ? "接受" + _chunkZLR4PK5Acjs.hidePhone.call(void 0, inviter) + "邀请" : "未获取到可用配置或已使用完");
try {
let 游戏时间 = $.config.云朵大作战.游戏时间;
await _chunkZLR4PK5Acjs.hc1tHandler.call(void 0, $, 游戏时间, inviter), await saveInviter(inviter, $.config.phone);
} catch (error) {
$.logger.error("云朵大作战失败", error);
}
}
async function _do($, inviter) {
return await $.sleep(5e3), $.logger.start("开始云朵大作战,", inviter ? "接受" + _chunkZLR4PK5Acjs.hidePhone.call(void 0, inviter) + "邀请" : "未获取到可用配置或已使用完"), await hc1t($, inviter), await $.sleep(7e3), await getHc1t($);
}
async function hc1tTask($) {
let config = $.config.云朵大作战;
if (!config) return $.logger.warn("云朵大作战未配置,跳过执行");
let inviters = config.邀请用户;
if (!inviters || !inviters.length) return $.logger.warn("云朵大作战未配置邀请用户,跳过执行");
inviters.forEach((item, i, arr) => arr[i] = b64ToStr(item));
let data = await getHc1t($), _run2 = async () => {
let phone = $.config.phone;
for (let index = 0; index < data.curr; index++)
data = await _do($, await getInviter(inviters, phone)), await $.sleep(3e3);
};
await _run2(), await exchangeHc1t($, data.exchange, data.rank), await _run2();
}
async function runHc1t(config, pushData) {
let logger = await _chunkZLR4PK5Acjs.createLogger.call(void 0, { pushData }), { $ } = await init(config, { logger });
return await hc1tTask($);
}
function b64ToStr(b64) {
return typeof b64 != "string" ? String(b64) : b64 && b64.startsWith("M") ? Buffer.from(b64, "base64").toString("utf-8") : b64;
}
async function saveInviter(inviter, phone) {
if (!inviter) return;
let used = await storage.getItem(DB_KEY) || {}, today = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN"), { time, value } = used[phone] || { time: today, value: [] };
time === today ? (value.push(inviter), used[phone] = { time, value }) : used[phone] = { time: today, value: [inviter] }, await storage.setItem(DB_KEY, used);
}
async function getSavedInviter(phone) {
let used = await storage.getItem(DB_KEY) || {}, time = (/* @__PURE__ */ new Date()).toLocaleDateString("zh-CN");
return used[phone] && used[phone].time === time ? used[phone].value : [];
}
async function getInviter(inviters, phone) {
let savedInviters = await getSavedInviter(phone), _inviters = inviters.filter((iStr) => !savedInviters.includes(iStr) && iStr !== phone);
return _inviters.length === 0 ? "" : _inviters[_crypto.randomInt.call(void 0, 0, _inviters.length)];
}
// index.ts
async function main(userConfig, option) {
let { $, logger, jwtToken } = await init(userConfig, option);
if (!jwtToken) return { $, isNoLogin: !0 };
await _chunkZLR4PK5Acjs.run.call(void 0, $);
let newAuth = await _chunkZLR4PK5Acjs.createNewAuth.call(void 0, $);
return logger.info(`==============
`), { newAuth, $ };
}
async function getConfig(inputPath) {
return _chunkZLR4PK5Acjs.isUndefined.call(void 0, inputPath) || _chunkZLR4PK5Acjs.isString.call(void 0, inputPath) ? await loadConfig(inputPath) : inputPath;
}
async function run2(inputPath) {
let { config, path, message } = await getConfig(inputPath), pushData = [
{ level: 3, type: "info", date: /* @__PURE__ */ new Date(), msg: "文档地址:https://as.js.cool" }
], logger = await _chunkZLR4PK5Acjs.createLogger.call(void 0, { pushData });
if (pushData.push({ level: 3, type: "info", date: /* @__PURE__ */ new Date(), msg: "当前版本 0.5.11-rc.1" }), !config || !config.length) return logger.error("未找到配置文件/变量");
let { expiredAuth } = await _run(config, logger, path);
await pushExpiredAuth(expiredAuth, message), await pushMessage2({
pushData,
message
});
}
async function pushExpiredAuth(expiredAuth, message) {
expiredAuth.length && await pushMessage2({
pushData: [
{ level: 0, type: "error", date: /* @__PURE__ */ new Date(), msg: "存在账号过期,请重新登录" },
...expiredAuth.map((i) => ({ level: 3, type: "info", date: /* @__PURE__ */ new Date(), msg: i }))
],
message: {
...message,
title: "账号过期推送"
}
});
}
async function _run(config, logger, path) {
let expiredAuth = [];
for (let index = 0; index < config.length; index++) {
let userConfig = config[index];
if (!userConfig.auth) {
logger.error("该配置中不存在 auth");
continue;
}
try {
let { newAuth, $, isNoLogin } = await main(userConfig, { logger });
if (isNoLogin) {
expiredAuth.push(_optionalChain([$, 'optionalAccess', _17 => _17.config, 'optionalAccess', _18 => _18.phone]));
continue;
}
newAuth && _conf.rewriteConfigSync.call(void 0, path, ["caiyun", index, "auth"], newAuth);
} catch (error) {
logger.error(error);
}
}
return {
expiredAuth
};
}
exports._run = _run; exports.createLogger = _chunkZLR4PK5Acjs.createLogger; exports.getConfig = getConfig; exports.init = init; exports.loadConfig = loadConfig; exports.main = main; exports.pushExpiredAuth = pushExpiredAuth; exports.pushMessage = pushMessage2; exports.run = run2; exports.runHc1t = runHc1t; exports.sleep = _chunkZLR4PK5Acjs.sleep; exports.useExchange = useExchange; exports.useMultiExchange = useMultiExchange;