Skip to content

Split any YouTube song into stems

TypeScript

telemetry: single ping per install instead of daily

Daniel Ravinae673419f5e58
diff --git a/README.md b/README.md
index 10d8b73..607973e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Split any YouTube song into isolated stems — **vocals, drums, bass, guitar, pi
Search YouTube or paste a link, pick the instruments you want, and play the result like a mini DAW: the video on one side, every stem on its own fader, all perfectly in sync. Karaoke, acapellas and instrumentals are one click away.
-Everything runs locally — no accounts, no API keys. Your songs, searches and audio never leave your machine. The app sends one tiny anonymous ping per day (a random install id + version/OS) so I can count how many people use it — see [Privacy](#privacy) for details.
+Everything runs locally — no accounts, no API keys. Your songs, searches and audio never leave your machine. The app sends a single tiny anonymous ping per install (a random install id + version/OS) so I can count how many people use it — see [Privacy](#privacy) for details.
![platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-black) ![local](https://img.shields.io/badge/100%25-local-emerald)
@@ -108,7 +108,7 @@ video iframe (muted) + Web Audio stem playback · master clock = the audio itsel
## Privacy
- **Never leaves your machine:** the videos you download, the songs you split, your library, your searches and your audio — none of it is uploaded anywhere. All separation runs locally.
-- **Anonymous usage count:** on each launch the app sends one small POST to a Cloudflare Worker (`stemkit-stats.danielravina.workers.dev`) — at most once per day. It contains a **random install id** (generated locally, stored in the app's settings folder), the app version, OS and architecture. No IP-address-based profiles are built, no cookies, no identifiers tied to you, no analytics SDKs.
+- **Anonymous install count:** the first time the app runs it sends one small POST to a Cloudflare Worker (`stemkit-stats.danielravina.workers.dev`) — once per install, ever. It contains a **random install id** (generated locally, stored in the app's settings folder), the app version, OS and architecture. No IP-address-based profiles are built, no cookies, no identifiers tied to you, no analytics SDKs. If the first attempt fails (e.g. you're offline), it simply retries on a later launch.
- **What it's for:** counting installs and active usage (the same stats you'd get from GitHub release downloads, minus auto-update noise). The counter code is in [`telemetry-worker/`](telemetry-worker) — inspectable like the rest of the app.
- **Fully offline builds:** if you'd rather send nothing, build from source and remove `src/main/telemetry.ts` (or block the worker domain in your firewall) — everything else works identically offline.
diff --git a/src/main/telemetry.ts b/src/main/telemetry.ts
index 7b759fa..24fc822 100644
--- a/src/main/telemetry.ts
+++ b/src/main/telemetry.ts
@@ -4,19 +4,16 @@ import { join } from 'path'
import { app, net } from 'electron'
import { userDataDir } from './env'
-/* anonymous usage heartbeat: one small POST per install per day (first launch,
- then once every 24h). Payload is a random install id plus version/os/arch —
- nothing that identifies the machine or user. The endpoint is a Cloudflare
- Worker (telemetry-worker/ in this repo); STEMKIT_TELEMETRY_URL overrides it
- for testing without a rebuild. */
+/* anonymous install counter: one small POST per install, ever. Payload is a
+ random install id plus version/os/arch — nothing that identifies the
+ machine or user. The endpoint is a Cloudflare Worker (telemetry-worker/ in
+ this repo); STEMKIT_TELEMETRY_URL overrides it for testing. */
const TELEMETRY_URL =
(process.env.STEMKIT_TELEMETRY_URL || 'https://stemkit-stats.danielravina.workers.dev') + '/ping'
-const DAY_MS = 24 * 60 * 60 * 1000
-
interface TelemetryState {
installId: string
- lastPing: number
+ done: boolean
}
function stateFile(): string {
@@ -27,10 +24,11 @@ function loadState(): TelemetryState {
try {
const data = JSON.parse(readFileSync(stateFile(), 'utf8'))
if (typeof data.installId === 'string' && data.installId) {
- return { installId: data.installId, lastPing: Number(data.lastPing) || 0 }
+ // 0.1.21 stored lastPing for its daily pings; a past ping counts as done
+ return { installId: data.installId, done: !!(data.done || data.lastPing) }
}
} catch {}
- return { installId: randomUUID(), lastPing: 0 }
+ return { installId: randomUUID(), done: false }
}
function saveState(state: TelemetryState): void {
@@ -44,7 +42,7 @@ function saveState(state: TelemetryState): void {
export function maybePing(): void {
if (!app.isPackaged) return
const state = loadState()
- if (Date.now() - state.lastPing < DAY_MS) return
+ if (state.done) return
const payload = JSON.stringify({
id: state.installId,
@@ -59,11 +57,11 @@ export function maybePing(): void {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
})
- // remember the ping only once the server confirmed it, so offline launches
- // retry on the next open instead of silently dropping
+ // mark done only once the server confirmed it, so an offline first launch
+ // retries on the next open instead of never being counted
req.on('response', (res) => {
if (res.statusCode >= 200 && res.statusCode < 300) {
- saveState({ ...state, lastPing: Date.now() })
+ saveState({ ...state, done: true })
}
})
req.on('error', () => {})
diff --git a/telemetry-worker/stats.sh b/telemetry-worker/stats.sh
index 8100e75..c57788d 100755
--- a/telemetry-worker/stats.sh
+++ b/telemetry-worker/stats.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Live install stats from the telemetry worker.
+# Install stats from the telemetry worker (one ping per install, ever).
# Token is read from STEMKIT_STATS_TOKEN, or from .stats-token next to this script.
set -euo pipefail
@@ -23,17 +23,13 @@ import json, sys
d = json.load(sys.stdin)
daily = d.get("daily", [])
total = d["totalInstalls"]
-dau = sum(x["active"] for x in daily[-1:])
-wau = max(x["active"] for x in daily[-7:]) if daily else 0
print(f"total installs : {total}")
-print(f"active today : {dau}")
-print(f"active (7d max): {wau}")
print("per OS :", ", ".join(f"{k} {v}" for k, v in d.get("os", {}).items()) or "-")
print("per version :", ", ".join(f"{k} {v}" for k, v in sorted(d.get("versions", {}).items())) or "-")
print()
-print("last 14 days (date active new)")
+print("installs per day (last 14)")
for x in daily[-14:]:
- date, active, new = x["date"], x["active"], x["new"]
- print(f" {date} {active:>6} {new:>5}")
+ date, fresh = x["date"], x["new"]
+ print(f" {date} {fresh:>6}")
'
diff --git a/website/index.html b/website/index.html
index 0eff1f5..cf66e7a 100644
--- a/website/index.html
+++ b/website/index.html
@@ -363,7 +363,7 @@
<div class="req"><b>First launch</b><span>StemKit sets up its own engine, about 2GB, one time. Nothing to install by hand.</span></div>
<div class="req"><b>Disk space</b><span>About 2GB, downloaded once during setup.</span></div>
<div class="req"><b>Internet</b><span>Needed to fetch songs from YouTube and for the one-time setup.</span></div>
- <div class="req"><b>Privacy</b><span>Your songs and audio never leave your machine. The app sends one anonymous ping per day (random id + version/OS) to count installs — nothing else.</span></div>
+ <div class="req"><b>Privacy</b><span>Your songs and audio never leave your machine. The app sends a single anonymous ping per install (random id + version/OS) to count installs — nothing else.</span></div>
</div>
</section>