Compare commits

...

8 Commits

Author SHA1 Message Date
手瓜一十雪
4000b89644 fix 2024-12-30 17:53:05 +08:00
Mlikiowa
9c00bbc0b7 release: v4.2.56 2024-12-30 08:55:36 +00:00
手瓜一十雪
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
7 changed files with 26 additions and 23 deletions

View File

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

View File

@@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "4.2.51", "version": "4.2.56",
"scripts": { "scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1", "build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || 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'; qqversion = '1.0.0';
guid = 'default-user'; guid = 'default-user';
heartbeatInterval: NodeJS.Timeout | null = null; 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/'; referrer: string = 'https://trace.napneko.icu/';
hostname: string = 'trace.napneko.icu'; hostname: string = 'trace.napneko.icu';
ua: string = ''; ua: string = '';
workname: string = 'default';
init(qqversion: string, guid: string) { init(qqversion: string, guid: string, workname: string) {
this.qqversion = qqversion; this.qqversion = qqversion;
this.workname = workname;
let UaList = { 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', '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', '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 = { const data = {
napcat_version: this.napcatVersion, napcat_version: this.napcatVersion,
qq_version: this.qqversion, qq_version: this.qqversion,
guid: guid guid: guid,
workname: this.workname,
}; };
this.sendRequest({ website: this.website, ...data }, 'identify'); this.sendRequest({ website: this.website, ...data }, 'identify');
} }
@@ -55,20 +57,21 @@ export class UmamiTraceCore {
hostname: this.hostname, hostname: this.hostname,
referrer: this.referrer, referrer: this.referrer,
website: this.website, website: this.website,
language: language || 'es-US', language: language || 'en-US',
napcat_version: this.napcatVersion, napcat_version: this.napcatVersion,
qq_version: this.qqversion, qq_version: this.qqversion,
workname: this.workname,
...data ...data
}; };
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}/${this.workname}/${eventName}` + (!!data ? `/${data}` : ''),
referrer: this.referrer, referrer: this.referrer,
}; };
this.sendRequest(payload); this.sendRequest(payload);
@@ -108,7 +111,7 @@ export class UmamiTraceCore {
this.sendEvent('heartbeat', { this.sendEvent('heartbeat', {
title: 'NapCat ' + this.napcatVersion, title: 'NapCat ' + this.napcatVersion,
language: process.env.LANG || 'en-US', language: process.env.LANG || 'en-US',
url: `/${this.qqversion}/${this.napcatVersion}/heartbeat`, url: `/${this.qqversion}/${this.napcatVersion}/${this.workname}/heartbeat`,
version: this.napcatVersion, version: this.napcatVersion,
qq_version: this.qqversion, qq_version: this.qqversion,
user_id: this.guid user_id: this.guid

View File

@@ -1 +1 @@
export const napCatVersion = '4.2.51'; export const napCatVersion = '4.2.56';

View File

@@ -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('event/kickoff');
} else { } else {
UmamiTrace.sendEvent('shell/kickoff'); UmamiTrace.sendTrace('event/kickoff');
} }
// 下线通知 // 下线通知
this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc); 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...'); console.log('NapCat Framework App Loading...');
process.on('uncaughtException', (err) => { 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); console.log('[NapCat] [Error] Unhandled Exception:', err.message);
}); });
@@ -39,9 +39,9 @@ export async function NCoreInitFramework(
const basicInfoWrapper = new QQBasicInfoWrapper({ logger }); const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
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,'framework');
UmamiTrace.sendTrace('framework/boot'); UmamiTrace.sendTrace('boot/init');
UmamiTrace.sendEvent('framework/login'); UmamiTrace.sendTrace('login/success');
//直到登录成功后,执行下一步 //直到登录成功后,执行下一步
const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => { const selfInfo = await new Promise<SelfInfo>((resolveSelfInfo) => {
const loginListener = new NodeIKernelLoginListener(); const loginListener = new NodeIKernelLoginListener();

View File

@@ -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('uncaught/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('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('login/error', args.toString());
logger.logError('[Core] [Login] Login Error , ErrInfo: ', 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(); 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(), 'shell');
UmamiTrace.sendTrace('shell/boot'); UmamiTrace.sendTrace('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('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')));