yo this is a chrome extension that tracks your strudel.cc live coding sessions on hackatime
made for hackclub carnival btw
- tracks your edits on strudel.cc
- sends heartbeats to hackatime api
- shows your coding time on the hackatime dashboard
- queues beats when offline and retries later
- clone this repo
git clone https://github.com/xapqrt/strudel-hackatime.git
cd strudel-hackatime- install deps
npm install- build it
npm run build- load in chrome
- go to
chrome://extensions - turn on developer mode
- click "load unpacked"
- select the
strudel hackatimefolder
- get your api key
- go to https://hackatime.hackclub.com
- grab your api key from settings
- configure extension
- click extension icon
- paste api key
- done
uses codemirror 6 hooks to detect when you type or move cursor, sends heartbeats to hackatime every 30 seconds (wakatime spec), queues failed beats and retries later
had to inject a page script to access codemirror directly cuz content scripts cant see page context, promise based message passing between content and page script to get cursor position
- typescript
- esbuild for bundling
- chrome manifest v3
- codemirror 6 detection
- editor field shows "Unknown" on dashboard even tho we spam strudel everywhere
- tried user-agent modification, declarativeNetRequest, offscreen xhr, nothing works yet
- line numbers and cursor position work perfectly tho
background.ts- service worker, api calls, queue managementcontent.ts- injected into strudel.cc, hooks editorpage-script.ts- injected into page context, accesses codemirrortracker.ts- heartbeat creation logicmetadata.ts- extracts cursor position, line numberspopup.ts- extension popup uistorage.ts- chrome storage wrapperbuild.js- esbuild config
changed from tsc to esbuild bundling, bundles 5 files:
- background.js (esm module)
- content.js (iife)
- popup.js (iife)
- page-script.js (iife)
- offscreen.js (iife)
all imports changed to esm style with .js extensions
npm run buildthen reload extension in chrome
- perplexity helped w codemirror hooks
- josias for hackatime api docs
- fd for future help hopefully
cursor tracking: ✅ works
line numbers: ✅ works
editor name: ❌ shows "Unknown" (contacted fd)
aight thats it