Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
refactor: shorten comments and drop repeated test headers
spacesdriveff2aabf821f6
diff --git a/backend/lib/cache.js b/backend/lib/cache.jsindex e0233c4..86f8591 100644--- a/backend/lib/cache.js+++ b/backend/lib/cache.js@@ -4,7 +4,7 @@ export { createOAuthState, verifyOAuthState } from './oauthState.js';// stats change constantly, so cached analytics expire instead of going staleconst ANALYTICS_TTL_SECONDS = 6 * 60 * 60;-// bump when the cached shape changes so old entries miss (v2: hidden youtube counts are null)+// bump on cache shape changes so old entries miss (v2: hidden counts are null)const VIDEOS_CACHE_VERSION = 2;const IG_CACHE_VERSION = 2;diff --git a/backend/lib/crypto.js b/backend/lib/crypto.jsindex 37b30c1..b728680 100644--- a/backend/lib/crypto.js+++ b/backend/lib/crypto.js@@ -1,4 +1,4 @@-// web crypto only, no npm dependency; the key is 64 hex chars and output is "<iv_hex>:<cipher_hex>"+// web crypto, no npm dependency; 64 hex char key, output "<iv_hex>:<cipher_hex>"function hexToBuffer(hex) {const bytes = new Uint8Array(hex.length / 2);diff --git a/backend/lib/db.js b/backend/lib/db.jsindex 99409f1..99d0577 100644--- a/backend/lib/db.js+++ b/backend/lib/db.js@@ -1,4 +1,4 @@-// supabase comes first so crons can call these too; a null userId skips the user filter+// crons share these, so supabase is an argument; a null userId skips the filterexport async function getAccounts(supabase, userId = null) {let query = supabase.from('accounts').select('id, platform, data');if (userId) query = query.eq('user_id', userId);@@ -44,7 +44,7 @@ export async function deleteAccount(supabase, id, userId = null) {if (error) throw error;}-// settings rows are keyed by (user_id, key); every saved value lives under 'api_keys'+// rows are keyed by (user_id, key); every saved value lives under 'api_keys'const DEFAULT_KEYS = {};export async function getSettings(supabase, userId) {@@ -107,7 +107,7 @@ export async function getDuePosts(supabase) {return (data || []).map(rowToPost);}-// atomic pending to publishing; false means the worker cron or the github workflow got it first+// atomic pending to publishing; false means the cron or github workflow wonexport async function claimPost(supabase, id) {const { data, error } = await supabase.from('scheduled_posts')@@ -241,7 +241,7 @@ export async function updateTrackedPost(supabase, id, updates, userId) {if (error) throw error;}-// merges into data instead of replacing it, so manual fields survive a live refresh and vice versa+// merges into data so manual fields and live refresh fields survive each otherexport async function patchTrackedPostData(supabase, id, patch, userId) {const { data: row, error: readError } = await supabase.from('tracked_posts')diff --git a/backend/lib/safeAccount.js b/backend/lib/safeAccount.jsindex 4d8e3fc..2cad087 100644--- a/backend/lib/safeAccount.js+++ b/backend/lib/safeAccount.js@@ -1,4 +1,4 @@-// hasCookie lets the frontend show reddit session status without ever receiving the cookie+// hasCookie shows reddit session status without sending the cookieconst SECRET_FIELDS = ['accessToken', 'cookie', 'encryptedPassword', 'encryptedTotpSecret', 'authToken', 'ct0'];export function safeAccount(account) {diff --git a/backend/lib/supabase.js b/backend/lib/supabase.jsindex 17f93da..a207116 100644--- a/backend/lib/supabase.js+++ b/backend/lib/supabase.js@@ -4,7 +4,7 @@ function clean(s) {return s?.replace(/^/, '').trim();}-// workers reject the `cache` field on RequestInit, so it is dropped from supabase requests+// workers reject the `cache` RequestInit field, so supabase requests drop itfunction workerFetch(url, options = {}) {const { cache, ...rest } = options;return fetch(url, rest);diff --git a/backend/routes/instagramAuth.js b/backend/routes/instagramAuth.jsindex 2d8c6da..8833fb9 100644--- a/backend/routes/instagramAuth.js+++ b/backend/routes/instagramAuth.js@@ -3,7 +3,7 @@ import {readInstagramOAuthConfig, buildAuthorizationUrl, connectInstagramFromOAuth,} from '../services/instagramOAuth.js';-// GET /api/auth/instagram/url - protected; returns the url the frontend redirects to+// GET /api/auth/instagram/url - protected; returns the frontend redirect urlexport async function urlHandler(c) {try {const config = readInstagramOAuthConfig(c.env);@@ -17,7 +17,7 @@ export async function urlHandler(c) {}}-// GET /api/auth/instagram/callback - public browser redirect; the signed state supplies the userId+// GET /api/auth/instagram/callback - public; the signed state gives the userIdexport async function callbackHandler(c) {const { code, state, error, error_reason: errorReason } = c.req.query();const config = readInstagramOAuthConfig(c.env);diff --git a/backend/routes/keys.js b/backend/routes/keys.jsindex d7bd4dc..ecd72a9 100644--- a/backend/routes/keys.js+++ b/backend/routes/keys.js@@ -2,7 +2,7 @@ import { Hono } from 'hono';const app = new Hono();-// keys are server env vars; this only reports which are set, so the frontend can show status+// keys are server env vars; this only reports which are set, for the status uiapp.get('/keys', (c) => {return c.json({youtube: { configured: !!c.env.YOUTUBE_API_KEY },diff --git a/backend/routes/overview.js b/backend/routes/overview.jsindex 9f43f34..4ccbd69 100644--- a/backend/routes/overview.js+++ b/backend/routes/overview.js@@ -4,7 +4,7 @@ import { summarizeAccountCaches } from '../services/overviewSummary.js';const router = new Hono();-// the client re-polls while any account reports syncing, so warming never blocks the response+// the client re-polls while syncing, so warming never blocks the responsefunction runInBackground(c, tasks) {if (tasks.length === 0) return;const ctx = c.executionCtx;diff --git a/backend/routes/trackedContent.js b/backend/routes/trackedContent.jsindex 2b38550..6bc4c54 100644--- a/backend/routes/trackedContent.js+++ b/backend/routes/trackedContent.js@@ -14,7 +14,7 @@ import { detectContentType, manualViewsPatch, imageUrlPatch } from '../services/const router = new Hono();-// no account means no cookie; a missing or non-reddit account is reported as not found+// no account means no cookie; a missing or non-reddit account is not foundasync function redditCookieFor(supabase, accountId, userId) {if (!accountId) return { cookie: null };const account = await getAccountById(supabase, accountId, userId);diff --git a/backend/server.js b/backend/server.jsindex 754fb1a..e5bfc83 100644--- a/backend/server.js+++ b/backend/server.js@@ -35,7 +35,7 @@ app.use('*', async (c, next) => {app.get('/api/health', (c) => c.json({ status: 'ok', timestamp: new Date().toISOString() }));-// public: the oauth redirect carries no jwt, so the user comes from the signed hmac state token+// public: the oauth redirect has no jwt; the signed hmac state names the userapp.get('/api/auth/instagram/callback', callbackHandler);const api = new Hono();@@ -59,7 +59,7 @@ app.route('/api', api);export default {fetch: app.fetch,- // schedules come from wrangler.toml: due posts every 15 minutes, token refresh daily+ // wrangler.toml schedules: due posts every 15 minutes, token refresh dailyasync scheduled(event, env, ctx) {const supabase = getSupabase(env);diff --git a/backend/services/accountConnect.js b/backend/services/accountConnect.jsindex 88a883d..123cc6e 100644--- a/backend/services/accountConnect.js+++ b/backend/services/accountConnect.js@@ -7,7 +7,7 @@ import { buildYouTubeAccount, buildRedditAccount, buildInstagramAccount } from 'const DEFAULT_TOKEN_LIFETIME_S = 5184000;-// duplicates throw like any other failure because the route answers both with the same 400+// duplicates throw like other failures; the route answers all with a 400export async function addYouTubeAccount(supabase, userId, input, apiKey) {const channelId = await resolveChannelId(input, apiKey);const [channelData, accounts] = await Promise.all([diff --git a/backend/services/accountRefresh.js b/backend/services/accountRefresh.jsindex a55aac3..bac0f18 100644--- a/backend/services/accountRefresh.js+++ b/backend/services/accountRefresh.js@@ -5,7 +5,7 @@ import { fetchInstagramProfile } from './instagramApi.js';const NO_COOKIE_MESSAGE = 'No session cookie stored - re-add this account with a session cookie from reddit.com DevTools';-// the single refresh and refresh-all have always worded a missing YouTube key differently+// known issue: the two refresh paths word a missing YouTube key differentlyconst SINGLE_REFRESH_MESSAGES = { accessToken: 'No access token', cookie: NO_COOKIE_MESSAGE, apiKey: 'No API key' };const REFRESH_ALL_MESSAGES = { accessToken: 'No access token', cookie: NO_COOKIE_MESSAGE, apiKey: 'No YouTube API key' };@@ -52,7 +52,7 @@ function youtubeUpdates(channelData, full) {};}-// accounts added before creation dates were stored get them once; a failure only skips the extras+// fills creation dates on older accounts once; a failure only skips the extrasexport async function backfillChannelData(supabase, account, apiKey, userId) {try {const channelData = await fetchChannelData(account.channelId, apiKey);@@ -109,7 +109,7 @@ async function refreshListedAccount(supabase, userId, account, apiKey) {return account.id;}-// one failing account must not stop the others, so results line up with the accounts by index+// one failure must not stop the rest; results align with the accounts by indexexport async function refreshAllAccounts(supabase, userId, apiKey) {const accounts = await getAccounts(supabase, userId);const settled = await Promise.allSettled(accounts.map(account => refreshListedAccount(supabase, userId, account, apiKey)));diff --git a/backend/services/analyticsMath.js b/backend/services/analyticsMath.jsindex d825c1f..1ef9846 100644--- a/backend/services/analyticsMath.js+++ b/backend/services/analyticsMath.js@@ -35,7 +35,7 @@ function coefficientOfVariation(mean, stdDev) {return stdDev > 0 ? 10 : 0;}-// 100 when every value is equal, lower as values spread out relative to their mean+// 100 when all values are equal, lower as they spread out from their meanexport function consistencyScore(values) {if (values.length < 3) return 0;const mean = values.reduce((total, value) => total + value, 0) / values.length;diff --git a/backend/services/instagramMedia.js b/backend/services/instagramMedia.jsindex f4826c8..fd7966f 100644--- a/backend/services/instagramMedia.js+++ b/backend/services/instagramMedia.js@@ -49,7 +49,7 @@ async function fetchMediaPage(igUserId, accessToken, after) {try {return await igFetch(`/${igUserId}/media`, { ...params, fields: `${MEDIA_FIELDS},${VIEWS_FIELD}` });} catch {- // one item without insights (e.g. posted before going professional) fails the whole page+ // one item without insights (e.g. pre-professional posts) fails the whole pagereturn igFetch(`/${igUserId}/media`, { ...params, fields: MEDIA_FIELDS });}}diff --git a/backend/services/instagramOAuth.js b/backend/services/instagramOAuth.jsindex b504cd4..4001b51 100644--- a/backend/services/instagramOAuth.js+++ b/backend/services/instagramOAuth.js@@ -11,7 +11,7 @@ const TOKEN_URL = 'https://api.instagram.com/oauth/access_token';const LONG_LIVED_TOKEN_URL = 'https://graph.instagram.com/access_token';const OAUTH_SCOPES = 'instagram_business_basic,instagram_business_manage_messages,instagram_business_manage_comments,instagram_business_content_publish,instagram_business_manage_insights';-// secrets pasted into the dashboard can carry a byte order mark or stray whitespace+// pasted secrets can carry a byte order mark or stray whitespacefunction cleanSecret(value) {return value?.replace(/^/, '').trim();}@@ -65,7 +65,7 @@ async function exchangeCodeForToken(config, code) {return tokenData.access_token;}-// keeps the short-lived token, with no expiry, when instagram declines the 60 day upgrade+// keeps the short-lived token (no expiry) when instagram declines the upgradeasync function upgradeToLongLivedToken(config, shortToken) {const longParams = new URLSearchParams({grant_type: 'ig_exchange_token',diff --git a/backend/services/instagramTiming.js b/backend/services/instagramTiming.jsindex f11fceb..b051329 100644--- a/backend/services/instagramTiming.js+++ b/backend/services/instagramTiming.js@@ -4,7 +4,7 @@ function emptyBuckets(size) {return Array(size).fill(null).map(() => ({ count: 0, likes: 0, comments: 0 }));}-// dates skips invalid timestamps but is indexed against media; kept to match the stored analytics+// dates drops bad timestamps yet is indexed by media, matching stored analyticsfunction fillBuckets(buckets, dates, media, bucketIndexOf) {dates.forEach((date, i) => {const bucket = buckets[bucketIndexOf(date)];diff --git a/backend/services/overviewSummary.js b/backend/services/overviewSummary.jsindex 6808a2f..949fa67 100644--- a/backend/services/overviewSummary.js+++ b/backend/services/overviewSummary.js@@ -7,10 +7,10 @@ function sumBy(items, pick) {return items.reduce((total, item) => total + pick(item), 0);}-// syncing is true only when a fetch started, so the client never waits on an unfetchable account+// syncing only when a fetch started, so the client never waits for nothingfunction startWarm(context, accountId, task) {if (!context.redis || !task) return { id: accountId, cacheWarmed: false, syncing: false };- // a failed warm leaves the cache empty, so the next overview load starts it again+ // a failed warm leaves the cache empty, so the next load starts it againcontext.warmTasks.push(task().catch(() => undefined));return { id: accountId, cacheWarmed: false, syncing: true };}@@ -86,7 +86,7 @@ async function summarizeAccount(context, account) {return summarizeYouTube(context, account);}-// an account whose cache read failed is left out instead of failing the whole overview+// a failed cache read leaves the account out instead of failing the overviewfunction collectSummaries(results) {const analyticsCache = {};results.forEach(result => {@@ -97,7 +97,7 @@ function collectSummaries(results) {return analyticsCache;}-// warmTasks are already running; the caller decides how long the runtime keeps them alive+// the warm tasks already run; the caller decides how long they are kept aliveexport async function summarizeAccountCaches(accounts, { redis, userId, apiKey }) {const context = { redis, userId, apiKey, warmTasks: [] };const results = await Promise.allSettled(accounts.map(account => summarizeAccount(context, account)));diff --git a/backend/services/reddit.js b/backend/services/reddit.jsindex 18105c6..7f2a81b 100644--- a/backend/services/reddit.js+++ b/backend/services/reddit.js@@ -1,6 +1,6 @@export { computeRedditAnalytics } from './redditAnalytics.js';-// fetch is a worker global; requests send the user's reddit_session cookie as stored+// fetch is a worker global; requests send the stored reddit_session cookieconst REDDIT_BASE = 'https://www.reddit.com';// reddit requires <platform>:<appid>:<version> (by /u/<username>)const USER_AGENT = 'script:twiligent:v1.0 (by /u/spacesdrive)';diff --git a/backend/services/redditAnalytics.js b/backend/services/redditAnalytics.jsindex d3549c7..a1fdffa 100644--- a/backend/services/redditAnalytics.js+++ b/backend/services/redditAnalytics.js@@ -62,7 +62,7 @@ function buildMediaTypeDistribution(posts) {return distribution;}-// dates skips posts without a date but is indexed against posts; kept to match stored analytics+// dates skips undated posts yet is indexed by posts, matching stored analyticsfunction fillTimeBuckets(dates, posts) {const dayBuckets = Array(7).fill(null).map(() => ({ count: 0, score: 0, comments: 0 }));const hourBuckets = Array(24).fill(null).map(() => ({ count: 0, score: 0 }));diff --git a/backend/services/trackedContent.js b/backend/services/trackedContent.jsindex 3cdf92e..f1c5c38 100644--- a/backend/services/trackedContent.js+++ b/backend/services/trackedContent.js@@ -5,7 +5,7 @@ export function detectContentType(url) {return null;}-// reddit dropped view_count in 2018 so views are typed in; a youtube count is never overridden+// reddit dropped view_count in 2018 so views are typed in; youtube keeps its ownexport function manualViewsPatch(manualViews, isYouTube) {if (isYouTube) return { error: 'YouTube view counts are fetched automatically and cannot be set by hand' };if (manualViews === null || manualViews === '') return { patch: { manualViews: null } };@@ -24,13 +24,13 @@ function parseUrl(value) {}}-// reddit json has no thumbnail, so the browser uploads one; youtube thumbnails stay untouched+// reddit has no thumbnail, so the browser uploads one; youtube keeps its ownexport function imageUrlPatch(imageUrl, isYouTube) {if (isYouTube) return { error: 'Images can only be attached to Reddit posts' };if (imageUrl === null || imageUrl === '') return { patch: { imageUrl: null } };const parsed = parseUrl(imageUrl);- // https only: the value goes straight into an img src, so javascript: and data: urls are refused+ // https only: it lands in an img src, so javascript: and data: urls are refusedif (!parsed || parsed.protocol !== 'https:') return { error: 'Image must be an https URL returned by the uploader' };return { patch: { imageUrl: parsed.toString() } };}diff --git a/backend/services/youtubeAnalytics.js b/backend/services/youtubeAnalytics.jsindex aa01c90..9d2bada 100644--- a/backend/services/youtubeAnalytics.js+++ b/backend/services/youtubeAnalytics.js@@ -5,7 +5,7 @@ import {buildUploadFrequency, weeklyConsistencyScore, buildViewsDistribution, buildMonthlyTrends,} from './youtubeTrends.js';-// shorts are judged by duration alone, so any video up to 60 seconds counts as one+// shorts are judged by duration alone: any video up to 60 seconds countsconst SHORT_MAX_SECONDS = 60;function emptyVideoAnalytics() {@@ -84,7 +84,7 @@ function summarizeDurations(totalDuration, totalViews, videoCount) {avgDurationFormatted: formatDuration(Math.round(totalDuration / videoCount)),totalDurationSeconds: totalDuration,totalDurationFormatted: formatDuration(totalDuration),- // multiplies the summed durations by the summed views; kept to match stored analytics+ // multiplies summed durations by summed views, matching stored analyticsestimatedTotalWatchTimeHours: Math.round((totalDuration * totalViews) / 3600),};}diff --git a/backend/services/youtubeChannels.js b/backend/services/youtubeChannels.jsindex ee16a7e..167892c 100644--- a/backend/services/youtubeChannels.js+++ b/backend/services/youtubeChannels.js@@ -20,7 +20,7 @@ function extractChannelId(input) {return trimmed;}-// returns null when the lookup finds nothing or fails, so the next strategy can run+// null when the lookup finds nothing or fails, so the next strategy runsasync function lookupChannelId(endpoint, params, pickId, apiKey) {try {const data = await ytFetch(endpoint, params, apiKey);diff --git a/backend/services/youtubeFormat.js b/backend/services/youtubeFormat.jsindex ff9a73e..d0c438f 100644--- a/backend/services/youtubeFormat.js+++ b/backend/services/youtubeFormat.js@@ -1,4 +1,4 @@-// ignores the day part of durations such as P1DT2H, which then parse as zero seconds+// ignores the day part, so durations such as P1DT2H parse as zero secondsexport function parseDuration(iso) {const match = iso.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);if (!match) return 0;diff --git a/backend/services/youtubeTrends.js b/backend/services/youtubeTrends.jsindex 985b403..0f6f871 100644--- a/backend/services/youtubeTrends.js+++ b/backend/services/youtubeTrends.js@@ -52,7 +52,7 @@ export function buildTagFrequency(videos) {.map(([tag, count]) => ({ tag, count }));}-// strict < unlike the inclusive instagram and reddit counts; kept to match stored analytics+// strict < unlike instagram and reddit (inclusive), to match stored analyticsexport function countRecentUploads(videos, now) {const uploadedWithin = (days) => videos.filter(video => (now - new Date(video.publishedAt)) < days * DAY_MS).length;return {@@ -88,7 +88,7 @@ export function weeklyConsistencyScore(videos, now) {return Math.max(0, Math.min(100, Math.round(100 - (stdDev / Math.max(0.01, avgWeekly)) * 25)));}-// < high drops the top video when its views split evenly into ten buckets; kept as is+// known issue: < high drops the top video when ten buckets divide views evenlyexport function buildViewsDistribution(videos, maxViews) {const step = Math.max(1, Math.ceil(maxViews / HISTOGRAM_BUCKETS));const ranges = [];diff --git a/backend/services/youtubeVideos.js b/backend/services/youtubeVideos.jsindex 7949dd5..20cbc31 100644--- a/backend/services/youtubeVideos.js+++ b/backend/services/youtubeVideos.js@@ -24,7 +24,7 @@ export function normalizeYouTubeVideo(video) {licensedContent: contentDetails.licensedContent || false,projection: contentDetails.projection || 'rectangular',viewCount: parseInt(statistics.viewCount) || 0,- // null when the owner hid likes or switched comments off, so it stays apart from zero+ // null when likes are hidden or comments are off, so it stays apart from zerolikeCount: optionalCount(statistics.likeCount),commentCount: optionalCount(statistics.commentCount),privacyStatus: status?.privacyStatus || 'public',@@ -39,7 +39,7 @@ async function fetchPlaylistPage(playlistId, pageToken, apiKey) {try {return await ytFetch('playlistItems', params, apiKey);} catch (err) {- // youtube reports a channel's uploads playlist as missing until its first public video+ // youtube reports the uploads playlist missing until the first public videoif (err.reason === 'playlistNotFound') return null;throw err;}diff --git a/backend/utils/scheduler.js b/backend/utils/scheduler.jsindex 340fbcf..c21bd86 100644--- a/backend/utils/scheduler.js+++ b/backend/utils/scheduler.js@@ -20,7 +20,7 @@ async function createContainer(igId, params) {return createData.id;}-// reels and stories process for a while; other media only need a short pause before publishing+// reels and stories need processing; other media only need a short pauseasync function waitForContainer(mediaType, containerId, token) {if (mediaType !== 'REELS' && mediaType !== 'STORIES') {await wait(2000);@@ -59,7 +59,7 @@ async function publishPost(supabase, post) {return publishContainer(igId, containerId, token);}-// cron entry point; it gets supabase directly because cron handlers have no request context+// cron entry: there is no request context, so supabase is passed in directlyexport async function processScheduledPosts(supabase) {let processed = 0;const errors = [];diff --git a/docs/workflows/TESTING.md b/docs/workflows/TESTING.mdindex f739798..a1581fc 100644--- a/docs/workflows/TESTING.md+++ b/docs/workflows/TESTING.md@@ -9,7 +9,7 @@ cd backend && npm testcd frontend && npm test```-Frontend tests (`npm test` runs every `src/**/*.test.js`) cover shared helpers in `src/lib/` and `src/utils/` (hold-to-confirm timing, command palette ranking, library filtering and paging, platform helpers, and a check that every Lucide icon imported in `src` exists) and page helpers that sit beside their feature in `src/features/**` and `src/docs/**`, such as `features/analytics/overview/overviewStats.js`. A testable helper is a plain `.js` file with no JSX and no `@/` imports, and its imports of project files are relative paths that end in `.js`, so Node can load it directly.+Frontend tests (`npm test` runs every `src/**/*.test.js`) cover shared helpers in `src/lib/` and `src/utils/` (hold-to-confirm timing, command palette ranking, library filtering and paging, platform helpers, and a check that every Lucide icon imported in `src` exists) and page helpers that sit beside their feature in `src/features/**` and `src/docs/**`, such as `features/analytics/overview/overviewStats.js`. A testable helper is a plain `.js` file with no JSX and no `@/` imports, and its imports of project files are relative paths that end in `.js`, so Node can load it directly. This rule lives here, so helper files do not repeat it in a header comment.Test files sit next to the module they cover as `*.test.js` (for example `services/instagram.test.js`). Wrangler only bundles files reachable from `server.js`, so test files never ship in the Worker.diff --git a/frontend/src/components/brand/Logo.jsx b/frontend/src/components/brand/Logo.jsxindex 8f917bf..52b841f 100644--- a/frontend/src/components/brand/Logo.jsx+++ b/frontend/src/components/brand/Logo.jsx@@ -3,7 +3,7 @@ import { cn } from '@/lib/utils';const LOGO_DIR = '/Logos';-// both lockups render and css picks one, so the right file shows before the theme hook runs+// css shows one of both lockups, so it is right before the theme hook runsexport function Logo({ variant = 'lockup', className }) {if (variant === 'wordmark') {return (diff --git a/frontend/src/context/AuthContext.jsx b/frontend/src/context/AuthContext.jsxindex 727e244..65cd1b9 100644--- a/frontend/src/context/AuthContext.jsx+++ b/frontend/src/context/AuthContext.jsx@@ -20,7 +20,7 @@ export function AuthProvider({ children }) {const signUp = (email, password) =>supabase.auth.signUp({ email, password });- // the raw nonce lets supabase confirm the google token was issued for this sign-in+ // the raw nonce lets supabase confirm the google token came from this sign-inconst signInWithGoogle = (idToken, nonce) =>supabase.auth.signInWithIdToken({ provider: 'google', token: idToken, nonce });diff --git a/frontend/src/docs/pages/Reference.jsx b/frontend/src/docs/pages/Reference.jsxindex 0c37b52..a774212 100644--- a/frontend/src/docs/pages/Reference.jsx+++ b/frontend/src/docs/pages/Reference.jsx@@ -1,4 +1,4 @@-// each page lives in reference/; this barrel keeps them in one lazy chunk for routes.js+// pages live in reference/; this barrel keeps them in one lazy chunkexport { default as Environment } from './reference/Environment';export { default as Scheduling } from './reference/Scheduling';export { default as Security } from './reference/Security';diff --git a/frontend/src/docs/pages/SelfHost.jsx b/frontend/src/docs/pages/SelfHost.jsxindex 82ca300..c637409 100644--- a/frontend/src/docs/pages/SelfHost.jsx+++ b/frontend/src/docs/pages/SelfHost.jsx@@ -1,4 +1,4 @@-// each page lives in selfHost/; this barrel keeps them in one lazy chunk for routes.js+// pages live in selfHost/; this barrel keeps them in one lazy chunkexport { SCHEMA_SQL } from './selfHost/selfHostSql';export { default as Overview } from './selfHost/Overview';export { default as Supabase } from './selfHost/Supabase';diff --git a/frontend/src/features/accounts/accountManagerData.js b/frontend/src/features/accounts/accountManagerData.jsindex a235f1d..a40413e 100644--- a/frontend/src/features/accounts/accountManagerData.js+++ b/frontend/src/features/accounts/accountManagerData.js@@ -26,7 +26,7 @@ export function instagramErrorMessage(code) {return IG_ERRORS[code] || `Instagram connection failed: ${code}. ${TESTER_HINT}`;}-// instagram oauth returns with ?ig_connected=true or ?ig_error=...; ?add=1 opens the add flow+// oauth returns ?ig_connected=true or ?ig_error=...; ?add=1 opens the add flowexport function readOAuthReturn(searchParams) {const connected = searchParams.get('ig_connected');const igError = searchParams.get('ig_error');diff --git a/frontend/src/features/accounts/useAccountRefresh.js b/frontend/src/features/accounts/useAccountRefresh.jsindex aa53b85..db331fe 100644--- a/frontend/src/features/accounts/useAccountRefresh.js+++ b/frontend/src/features/accounts/useAccountRefresh.js@@ -1,7 +1,7 @@import { useState } from 'react';import { api } from '../../services/api';-// one id for both buttons: 'all' while refreshing every account, else the account id+// one id for both buttons: 'all' for refresh-all, else the account idexport function useAccountRefresh({ showToast, loadAccounts }) {const [refreshingId, setRefreshingId] = useState(null);diff --git a/frontend/src/features/accounts/useAddAccount.js b/frontend/src/features/accounts/useAddAccount.jsindex f1cc72b..13d301b 100644--- a/frontend/src/features/accounts/useAddAccount.js+++ b/frontend/src/features/accounts/useAddAccount.js@@ -122,7 +122,7 @@ export function useAddAccount({ showToast, loadAccounts }) {loadAccounts();};- // back keeps the typed channel and reddit fields; only the platform and lookup result reset+ // back keeps typed channel and reddit fields; only platform and lookup resetconst goBack = () => {setPlatform(null);channel.clearResolved();diff --git a/frontend/src/features/analytics/channel/channelChartData.js b/frontend/src/features/analytics/channel/channelChartData.jsindex 9d35847..f4e931f 100644--- a/frontend/src/features/analytics/channel/channelChartData.js+++ b/frontend/src/features/analytics/channel/channelChartData.js@@ -1,5 +1,3 @@-// chart rows and labels for channel analytics; no JSX or path aliases so node --test can import it-import { SERIES } from '../../../lib/chart.js';import { CATEGORY_MAP, fmtDate, fmtNum, fmtPercent } from '../../../utils/formatters.js';diff --git a/frontend/src/features/analytics/instagram/instagramAnalyticsData.js b/frontend/src/features/analytics/instagram/instagramAnalyticsData.jsindex a62218c..78a1ac6 100644--- a/frontend/src/features/analytics/instagram/instagramAnalyticsData.js+++ b/frontend/src/features/analytics/instagram/instagramAnalyticsData.js@@ -1,5 +1,3 @@-// chart rows and labels for Instagram analytics; no JSX or path aliases so node --test can import it-import { fmtNum } from '../../../utils/formatters.js';import { IG_CONTENT_TYPES, IG_CONTENT_TYPE_META } from '../../../utils/instagramContent.js';diff --git a/frontend/src/features/analytics/overview/greeting.js b/frontend/src/features/analytics/overview/greeting.jsindex bd0b95a..fa651a3 100644--- a/frontend/src/features/analytics/overview/greeting.js+++ b/frontend/src/features/analytics/overview/greeting.js@@ -1,5 +1,3 @@-// overview header greeting; no JSX or path aliases so node --test can import it-export function greeting(date = new Date()) {const hour = date.getHours();if (hour < 12) return 'Good morning';diff --git a/frontend/src/features/analytics/overview/overviewCharts.js b/frontend/src/features/analytics/overview/overviewCharts.jsindex 1f3db00..36dfea5 100644--- a/frontend/src/features/analytics/overview/overviewCharts.js+++ b/frontend/src/features/analytics/overview/overviewCharts.js@@ -1,5 +1,3 @@-// overview chart rows and legend; no JSX or path aliases so node --test can import it-import { PLATFORM_META } from '../../../lib/accounts.js';import { SERIES } from '../../../lib/chart.js';diff --git a/frontend/src/features/analytics/overview/overviewLabels.js b/frontend/src/features/analytics/overview/overviewLabels.jsindex 9b63b6a..493f3cd 100644--- a/frontend/src/features/analytics/overview/overviewLabels.js+++ b/frontend/src/features/analytics/overview/overviewLabels.js@@ -1,5 +1,3 @@-// overview tab details and row labels; no JSX or path aliases so node --test can import it-import { platformOf, platformSummary } from '../../../lib/accounts.js';import { fmtNum } from '../../../utils/formatters.js';import { IG_CONTENT_TYPES, IG_CONTENT_TYPE_META } from '../../../utils/instagramContent.js';diff --git a/frontend/src/features/analytics/overview/overviewStats.js b/frontend/src/features/analytics/overview/overviewStats.jsindex d55d6e9..d16c655 100644--- a/frontend/src/features/analytics/overview/overviewStats.js+++ b/frontend/src/features/analytics/overview/overviewStats.js@@ -1,5 +1,3 @@-// overview totals; no JSX or path aliases so node --test can import it-import { audienceOf } from '../../../lib/accounts.js';import { IG_CONTENT_TYPES } from '../../../utils/instagramContent.js';@@ -39,7 +37,7 @@ function addInstagramCache(result, cache) {});}-// only accounts saved with platform 'youtube' count here, unlike the platform splits+// only accounts saved as 'youtube' count here, unlike the platform splitsexport function cacheTotalsOf(accounts, analyticsCache) {const result = {ytLikes: 0, ytComments: 0, igLikes: 0, igComments: 0, igViews: 0, rdPosts: 0, rdKarma: 0, rdComments: 0,@@ -66,7 +64,7 @@ function shareOf(part, total) {return total > 0 ? (part / total) * 100 : 0;}-// tracked items are never the user's own content, so cache and tracked totals never overlap+// tracked items are never the user's own, so they never overlap cache totalsexport function summaryOf(totals, cacheTotals, trackedStats) {const totalContent = totals.videos + totals.posts + cacheTotals.rdPosts + trackedStats.total;const trackedViewTotal = trackedStats.ytViews + trackedStats.rdViews;diff --git a/frontend/src/features/analytics/overview/useOverviewStats.js b/frontend/src/features/analytics/overview/useOverviewStats.jsindex 41dcfb3..4cb641b 100644--- a/frontend/src/features/analytics/overview/useOverviewStats.js+++ b/frontend/src/features/analytics/overview/useOverviewStats.js@@ -20,7 +20,7 @@ function useOverviewCharts(groups, trackedContent, categoryStats) {}export function useOverviewStats(accounts, overviewData) {- // memoized so the ?? fallbacks keep a stable identity and the memos below actually cache+ // memoized so the ?? fallbacks keep their identity and the memos below cacheconst trackedContent = useMemo(() => overviewData.tracked ?? [], [overviewData.tracked]);const analyticsCache = useMemo(() => overviewData.analyticsCache ?? {}, [overviewData.analyticsCache]);diff --git a/frontend/src/features/analytics/reddit/redditAnalyticsData.js b/frontend/src/features/analytics/reddit/redditAnalyticsData.jsindex b0d8040..7976385 100644--- a/frontend/src/features/analytics/reddit/redditAnalyticsData.js+++ b/frontend/src/features/analytics/reddit/redditAnalyticsData.js@@ -1,11 +1,9 @@-// chart rows and stat lists for Reddit analytics; no JSX or path aliases so node --test can import it-import { seriesAt } from '../../../lib/chart.js';import { fmtNum, fmtNumFull } from '../../../utils/formatters.js';const MEDIA_TYPE_ORDER = ['text', 'image', 'video', 'link'];-// labels come in as an argument because redditPostUtils.js imports through a path alias+// labels are passed in because redditPostUtils.js imports through a path aliasexport function mediaTypeDataOf(distribution, labels) {if (!distribution) return [];return Object.entries(distribution).map(([key, value]) => ({diff --git a/frontend/src/features/analytics/reels/reelsLibrary.js b/frontend/src/features/analytics/reels/reelsLibrary.jsindex 3d6f03f..a8ecf96 100644--- a/frontend/src/features/analytics/reels/reelsLibrary.js+++ b/frontend/src/features/analytics/reels/reelsLibrary.js@@ -1,5 +1,3 @@-// Instagram library merging and filters; no JSX or path aliases so node --test can import it-import { LIKE_TIERS, filterByTier, matchesText } from '../../../lib/library.js';import { fmtNum } from '../../../utils/formatters.js';import { IG_CONTENT_TYPES } from '../../../utils/instagramContent.js';@@ -9,7 +7,7 @@ function engagementRateOf(item) {return null;}-// results come from Promise.allSettled, one per account; failed accounts are skipped+// one Promise.allSettled result per account; failed accounts are skippedexport function mergeAccountMedia(igAccounts, results) {const all = [];results.forEach((result, i) => {diff --git a/frontend/src/features/analytics/reels/useInstagramMedia.js b/frontend/src/features/analytics/reels/useInstagramMedia.jsindex ef997d7..135026b 100644--- a/frontend/src/features/analytics/reels/useInstagramMedia.js+++ b/frontend/src/features/analytics/reels/useInstagramMedia.js@@ -3,7 +3,7 @@ import { useAppContext } from '../../../context/AppContext';import { api } from '../../../services/api';import { mergeAccountMedia } from './reelsLibrary.js';-// loads media from every Instagram account; one failed account does not hide the rest+// one failed Instagram account does not hide media from the restexport function useInstagramMedia() {const { accounts, showToast } = useAppContext();const igAccounts = useMemo(() => accounts.filter(account => account.platform === 'instagram'), [accounts]);diff --git a/frontend/src/features/analytics/tracked/trackedCategoryStats.js b/frontend/src/features/analytics/tracked/trackedCategoryStats.jsindex 0ac92b4..bff0e18 100644--- a/frontend/src/features/analytics/tracked/trackedCategoryStats.js+++ b/frontend/src/features/analytics/tracked/trackedCategoryStats.js@@ -1,5 +1,3 @@-// per-category totals and labels; no JSX or path aliases so node --test can import it-import { fmtNum } from '../../../utils/formatters.js';import { hasTrackedViews, trackedViews } from '../../../utils/trackedContent.js';import { countLabel } from './trackedList.js';diff --git a/frontend/src/features/analytics/tracked/trackedList.js b/frontend/src/features/analytics/tracked/trackedList.jsindex d676de0..2ceaf4d 100644--- a/frontend/src/features/analytics/tracked/trackedList.js+++ b/frontend/src/features/analytics/tracked/trackedList.js@@ -1,5 +1,3 @@-// tracked content list helpers; no JSX or path aliases so node --test can import it-import { matchesText } from '../../../lib/library.js';import { isRedditItem, trackedComments, trackedEngagement, trackedViews } from '../../../utils/trackedContent.js';@@ -63,7 +61,7 @@ export function bulkCategoryMessage(succeeded, failed) {return { message: done, severity: 'success' };}-// an empty field clears the views; anything else must be a whole number of 0 or more+// an empty field clears the views; otherwise a whole number of 0 or moreexport function parseManualViews(raw) {const trimmed = raw.trim();if (trimmed === '') return { value: null };diff --git a/frontend/src/features/analytics/tracked/useTrackedEditor.js b/frontend/src/features/analytics/tracked/useTrackedEditor.jsindex ca5e402..7f0a499 100644--- a/frontend/src/features/analytics/tracked/useTrackedEditor.js+++ b/frontend/src/features/analytics/tracked/useTrackedEditor.js@@ -19,7 +19,7 @@ function useTrackedImage({ cloudConfig, showToast }) {if (error) { showToast(error, 'error'); return; }setUploading(true);try {- // the Worker never handles binary uploads, so only the returned url is saved on the item+ // the Worker never takes binary uploads, so only the returned url is savedsetImageUrl(await api.uploadImage(file, cloudConfig));showToast('Image uploaded');} catch (err) {diff --git a/frontend/src/features/analytics/videos/videoLibrary.js b/frontend/src/features/analytics/videos/videoLibrary.jsindex 24bee53..036ab90 100644--- a/frontend/src/features/analytics/videos/videoLibrary.js+++ b/frontend/src/features/analytics/videos/videoLibrary.js@@ -1,9 +1,7 @@-// video library filters and totals; no JSX or path aliases so node --test can import it-import { VIEW_TIERS, filterByTier, matchesText, engagementPercent, parseIsoDuration } from '../../../lib/library.js';import { fmtNum } from '../../../utils/formatters.js';-// failed channels are left out; each video gains its channel, thumbnail, engagement and duration+// failed channels are left out; each video gains its channel and derived fieldsexport function mergeChannelVideos(channelAccounts, results) {const videos = [];const channels = [];diff --git a/frontend/src/features/publishing/ScheduledPostRow.jsx b/frontend/src/features/publishing/ScheduledPostRow.jsxindex 239d9d6..d3a7bb5 100644--- a/frontend/src/features/publishing/ScheduledPostRow.jsx+++ b/frontend/src/features/publishing/ScheduledPostRow.jsx@@ -10,7 +10,7 @@ import { POST_STATUS, contentTypeOf } from './publishConstants';import { formatScheduleDate, isPastDue } from './scheduleHelpers.js';function PostActions({ post, isEditing, editor, onDelete }) {- // the publish flow never sets a 'scheduled' status, the check is kept as it was+ // mirrors the backend edit check, which also accepts a 'scheduled' statusconst canEdit = post.status === 'pending' || post.status === 'scheduled';const deleteLabel = post.status === 'published' ? 'Remove record' : 'Delete scheduled post';return (diff --git a/frontend/src/features/publishing/containerPolling.js b/frontend/src/features/publishing/containerPolling.jsindex d38fd3b..4db2418 100644--- a/frontend/src/features/publishing/containerPolling.js+++ b/frontend/src/features/publishing/containerPolling.js@@ -31,7 +31,7 @@ async function pollStrict(containerId, accountId) {return containerFinished(status, 'Processing failed');}-// single posts ride out failed checks and fail on timeout; bulk stops quietly after the last try+// single posts survive failed checks and throw on timeout; bulk stops quietlyexport async function waitForContainer(containerId, accountId, { tolerant = false, onStatus } = {}) {for (let i = 0; i < POLL_ATTEMPTS; i++) {await wait(POLL_INTERVAL_MS);@@ -44,7 +44,7 @@ export async function waitForContainer(containerId, accountId, { tolerant = falsreturn false;}-// photos need no processing, Instagram only needs a moment before they can be published+// photos need no processing, only a moment before Instagram can publish themexport async function waitUntilReady(contentType, containerId, accountId, { onProcessing, ...pollOptions }) {if (contentType !== 'REELS' && contentType !== 'STORIES') {await wait(IMAGE_SETTLE_MS);diff --git a/frontend/src/features/publishing/publishHelpers.js b/frontend/src/features/publishing/publishHelpers.jsindex a01f937..6c93fac 100644--- a/frontend/src/features/publishing/publishHelpers.js+++ b/frontend/src/features/publishing/publishHelpers.js@@ -1,5 +1,3 @@-// post payloads and checks; no JSX or path aliases so node --test can import it-const MINUTE_MS = 60000;export function parseUserTags(text) {diff --git a/frontend/src/features/publishing/queueHelpers.js b/frontend/src/features/publishing/queueHelpers.jsindex 06e668c..ad7a7e0 100644--- a/frontend/src/features/publishing/queueHelpers.js+++ b/frontend/src/features/publishing/queueHelpers.js@@ -1,5 +1,3 @@-// bulk queue and progress helpers; no JSX or path aliases so node --test can import it-const DAY_MINUTES = 1440;export function intervalLabel(minutes) {diff --git a/frontend/src/features/publishing/scheduleHelpers.js b/frontend/src/features/publishing/scheduleHelpers.jsindex 498ca55..8866590 100644--- a/frontend/src/features/publishing/scheduleHelpers.js+++ b/frontend/src/features/publishing/scheduleHelpers.js@@ -1,5 +1,3 @@-// scheduled post list and date helpers; no JSX or path aliases so node --test can import it-export const OVERDUE_MS = 30 * 60 * 1000;function pad(value) {@@ -54,7 +52,7 @@ export function toLocalTimeInput(date) {return `${pad(date.getHours())}:${pad(date.getMinutes())}`;}-// the page has always used the UTC calendar day for date inputs+// known issue: date inputs use the UTC calendar day, not the local oneexport function utcDateInput(date = new Date()) {return date.toISOString().split('T')[0];}diff --git a/frontend/src/features/settings/SchedulingSetupGuide.jsx b/frontend/src/features/settings/SchedulingSetupGuide.jsxindex 259339d..0c2b356 100644--- a/frontend/src/features/settings/SchedulingSetupGuide.jsx+++ b/frontend/src/features/settings/SchedulingSetupGuide.jsx@@ -32,7 +32,7 @@ export default function SchedulingSetupGuide({ owner, repo, onOwnerChange, onRepconst user = owner.trim();const base = repoBaseUrl(owner, repo);const completed = completedSteps(done);- // members never need these steps, so the guide stays folded unless someone has already started it+ // members never need these steps; the guide opens only once someone has startedconst [open, setOpen] = useState(() => completed > 0 || Boolean(user));return (diff --git a/frontend/src/features/settings/Settings.jsx b/frontend/src/features/settings/Settings.jsxindex 1dcd74c..f5ff619 100644--- a/frontend/src/features/settings/Settings.jsx+++ b/frontend/src/features/settings/Settings.jsx@@ -16,13 +16,13 @@ export default function Settings() {const { serverStatus, loading, github } = useServerSettings(showToast);const location = useLocation();- // links such as /settings#scheduling jump to their section once the page has loaded+ // links such as /settings#scheduling jump to their section after loadinguseEffect(() => {if (loading || !location.hash) return;document.getElementById(location.hash.slice(1))?.scrollIntoView({ block: 'start' });}, [loading, location.hash]);- // the setup guide decides once, at mount, whether to start open, so it mounts after loading+ // the setup guide picks its open state at mount, so it mounts after loadingif (loading) {return (<div className="flex flex-col gap-8">diff --git a/frontend/src/features/settings/schedulingProgress.js b/frontend/src/features/settings/schedulingProgress.jsindex 4e3e985..e061854 100644--- a/frontend/src/features/settings/schedulingProgress.js+++ b/frontend/src/features/settings/schedulingProgress.js@@ -3,7 +3,7 @@ export const SETUP_STEP_KEYS = ['fork', 'supabase', 'secrets', 'enable', 'test']export const browserStorage = () => localStorage;-// getStorage runs inside the try: reading localStorage itself throws when site data is blocked+// getStorage is called in the try: localStorage throws when site data is blockedexport function readProgress(getStorage) {try {return JSON.parse(getStorage().getItem(PROGRESS_KEY)) || {};diff --git a/frontend/src/features/settings/settingsData.js b/frontend/src/features/settings/settingsData.jsindex 13a03ca..88b6fc9 100644--- a/frontend/src/features/settings/settingsData.js+++ b/frontend/src/features/settings/settingsData.js@@ -22,7 +22,7 @@ async function retryKeys(apiClient, isCancelled, applyKeys) {}}-// a failure after applyKeys keeps those keys: the retry only replaces them when it succeeds+// a later failure keeps applied keys: the retry only replaces them on successexport async function loadServerSettings(apiClient, { isCancelled, applyKeys, applyGithub, finish }) {try {const [keys, github] = await Promise.all([apiClient.getKeys(), apiClient.getGithubSettings()]);@@ -36,7 +36,7 @@ export async function loadServerSettings(apiClient, { isCancelled, applyKeys, ap}}-// only the repository is kept: it fills in the direct links in the setup guide, no token needed+// only the repository is kept; it fills the guide links and needs no tokenexport function githubSettingsPayload(owner, repo) {return { repoOwner: owner.trim(), repoName: (repo || 'twiligent').trim(), branch: 'main' };}diff --git a/frontend/src/hooks/use-account-analytics.js b/frontend/src/hooks/use-account-analytics.jsindex a0f7ff1..0e4d70f 100644--- a/frontend/src/hooks/use-account-analytics.js+++ b/frontend/src/hooks/use-account-analytics.js@@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'react';import { useAppContext } from '../context/AppContext';import { api } from '../services/api';-// pass a stable api method such as api.getIGAnalytics so the load runs once per account+// pass a stable method such as api.getIGAnalytics so it loads once per accountexport function useAccountAnalytics(account, fetchAnalytics, label) {const { showToast } = useAppContext();const [loading, setLoading] = useState(true);@@ -10,7 +10,7 @@ export function useAccountAnalytics(account, fetchAnalytics, label) {const [analytics, setAnalytics] = useState(null);const [refreshing, setRefreshing] = useState(false);- // keyed on the account id so a background account refresh does not refetch analytics+ // keyed on the account id so a background refresh does not refetch analyticsconst accountId = account?.id;const loadAnalytics = useCallback(async () => {if (!accountId) return;diff --git a/frontend/src/hooks/use-cloudinary-config.js b/frontend/src/hooks/use-cloudinary-config.jsindex 7aa963a..864b0d7 100644--- a/frontend/src/hooks/use-cloudinary-config.js+++ b/frontend/src/hooks/use-cloudinary-config.js@@ -11,7 +11,7 @@ async function fetchCloudinaryConfig() {}}-// reloadKey lets a page fetch the config again when something it depends on changes+// reloadKey lets a page refetch the config when something it depends on changesexport function useCloudinaryConfig(reloadKey) {const [config, setConfig] = useState(null);diff --git a/frontend/src/hooks/use-smooth-theme.js b/frontend/src/hooks/use-smooth-theme.jsindex 4354738..f6b163c 100644--- a/frontend/src/hooks/use-smooth-theme.js+++ b/frontend/src/hooks/use-smooth-theme.js@@ -6,7 +6,7 @@ function resolve(theme) {return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';}-// one page cross-fade; the class is set inside the transition so the new snapshot is complete+// the class changes inside the view transition so its new snapshot is completeexport function useSmoothTheme() {const { theme, resolvedTheme, setTheme } = useTheme();diff --git a/frontend/src/lib/accounts.js b/frontend/src/lib/accounts.jsindex 380e554..d206e65 100644--- a/frontend/src/lib/accounts.js+++ b/frontend/src/lib/accounts.js@@ -1,5 +1,3 @@-// platform helpers for every page; no jsx or path aliases so node --test can import it-export const PLATFORMS = ['youtube', 'instagram', 'reddit'];export const PLATFORM_META = {diff --git a/frontend/src/lib/chart.js b/frontend/src/lib/chart.jsindex 312d528..d89abdf 100644--- a/frontend/src/lib/chart.js+++ b/frontend/src/lib/chart.js@@ -1,4 +1,4 @@-// series follow the brand chart order; values are css variables so charts follow the theme+// brand chart order; css variable values let charts follow the themeexport const SERIES = {primary: 'var(--chart-1)',diff --git a/frontend/src/lib/contact.js b/frontend/src/lib/contact.jsindex 9c6533f..a188fb7 100644--- a/frontend/src/lib/contact.js+++ b/frontend/src/lib/contact.js@@ -1,4 +1,4 @@-// who members contact for access and scheduling help; self-hosters set VITE_ADMIN_EMAIL+// contact for access and scheduling help; self-hosters set VITE_ADMIN_EMAILexport const ADMIN_EMAIL = import.meta.env?.VITE_ADMIN_EMAIL || '[email protected]';export function adminMailto(subject, body = '') {diff --git a/frontend/src/lib/googleIdentity.js b/frontend/src/lib/googleIdentity.jsindex e219d70..75b7f61 100644--- a/frontend/src/lib/googleIdentity.js+++ b/frontend/src/lib/googleIdentity.js@@ -27,7 +27,7 @@ export async function sha256Hex(text) {return Array.from(new Uint8Array(digest), b => b.toString(16).padStart(2, '0')).join('');}-// supabase checks the raw nonce against the hash in the token, so a captured token cannot replay+// supabase matches the raw nonce to the token's hash, so a token cannot replayexport async function createNonce() {const bytes = crypto.getRandomValues(new Uint8Array(32));const raw = btoa(String.fromCharCode(...bytes)).replace(/[+/=]/g, '');diff --git a/frontend/src/pages/LoginBrandPanel.jsx b/frontend/src/pages/LoginBrandPanel.jsxindex 23eec88..6c91533 100644--- a/frontend/src/pages/LoginBrandPanel.jsx+++ b/frontend/src/pages/LoginBrandPanel.jsx@@ -7,7 +7,7 @@ const PLATFORMS = [{ icon: RedditIcon, label: 'Reddit' },];-// decorative preview of the product, hidden from assistive technology and on small screens+// decorative preview, hidden from assistive technology and on small screensexport default function LoginBrandPanel() {return (<aside aria-hidden="true" className="hidden p-3 lg:block">diff --git a/frontend/src/services/api.js b/frontend/src/services/api.jsindex 3a5a291..9110748 100644--- a/frontend/src/services/api.js+++ b/frontend/src/services/api.js@@ -38,7 +38,7 @@ function readUploadError(responseText) {}}-// the browser posts the file straight to Cloudinary so the Worker never handles binary uploads+// the browser posts straight to Cloudinary so the Worker never handles binariesfunction uploadToCloudinary(file, cloudConfig, { onProgress } = {}) {const formData = new FormData();formData.append('file', file);@@ -64,7 +64,7 @@ function uploadToCloudinary(file, cloudConfig, { onProgress } = {}) {});}-// tracked item screenshots use fetch so failures surface exactly as before+// screenshots need no progress events and show cloudinary's own error messageasync function uploadImage(file, cloudConfig) {const formData = new FormData();formData.append('file', file);diff --git a/frontend/src/utils/trackedContent.js b/frontend/src/utils/trackedContent.jsindex 01890fc..7dce7fa 100644--- a/frontend/src/utils/trackedContent.js+++ b/frontend/src/utils/trackedContent.js@@ -1,11 +1,11 @@-// youtube reports real views; reddit dropped view_count in 2018, so its views are typed by hand+// youtube reports views; reddit dropped view_count in 2018 so they are typed inexport function trackedViews(item) {if (!item) return 0;if (item.contentType === 'youtube') return item.viewCount ?? 0;return item.manualViews ?? 0;}-// false for reddit posts with no views entered, so the ui can tell that apart from a real zero+// false for reddit posts with no views entered, so the ui can tell it from zeroexport function hasTrackedViews(item) {if (!item) return false;if (item.contentType === 'youtube') return item.viewCount !== undefined && item.viewCount !== null;