mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: trace
This commit is contained in:
@@ -63,12 +63,12 @@ export class UmamiTraceCore {
|
|||||||
this.sendRequest(payload);
|
this.sendRequest(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendTrace(eventName: string) {
|
sendTrace(eventName: string, data: string = '') {
|
||||||
const payload = {
|
const payload = {
|
||||||
website: this.website,
|
website: this.website,
|
||||||
hostname: this.hostname,
|
hostname: this.hostname,
|
||||||
title: 'NapCat ' + this.napcatVersion,
|
title: 'NapCat ' + this.napcatVersion,
|
||||||
url: `/${this.qqversion}/${this.napcatVersion}/${eventName}`,
|
url: `/${this.qqversion}/${this.napcatVersion}/${eventName}` + (!!data ? `?data=${data}` : ''),
|
||||||
referrer: this.referrer,
|
referrer: this.referrer,
|
||||||
};
|
};
|
||||||
this.sendRequest(payload);
|
this.sendRequest(payload);
|
||||||
|
@@ -156,9 +156,9 @@ export class NapCatCore {
|
|||||||
|
|
||||||
msgListener.onKickedOffLine = (Info: KickedOffLineInfo) => {
|
msgListener.onKickedOffLine = (Info: KickedOffLineInfo) => {
|
||||||
if (this.context.workingEnv === NapCatCoreWorkingEnv.Framework) {
|
if (this.context.workingEnv === NapCatCoreWorkingEnv.Framework) {
|
||||||
UmamiTrace.sendEvent('framework/kickoff');
|
UmamiTrace.sendTrace('framework/kickoff');
|
||||||
} else {
|
} else {
|
||||||
UmamiTrace.sendEvent('shell/kickoff');
|
UmamiTrace.sendTrace('shell/kickoff');
|
||||||
}
|
}
|
||||||
// 下线通知
|
// 下线通知
|
||||||
this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc);
|
this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc);
|
||||||
|
@@ -26,7 +26,7 @@ export async function NCoreInitFramework(
|
|||||||
console.log('NapCat Framework App Loading...');
|
console.log('NapCat Framework App Loading...');
|
||||||
|
|
||||||
process.on('uncaughtException', (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
UmamiTrace.sendEvent('framework/error', { name: err.name });
|
UmamiTrace.sendTrace('framework/error', err.message);
|
||||||
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
|
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ export async function NCoreInitFramework(
|
|||||||
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
|
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
|
||||||
let guid = loginService.getMachineGuid();
|
let guid = loginService.getMachineGuid();
|
||||||
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), guid);
|
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), guid);
|
||||||
UmamiTrace.sendTrace('framework/boot');
|
UmamiTrace.sendTrace('framework/boot/init');
|
||||||
UmamiTrace.sendEvent('framework/login');
|
UmamiTrace.sendTrace('framework/login/success');
|
||||||
//直到登录成功后,执行下一步
|
//直到登录成功后,执行下一步
|
||||||
const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => {
|
const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => {
|
||||||
const loginListener = new NodeIKernelLoginListener();
|
const loginListener = new NodeIKernelLoginListener();
|
||||||
|
@@ -33,7 +33,7 @@ import { UmamiTrace } from '@/common/umami';
|
|||||||
// NapCat Shell App ES 入口文件
|
// NapCat Shell App ES 入口文件
|
||||||
async function handleUncaughtExceptions(logger: LogWrapper) {
|
async function handleUncaughtExceptions(logger: LogWrapper) {
|
||||||
process.on('uncaughtException', (err) => {
|
process.on('uncaughtException', (err) => {
|
||||||
UmamiTrace.sendEvent('framework/error', { name: err.name, message: err.message });
|
UmamiTrace.sendTrace('framework/error', err.message);
|
||||||
logger.logError('[NapCat] [Error] Unhandled Exception:', err.message);
|
logger.logError('[NapCat] [Error] Unhandled Exception:', err.message);
|
||||||
});
|
});
|
||||||
process.on('unhandledRejection', (reason, promise) => {
|
process.on('unhandledRejection', (reason, promise) => {
|
||||||
@@ -153,7 +153,7 @@ async function handleLogin(
|
|||||||
};
|
};
|
||||||
|
|
||||||
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
|
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
|
||||||
UmamiTrace.sendEvent('shell/qrlogin/error', { errType, errCode, errMsg });
|
UmamiTrace.sendTrace('shell/qrlogin/error?', [errType, errCode, errMsg].toString());
|
||||||
if (!isLogined) {
|
if (!isLogined) {
|
||||||
logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg);
|
logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg);
|
||||||
if (errType == 1 && errCode == 3) {
|
if (errType == 1 && errCode == 3) {
|
||||||
@@ -164,7 +164,7 @@ async function handleLogin(
|
|||||||
};
|
};
|
||||||
|
|
||||||
loginListener.onLoginFailed = (args) => {
|
loginListener.onLoginFailed = (args) => {
|
||||||
UmamiTrace.sendEvent('shell/login/error', { args });
|
UmamiTrace.sendTrace('shell/login/error', args.toString());
|
||||||
logger.logError('[Core] [Login] Login Error , ErrInfo: ', args.toString());
|
logger.logError('[Core] [Login] Login Error , ErrInfo: ', args.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -299,9 +299,9 @@ export async function NCoreInitShell() {
|
|||||||
const dataTimestape = new Date().getTime().toString();
|
const dataTimestape = new Date().getTime().toString();
|
||||||
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
||||||
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), loginService.getMachineGuid());
|
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), loginService.getMachineGuid());
|
||||||
UmamiTrace.sendTrace('shell/boot');
|
UmamiTrace.sendTrace('shell/boot/init');
|
||||||
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
|
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
|
||||||
UmamiTrace.sendEvent('shell/login');
|
UmamiTrace.sendTrace('shell/login/success');
|
||||||
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
||||||
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user