chore: fix indentation and semi in files

This commit is contained in:
Wesley F. Young 2024-08-09 10:37:09 +08:00
parent 024faa2561
commit db4c5bc3a3
27 changed files with 1326 additions and 1330 deletions

View File

@ -50,10 +50,6 @@ module.exports = {
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'

View File

@ -72,7 +72,7 @@ export class NTEventChannel extends EventEmitter {
//const ListenerSubName = ListenerNameList[1];
this.getOrInitListener<ListenerType>(ListenerMainName);
let complete = 0;
let retData: Parameters<ListenerType> | undefined = undefined;
const retData: Parameters<ListenerType> | undefined = undefined;
let retEvent: any = {};
const databack = () => {
if (complete == 0) {
@ -82,7 +82,7 @@ export class NTEventChannel extends EventEmitter {
}
};
const Timeouter = setTimeout(databack, timeout);
let callback = (...args: Parameters<ListenerType>) => {
const callback = (...args: Parameters<ListenerType>) => {
if (checker(...args)) {
complete++;
if (complete >= waitTimes) {
@ -109,7 +109,7 @@ export class NTEventChannel extends EventEmitter {
//getNodeIKernelGroupListener,GroupService
//console.log('2', eventName);
const services = (this.wrapperSession as unknown as eventType)[serviceName]();
let event = services[eventName]
const event = services[eventName]
//重新绑定this
.bind(services);
if (event) {

View File

@ -29,7 +29,7 @@ export class QQBasicInfoWrapper {
? JSON.parse(fs.readFileSync(this.QQVersionConfigPath!).toString())
: getDefaultQQVersionConfigInfo();
this.QQPackageInfo = JSON.parse(fs.readFileSync(this.QQPackageInfoPath).toString());
let { appid: IQQVersionAppid, qua: IQQVersionQua } = this.getAppidV2();
const { appid: IQQVersionAppid, qua: IQQVersionQua } = this.getAppidV2();
this.QQVersionAppid = IQQVersionAppid;
this.QQVersionQua = IQQVersionQua;
}
@ -40,13 +40,13 @@ export class QQBasicInfoWrapper {
}
getFullQQVesion() {
let version = this.isQuickUpdate ? this.QQVersionConfig?.curVersion : this.QQPackageInfo?.version;
const version = this.isQuickUpdate ? this.QQVersionConfig?.curVersion : this.QQPackageInfo?.version;
if(!version) throw new Error("QQ版本获取失败");
return version;
}
requireMinNTQQBuild(buildStr: string) {
let currentBuild = parseInt(this.getQQBuildStr() || "0");
const currentBuild = parseInt(this.getQQBuildStr() || "0");
if (currentBuild == 0) throw new Error("QQBuildStr获取失败");
return currentBuild >= parseInt(buildStr);
}
@ -59,7 +59,7 @@ export class QQBasicInfoWrapper {
getAppidV2(): { appid: string; qua: string } {
const appidTbale = AppidTable as unknown as QQAppidTableType;
try {
let fullVersion = this.getFullQQVesion();
const fullVersion = this.getFullQQVesion();
if (!fullVersion) throw new Error("QQ版本获取失败");
const data = appidTbale[fullVersion];
if (data) {

View File

@ -17,5 +17,5 @@ export function proxyHandlerOf(logger: LogWrapper) {
}
export function proxiedListenerOf<T extends object>(listener: T, logger: LogWrapper) {
return new Proxy<T>(listener, proxyHandlerOf(logger))
return new Proxy<T>(listener, proxyHandlerOf(logger));
}

View File

@ -4,7 +4,7 @@ const CurrentPath = path.dirname(__filename);
let Process = require('process');
let os = require('os');
Process.dlopenOrig = Process.dlopen
Process.dlopenOrig = Process.dlopen;
let proxyHandler = {
get(target, prop, receiver) {
@ -22,22 +22,22 @@ let WrapperNodeApi = undefined;//NativeNpdeApi
let WrapperLoginService = undefined;
Process.dlopen = function (module, filename, flags = os.constants.dlopen.RTLD_LAZY) {
let dlopenRet = this.dlopenOrig(module, filename, flags)
let dlopenRet = this.dlopenOrig(module, filename, flags);
for (let export_name in module.exports) {
module.exports[export_name] = new Proxy(module.exports[export_name], {
construct: (target, args, _newTarget) => {
let ret = new target(...args)
if (export_name === 'NodeIQQNTWrapperSession') WrapperSession = ret
if (export_name === 'NodeIKernelLoginService') WrapperLoginService = ret
return ret
let ret = new target(...args);
if (export_name === 'NodeIQQNTWrapperSession') WrapperSession = ret;
if (export_name === 'NodeIKernelLoginService') WrapperLoginService = ret;
return ret;
},
})
});
}
if (filename.toLowerCase().indexOf('wrapper.node') != -1) {
WrapperNodeApi = module.exports;
}
return dlopenRet;
}
};
function getWrapperSession() {
return WrapperSession;
}

View File

@ -16,13 +16,13 @@ import { sleep } from "@/common/utils/helper";
export async function NCoreInitLiteLoader(session: NodeIQQNTWrapperSession, loginService: NodeIKernelLoginService) {
//在进入本层前是否登录未进行判断
console.log("NapCat LiteLoader App Loading...");
let pathWrapper = new NapCatPathWrapper();
let logger = new LogWrapper(pathWrapper.logsPath);
let basicInfoWrapper = new QQBasicInfoWrapper({ logger });
let wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
const pathWrapper = new NapCatPathWrapper();
const logger = new LogWrapper(pathWrapper.logsPath);
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
//直到登录成功后,执行下一步
let selfInfo = await new Promise<SelfInfo>((resolve) => {
let loginListener = new LoginListener();
const selfInfo = await new Promise<SelfInfo>((resolve) => {
const loginListener = new LoginListener();
loginListener.onQRCodeLoginSucceed = async (loginResult) => resolve({
uid: loginResult.uid,
uin: loginResult.uin,
@ -35,7 +35,7 @@ export async function NCoreInitLiteLoader(session: NodeIQQNTWrapperSession, logi
// 过早进入会导致addKernelMsgListener等Listener添加失败
await sleep(2500);
// 初始化 NapCatLiteLoader
let loaderObject = new NapCatLiteLoader(wrapper, session, logger, loginService, selfInfo, basicInfoWrapper);
const loaderObject = new NapCatLiteLoader(wrapper, session, logger, loginService, selfInfo, basicInfoWrapper);
//启动WebUi