mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
revert: 再也不用umami了
This commit is contained in:
@@ -106,23 +106,39 @@ export class UmamiTraceCore {
|
||||
"Host": "umami.napneko.icu",
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": this.ua,
|
||||
...(this.cache ? { 'x-umami-cache': this.cache } : {})
|
||||
...(this.cache ? { 'x-umami-cache': this.filterInvalidChars(this.cache) } : {})
|
||||
}
|
||||
};
|
||||
|
||||
const request = https.request(options, (res) => {
|
||||
res.on('error', (error) => {
|
||||
|
||||
try {
|
||||
const request = https.request(options, (res) => {
|
||||
let responseData = '';
|
||||
|
||||
res.on('data', (chunk) => {
|
||||
responseData += chunk;
|
||||
});
|
||||
|
||||
res.on('end', () => {
|
||||
if (!this.cache) {
|
||||
this.cache = responseData;
|
||||
console.log('Umami cache:', this.cache);
|
||||
}
|
||||
});
|
||||
|
||||
res.on('error', (error) => {
|
||||
});
|
||||
});
|
||||
res.on('data', (data) => {
|
||||
if (!this.cache) {
|
||||
this.cache = data.toString();
|
||||
}
|
||||
|
||||
request.on('error', (error) => {
|
||||
});
|
||||
}).on('error', () => { });
|
||||
|
||||
request.write(JSON.stringify({ type, payload }));
|
||||
request.end();
|
||||
|
||||
request.write(JSON.stringify({ type, payload }));
|
||||
request.end();
|
||||
} catch (error) {
|
||||
}
|
||||
}
|
||||
|
||||
filterInvalidChars(value: string): string {
|
||||
return value.replace(/[^\x00-\x7F]/g, '');
|
||||
}
|
||||
|
||||
startHeartbeat() {
|
||||
|
@@ -30,7 +30,6 @@ import os from 'node:os';
|
||||
import { NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/core/listeners';
|
||||
import { proxiedListenerOf } from '@/common/proxy-handler';
|
||||
import { NTQQPacketApi } from './apis/packet';
|
||||
import { UmamiTrace } from '@/common/umami';
|
||||
export * from './wrapper';
|
||||
export * from './types';
|
||||
export * from './services';
|
||||
@@ -155,11 +154,6 @@ export class NapCatCore {
|
||||
const msgListener = new NodeIKernelMsgListener();
|
||||
|
||||
msgListener.onKickedOffLine = (Info: KickedOffLineInfo) => {
|
||||
if (this.context.workingEnv === NapCatCoreWorkingEnv.Framework) {
|
||||
UmamiTrace.sendTrace('event/kickoff');
|
||||
} else {
|
||||
UmamiTrace.sendTrace('event/kickoff');
|
||||
}
|
||||
// 下线通知
|
||||
this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc);
|
||||
this.selfInfo.online = false;
|
||||
|
@@ -9,7 +9,6 @@ import { NodeIKernelLoginService } from '@/core/services';
|
||||
import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper';
|
||||
import { InitWebUi, WebUiConfig } from '@/webui';
|
||||
import { NapCatOneBot11Adapter } from '@/onebot';
|
||||
import { UmamiTrace } from '@/common/umami';
|
||||
|
||||
//Framework ES入口文件
|
||||
export async function getWebUiUrl() {
|
||||
@@ -26,7 +25,6 @@ export async function NCoreInitFramework(
|
||||
console.log('NapCat Framework App Loading...');
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
UmamiTrace.sendTrace('uncaught/error', err.message);
|
||||
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
|
||||
});
|
||||
|
||||
@@ -38,10 +36,6 @@ export async function NCoreInitFramework(
|
||||
const logger = new LogWrapper(pathWrapper.logsPath);
|
||||
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
|
||||
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
|
||||
let guid = loginService.getMachineGuid();
|
||||
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();
|
||||
|
@@ -29,11 +29,9 @@ import { InitWebUi } from '@/webui';
|
||||
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
||||
import { napCatVersion } from '@/common/version';
|
||||
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
|
||||
import { UmamiTrace } from '@/common/umami';
|
||||
// NapCat Shell App ES 入口文件
|
||||
async function handleUncaughtExceptions(logger: LogWrapper) {
|
||||
process.on('uncaughtException', (err) => {
|
||||
UmamiTrace.sendTrace('uncaught/error', err.message);
|
||||
logger.logError('[NapCat] [Error] Unhandled Exception:', err.message);
|
||||
});
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
@@ -153,7 +151,6 @@ async function handleLogin(
|
||||
};
|
||||
|
||||
loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => {
|
||||
UmamiTrace.sendTrace('qrlogin/error', [errType, errCode, errMsg].toString());
|
||||
if (!isLogined) {
|
||||
logger.logError('[Core] [Login] Login Error,ErrType: ', errType, ' ErrCode:', errCode);
|
||||
if (errType == 1 && errCode == 3) {
|
||||
@@ -164,7 +161,6 @@ async function handleLogin(
|
||||
};
|
||||
|
||||
loginListener.onLoginFailed = (...args) => {
|
||||
UmamiTrace.sendTrace('login/error', args.toString());
|
||||
logger.logError('[Core] [Login] Login Error , ErrInfo: ', JSON.stringify(args));
|
||||
};
|
||||
|
||||
@@ -298,10 +294,7 @@ export async function NCoreInitShell() {
|
||||
|
||||
const dataTimestape = new Date().getTime().toString();
|
||||
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
||||
UmamiTrace.init(basicInfoWrapper.getFullQQVesion(), loginService.getMachineGuid(), 'shell');
|
||||
UmamiTrace.sendTrace('boot/init');
|
||||
const selfInfo = await handleLogin(loginService, logger, pathWrapper, quickLoginUin, historyLoginList);
|
||||
UmamiTrace.sendTrace('login/success');
|
||||
const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
||||
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
||||
|
||||
|
Reference in New Issue
Block a user