diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index dabf53e..f26ecaa 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -6,8 +6,8 @@ We are currently migrating from using [gulp](https://gulpjs.com/) -> [webpack](h ## Pre-requisites -- node v11.15.0 -- npm 6.7.0 +- node v18.13.0 +- npm 8.19.3 It is suggested you use [nvm](https://github.com/nvm-sh/nvm) to manage your node version @@ -22,7 +22,7 @@ In devmode you can open [local remote devtools](http://localhost:8000) ## Development instructions ``` - nvm use + nvm use 18 npm install npm run dev ``` diff --git a/HISTORY.rst b/HISTORY.rst index dbcd3f8..dfcc10e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,33 @@ History ------- +3.0.0 (2023-02-09) +++++++++++++++++++ + +- chore: send project on heartbeat when navigating on github + `#165 `_ +- chore: add social media toggle to track or not social sites + `#163 `_ +- implement service worker events + `#162 `_ +- chore: Chrome Manifest V2 to V3 migration + `#161 `_ +- chore: implements send Heartbeat functionality + `#160 `_ +- chore: move api key input to options view + `#159 `_ +- chore: update bootstrap to version 5 + `#158 `_ +- chore: implement options component + `#157 `_ +- chore: enable disable logging + `#156 `_ +- chore: implement new ts components + `#155 `_ +- chore: update dependencies + `#153 `_ + + 2.0.1 (2021-01-11) ++++++++++++++++++ diff --git a/manifest.json b/manifest.json index 72230cf..bdbb377 100644 --- a/manifest.json +++ b/manifest.json @@ -39,5 +39,5 @@ "storage", "idle" ], - "version": "2.0.1" + "version": "3.0.0" } diff --git a/src/core/WakaTimeCore.ts b/src/core/WakaTimeCore.ts index ce94194..2bed7d6 100644 --- a/src/core/WakaTimeCore.ts +++ b/src/core/WakaTimeCore.ts @@ -89,11 +89,15 @@ class WakaTimeCore { return changeExtensionState('blacklisted'); } } + + // Checks dev websites + const project = this.generateProjectFromDevSites(currentActiveTab.url as string); + if (items.loggingStyle == 'blacklist') { if (!contains(currentActiveTab.url as string, items.blacklist as string)) { await this.sendHeartbeat( { - project: null, + project, url: currentActiveTab.url as string, }, apiKey, @@ -110,7 +114,10 @@ class WakaTimeCore { items.whitelist as string, ); if (heartbeat.url) { - await this.sendHeartbeat(heartbeat, apiKey); + await this.sendHeartbeat( + { ...heartbeat, project: heartbeat.project ?? project }, + apiKey, + ); } else { await changeExtensionState('whitelisted'); console.log(`${currentActiveTab.url} is not on a whitelist.`); @@ -221,6 +228,17 @@ class WakaTimeCore { return items.loggingType; } + generateProjectFromDevSites(url: string): string | null { + const githubUrls = ['https://github.com/', 'https://github.dev/']; + for (const githubUrl of githubUrls) { + if (url.startsWith(githubUrl)) { + const newUrl = url.replace(githubUrl, ''); + return newUrl.split('/')[1] || null; + } + } + return null; + } + /** * Creates payload for the heartbeat and returns it as JSON. *