Don't send a heartbeat on sites like 'chrome://newtab/' or 'about:newtab'
This commit is contained in:
@@ -53,6 +53,10 @@ describe('wakatime config', () => {
|
|||||||
"loggingType": "domain",
|
"loggingType": "domain",
|
||||||
"logoutUserUrl": "https://wakatime.com/logout",
|
"logoutUserUrl": "https://wakatime.com/logout",
|
||||||
"name": "WakaTime",
|
"name": "WakaTime",
|
||||||
|
"nonTrackableSites": [
|
||||||
|
"chrome://",
|
||||||
|
"about:",
|
||||||
|
],
|
||||||
"socialMediaSites": [
|
"socialMediaSites": [
|
||||||
"facebook.com",
|
"facebook.com",
|
||||||
"instagram.com",
|
"instagram.com",
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export interface Config {
|
|||||||
* Extension name
|
* Extension name
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
nonTrackableSites: string[];
|
||||||
socialMediaSites: string[];
|
socialMediaSites: string[];
|
||||||
states: ApiStates[];
|
states: ApiStates[];
|
||||||
/**
|
/**
|
||||||
@@ -159,6 +160,8 @@ const config: Config = {
|
|||||||
|
|
||||||
name: 'WakaTime',
|
name: 'WakaTime',
|
||||||
|
|
||||||
|
nonTrackableSites: ['chrome://', 'about:'],
|
||||||
|
|
||||||
socialMediaSites: [
|
socialMediaSites: [
|
||||||
'facebook.com',
|
'facebook.com',
|
||||||
'instagram.com',
|
'instagram.com',
|
||||||
|
|||||||
@@ -149,6 +149,13 @@ class WakaTimeCore {
|
|||||||
url = document.URL;
|
url = document.URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const site of config.nonTrackableSites) {
|
||||||
|
if (url.startsWith(site)) {
|
||||||
|
// Don't send a heartbeat on sites like 'chrome://newtab/' or 'about:newtab'
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const hostname = getDomainFromUrlWithoutProtocol(url).replace('www.', '');
|
const hostname = getDomainFromUrlWithoutProtocol(url).replace('www.', '');
|
||||||
if (!items.trackSocialMedia) {
|
if (!items.trackSocialMedia) {
|
||||||
if ((items.socialMediaSites as string[]).includes(hostname)) {
|
if ((items.socialMediaSites as string[]).includes(hostname)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user