This commit is contained in:
Rohid
2024-08-15 22:31:31 +06:00
parent fce2c9cc50
commit 1faf392581

View File

@@ -170,6 +170,7 @@ class WakaTimeCore {
if (!contains(url, items.blacklist as string)) { if (!contains(url, items.blacklist as string)) {
await this.sendHeartbeat( await this.sendHeartbeat(
{ {
branch: null,
hostname: items.hostname as string, hostname: items.hostname as string,
project, project,
url, url,
@@ -189,6 +190,7 @@ class WakaTimeCore {
await this.sendHeartbeat( await this.sendHeartbeat(
{ {
...heartbeat, ...heartbeat,
branch: null,
hostname: items.hostname as string, hostname: items.hostname as string,
project: heartbeat.project ?? project, project: heartbeat.project ?? project,
}, },
@@ -340,12 +342,12 @@ class WakaTimeCore {
let userAgent; let userAgent;
if (IS_FIREFOX) { if (IS_FIREFOX) {
browserName = 'firefox'; browserName = 'firefox';
userAgent = navigator.userAgent.match(/Firefox\/\S+/g)![0]; userAgent = navigator.userAgent.match(/Firefox\/\S+/g)?.[0];
} else if (IS_EDGE) { } else if (IS_EDGE) {
browserName = 'edge'; browserName = 'edge';
userAgent = navigator.userAgent; userAgent = navigator.userAgent;
} else { } else {
userAgent = navigator.userAgent.match(/Chrome\/\S+/g)![0]; userAgent = navigator.userAgent.match(/Chrome\/\S+/g)?.[0];
} }
const payload: Record<string, unknown> = { const payload: Record<string, unknown> = {
entity: heartbeat.url, entity: heartbeat.url,