TGViewer
Apple Plugins Apple Plugins @appleplugins · 1.67K subscribers
Post #281 2.69K
I’ve been thinking about adding something like this for a while, but I always wanted it to be done in a transparent way.

That’s why I’m explaining it upfront and posting the full code here. The entire plugin code is public, and this usage counter code is literally all there is. Nothing more happens behind the scenes.

This is just a very simple counter to know how many people are using the plugin. There’s no tracking logic, no logs and no data collection.

The usage counter will also be optional. You’ll be able to disable it in the plugin settings if you don’t want it enabled. It’s not required to use the plugin.

> Cloudflare handles IPs at the infrastructure level, like any HTTPS request, but this worker itself has no access to that information.

I’m adding this to Translatica and I’d really like to hear your thoughts or feedback before moving forward.

export default {
async fetch(request, env) {

// Only POST is expected here
if (request.method !== "POST") {
return new Response("ok");
}

// Simple shared key check
const pluginKey = request.headers.get("X-Plugin-Key");
if (pluginKey !== env.PLUGIN_KEY) {
return new Response("forbidden", { status: 403 });
}

// Read current value
let total = await env.STATS.get("translatica");
total = Number(total ?? 0);

// Increment and store
await env.STATS.put("translatica", String(total + 1));

return new Response("ok");
}
};


Join: @CommunityByApple
  • 👏 10
  • 👍 1
  • 🙏 1
More from @appleplugins
  1. Aug 15, 2026Nowfy Lite | v1.0.0
  2. Aug 15, 2026Nowfy Lite | v1.0.0 First Release Nowfy Lite works with every music streaming app | Nowfy…
  3. Aug 13, 2026👀
  4. Jun 28, 2026Возможно, вы задаётесь вопросом: где обновления плагинов и новые плагины? Сейчас у меня не…
  5. May 31, 2026EN 🔽 I forgot to mention something I consider very important. I'm now part of the develop…
  6. May 23, 2026Nowfy Lite, a quick preview: Profilefy feature How does it work? | Как это работает? When…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →