mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: cache trace
This commit is contained in:
@@ -12,6 +12,7 @@ export class UmamiTraceCore {
|
|||||||
ua: string = '';
|
ua: string = '';
|
||||||
workname: string = 'default';
|
workname: string = 'default';
|
||||||
bootTime = Date.now();
|
bootTime = Date.now();
|
||||||
|
cache: string = '';
|
||||||
init(qqversion: string, guid: string, workname: string) {
|
init(qqversion: string, guid: string, workname: string) {
|
||||||
this.qqversion = qqversion;
|
this.qqversion = qqversion;
|
||||||
this.workname = workname;
|
this.workname = workname;
|
||||||
@@ -101,7 +102,8 @@ export class UmamiTraceCore {
|
|||||||
headers: {
|
headers: {
|
||||||
"Host": "umami.napneko.icu",
|
"Host": "umami.napneko.icu",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"User-Agent": this.ua
|
"User-Agent": this.ua,
|
||||||
|
...(this.cache ? { 'x-umami-cache': this.cache } : {})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -110,9 +112,11 @@ export class UmamiTraceCore {
|
|||||||
|
|
||||||
});
|
});
|
||||||
res.on('data', (data) => {
|
res.on('data', (data) => {
|
||||||
|
if (!this.cache) {
|
||||||
|
this.cache = data.toString();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}).on('error', () => {} );
|
}).on('error', () => { });
|
||||||
|
|
||||||
request.write(JSON.stringify({ type, payload }));
|
request.write(JSON.stringify({ type, payload }));
|
||||||
request.end();
|
request.end();
|
||||||
|
Reference in New Issue
Block a user