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', 'error',
'unix' 'unix'
], ],
'quotes': [
'error',
'single'
],
'semi': [ 'semi': [
'error', 'error',
'always' 'always'

View File

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

View File

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

View File

@ -17,5 +17,5 @@ export function proxyHandlerOf(logger: LogWrapper) {
} }
export function proxiedListenerOf<T extends object>(listener: T, 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 Process = require('process');
let os = require('os'); let os = require('os');
Process.dlopenOrig = Process.dlopen Process.dlopenOrig = Process.dlopen;
let proxyHandler = { let proxyHandler = {
get(target, prop, receiver) { get(target, prop, receiver) {
@ -22,22 +22,22 @@ let WrapperNodeApi = undefined;//NativeNpdeApi
let WrapperLoginService = undefined; let WrapperLoginService = undefined;
Process.dlopen = function (module, filename, flags = os.constants.dlopen.RTLD_LAZY) { 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) { for (let export_name in module.exports) {
module.exports[export_name] = new Proxy(module.exports[export_name], { module.exports[export_name] = new Proxy(module.exports[export_name], {
construct: (target, args, _newTarget) => { construct: (target, args, _newTarget) => {
let ret = new target(...args) let ret = new target(...args);
if (export_name === 'NodeIQQNTWrapperSession') WrapperSession = ret if (export_name === 'NodeIQQNTWrapperSession') WrapperSession = ret;
if (export_name === 'NodeIKernelLoginService') WrapperLoginService = ret if (export_name === 'NodeIKernelLoginService') WrapperLoginService = ret;
return ret return ret;
}, },
}) });
} }
if (filename.toLowerCase().indexOf('wrapper.node') != -1) { if (filename.toLowerCase().indexOf('wrapper.node') != -1) {
WrapperNodeApi = module.exports; WrapperNodeApi = module.exports;
} }
return dlopenRet; return dlopenRet;
} };
function getWrapperSession() { function getWrapperSession() {
return WrapperSession; return WrapperSession;
} }

View File

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