Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
feat: add Hono auth middleware that verifies Supabase JWT and sets userId on context
valzor1bf5d3df99f0
diff --git a/backend/middleware/auth.js b/backend/middleware/auth.jsnew file mode 100644index 0000000..73e441d--- /dev/null+++ b/backend/middleware/auth.js@@ -0,0 +1,12 @@+import { getSupabaseAuth } from '../lib/supabase.js';++export async function requireAuth(c, next) {+ const token = c.req.header('Authorization')?.replace('Bearer ', '');+ if (!token) return c.json({ error: 'Unauthorized' }, 401);+ const supabaseAuth = getSupabaseAuth(c.env);+ const { data: { user }, error } = await supabaseAuth.auth.getUser(token);+ if (error || !user) return c.json({ error: 'Invalid or expired token' }, 401);+ c.set('userId', user.id);+ c.set('userEmail', user.email);+ await next();+}