Compare commits

...
3 Commits
Author SHA1 Message Date
手瓜一十雪 eaf481799d feat: 追踪退出
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
2024-12-29 15:44:37 +08:00
手瓜一十雪 1f72863aba fix: 追踪登录失败 2024-12-29 15:25:51 +08:00
Mlikiowa 6b353fd8d8 release: v4.2.44 2024-12-29 06:45:43 +00:00
6 changed files with 32 additions and 12 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.2.43",
"version": "4.2.44",
"icon": "./logo.png",
"authors": [
{
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.2.43",
"version": "4.2.44",
"scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || exit 1",
+13 -5
View File
@@ -2,17 +2,25 @@ import https from 'node:https';
import { napCatVersion } from './version';
export class umamiTrace {
static napcatVersion = napCatVersion;
static qqversion = '1.0.0';
static init(qqversion: string) {
this.qqversion = qqversion;
setInterval(() => {
this.trackEvent('heartbeat');
}, 5 * 60 * 1000);
}
static trackEvent(eventName: string, info?: string) {
const StatesData = {
type: 'event',
payload: {
'website': '596cbbb2-1740-4373-a807-cf3d0637bfa7',
'hostname': 'trace.napneko.icu',
'language': process.env.LANG || 'en-US',
'title': 'NapCat ' + napCatVersion,
'url': '/' + napCatVersion + '/' + eventName,
'referrer': 'https://trace.napneko.icu/' + napCatVersion,
'info': info
'title': 'NapCat ' + umamiTrace.napcatVersion,
'url': '/' + umamiTrace.qqversion + '/' + umamiTrace.napcatVersion + '/' + eventName,
'referrer': 'https://napcat.onebot.napneko.icu/' + umamiTrace.qqversion + '/' + umamiTrace.napcatVersion + '/' + info,
}
};
+1 -1
View File
@@ -1 +1 @@
export const napCatVersion = '4.2.43';
export const napCatVersion = '4.2.44';
+8 -1
View File
@@ -24,19 +24,26 @@ export async function NCoreInitFramework(
) {
//在进入本层前是否登录未进行判断
console.log('NapCat Framework App Loading...');
umamiTrace.trackEvent('framework/login');
process.on('uncaughtException', (err) => {
umamiTrace.trackEvent('framework/error', err.message);
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
});
process.on('unhandledRejection', (reason, promise) => {
console.log('[NapCat] [Error] unhandledRejection:', reason);
});
process.on('exit', (code: number) => {
umamiTrace.trackEvent('framework/exit', code.toString());
});
const pathWrapper = new NapCatPathWrapper();
const logger = new LogWrapper(pathWrapper.logsPath);
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
umamiTrace.init(basicInfoWrapper.getFullQQVesion());
umamiTrace.trackEvent('framework/login');
//直到登录成功后,执行下一步
const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => {
const loginListener = new NodeIKernelLoginListener();
+8 -3
View File
@@ -153,6 +153,7 @@ async function handleLogin(
};
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
umamiTrace.trackEvent('shell/login/error/' + errType.toString() + '-' + errCode.toString(), errMsg);
if (!isLogined) {
logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg);
if (errType == 1 && errCode == 3) {
@@ -163,7 +164,8 @@ async function handleLogin(
};
loginListener.onLoginFailed = (args) => {
logger.logError('[Core] [Login] Login Error , ErrInfo: ', args);
umamiTrace.trackEvent('shell/login/error/' + args.toString(), args.toString());
logger.logError('[Core] [Login] Login Error , ErrInfo: ', args.toString());
};
loginService.addKernelLoginListener(proxiedListenerOf(loginListener, logger));
@@ -268,10 +270,13 @@ export async function NCoreInitShell() {
const pathWrapper = new NapCatPathWrapper();
const logger = new LogWrapper(pathWrapper.logsPath);
handleUncaughtExceptions(logger);
umamiTrace.trackEvent('shell/boot');
process.on('exit', (code: number) => {
umamiTrace.trackEvent('framework/exit', code.toString());
});
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
umamiTrace.init(basicInfoWrapper.getFullQQVesion());
umamiTrace.trackEvent('shell/boot');
const o3Service = wrapper.NodeIO3MiscService.get();
o3Service.addO3MiscListener(new NodeIO3MiscListener());