Compare commits

...

9 Commits

Author SHA1 Message Date
手瓜一十雪
a2989d3b38 fix:workname 2024-12-30 16:54:40 +08:00
Mlikiowa
fc731b60d5 release: v4.2.54 2024-12-30 08:47:57 +00:00
手瓜一十雪
193980dd4a fix: trace 2024-12-30 16:47:33 +08:00
Mlikiowa
73ea130e40 release: v4.2.53 2024-12-30 08:34:23 +00:00
手瓜一十雪
5667e6aaee fix 2024-12-30 16:34:01 +08:00
Mlikiowa
fbd626131d release: v4.2.52 2024-12-30 08:17:53 +00:00
手瓜一十雪
7b82444338 fix 2024-12-30 16:17:29 +08:00
Mlikiowa
8108b9f565 release: v4.2.51 2024-12-30 08:15:48 +00:00
手瓜一十雪
c6ddd00cd9 Merge pull request #675 from NapNeko/test
fix: 重写远程遥测
2024-12-30 16:14:48 +08:00
7 changed files with 27 additions and 23 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "4.2.50",
"version": "4.2.54",
"icon": "./logo.png",
"authors": [
{

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "4.2.50",
"version": "4.2.54",
"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",

View File

@@ -6,13 +6,14 @@ export class UmamiTraceCore {
qqversion = '1.0.0';
guid = 'default-user';
heartbeatInterval: NodeJS.Timeout | null = null;
website: string = '1fabb2b1-c3a3-4416-b1be-31e2cbdce978';
website: string = '596cbbb2-1740-4373-a807-cf3d0637bfa7';
referrer: string = 'https://trace.napneko.icu/';
hostname: string = 'trace.napneko.icu';
ua: string = '';
init(qqversion: string, guid: string) {
workname: string = 'default';
init(qqversion: string, guid: string, workname: string) {
this.qqversion = qqversion;
this.workname = workname;
let UaList = {
'linux': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/124.0.0.0 Safari/537.36 PTST/240508.140043',
'win32': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.2128.93 Safari/537.36',
@@ -42,7 +43,8 @@ export class UmamiTraceCore {
const data = {
napcat_version: this.napcatVersion,
qq_version: this.qqversion,
guid: guid
guid: guid,
workname: this.workname,
};
this.sendRequest({ website: this.website, ...data }, 'identify');
}
@@ -55,19 +57,21 @@ export class UmamiTraceCore {
hostname: this.hostname,
referrer: this.referrer,
website: this.website,
language: language || 'es-US',
language: language || 'en-US',
napcat_version: this.napcatVersion,
qq_version: this.qqversion,
workname: this.workname,
...data
};
this.sendRequest(payload);
}
sendTrace(eventName: string) {
sendTrace(eventName: string, data: string = '') {
const payload = {
website: this.website,
hostname: this.hostname,
title: 'NapCat ' + this.napcatVersion,
url: `/${this.qqversion}/${this.napcatVersion}/${eventName}`,
url: `/${this.qqversion}/${this.napcatVersion}/${this.workname}/${eventName}` + (!!data ? `?data=${data}` : ''),
referrer: this.referrer,
};
this.sendRequest(payload);
@@ -107,7 +111,7 @@ export class UmamiTraceCore {
this.sendEvent('heartbeat', {
title: 'NapCat ' + this.napcatVersion,
language: process.env.LANG || 'en-US',
url: `/${this.qqversion}/${this.napcatVersion}/heartbeat`,
url: `/${this.qqversion}/${this.napcatVersion}/${this.workname}/heartbeat`,
version: this.napcatVersion,
qq_version: this.qqversion,
user_id: this.guid

View File

@@ -1 +1 @@
export const napCatVersion = '4.2.50';
export const napCatVersion = '4.2.54';

View File

@@ -156,9 +156,9 @@ export class NapCatCore {
msgListener.onKickedOffLine = (Info: KickedOffLineInfo) => {
if (this.context.workingEnv === NapCatCoreWorkingEnv.Framework) {
UmamiTrace.sendEvent('framework/kickoff');
UmamiTrace.sendTrace('event/kickoff');
} else {
UmamiTrace.sendEvent('shell/kickoff');
UmamiTrace.sendTrace('event/kickoff');
}
// 下线通知
this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc);

View File

@@ -26,7 +26,7 @@ export async function NCoreInitFramework(
console.log('NapCat Framework App Loading...');
process.on('uncaughtException', (err) => {
UmamiTrace.sendEvent('framework/error', { name: err.name });
UmamiTrace.sendTrace('uncaught/error', err.message);
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
});
@@ -39,9 +39,9 @@ export async function NCoreInitFramework(
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
let guid = loginService.getMachineGuid();
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), guid);
UmamiTrace.sendTrace('framework/boot');
UmamiTrace.sendEvent('framework/login');
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), guid,'framework');
UmamiTrace.sendTrace('boot/init');
UmamiTrace.sendTrace('login/success');
//直到登录成功后,执行下一步
const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => {
const loginListener = new NodeIKernelLoginListener();

View File

@@ -33,7 +33,7 @@ import { UmamiTrace } from '@/common/umami';
// NapCat Shell App ES 入口文件
async function handleUncaughtExceptions(logger: LogWrapper) {
process.on('uncaughtException', (err) => {
UmamiTrace.sendEvent('framework/error', { name: err.name, message: err.message });
UmamiTrace.sendTrace('uncaught/error', err.message);
logger.logError('[NapCat] [Error] Unhandled Exception:', err.message);
});
process.on('unhandledRejection', (reason, promise) => {
@@ -153,7 +153,7 @@ async function handleLogin(
};
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
UmamiTrace.sendEvent('shell/qrlogin/error', { errType, errCode, errMsg });
UmamiTrace.sendTrace('qrlogin/error', [errType, errCode, errMsg].toString());
if (!isLogined) {
logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg);
if (errType == 1 && errCode == 3) {
@@ -164,7 +164,7 @@ async function handleLogin(
};
loginListener.onLoginFailed = (args) => {
UmamiTrace.sendEvent('shell/login/error', { args });
UmamiTrace.sendTrace('login/error', args.toString());
logger.logError('[Core] [Login] Login Error , ErrInfo: ', args.toString());
};
@@ -298,10 +298,10 @@ export async function NCoreInitShell() {
const dataTimestape = new Date().getTime().toString();
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), loginService.getMachineGuid());
UmamiTrace.sendTrace('shell/boot');
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), loginService.getMachineGuid(), 'shell');
UmamiTrace.sendTrace('boot/init');
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
UmamiTrace.sendEvent('shell/login');
UmamiTrace.sendTrace('login/success');
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));