feat(routes-f): clip auto-tag, VOD playlist, rerun loop, stream cover#1073
Closed
DeFiVC wants to merge 284 commits into
Closed
feat(routes-f): clip auto-tag, VOD playlist, rerun loop, stream cover#1073DeFiVC wants to merge 284 commits into
DeFiVC wants to merge 284 commits into
Conversation
- Stream whitelist: streamers can allow specific users (by username or wallet) to watch private streams - Clips: viewers can create 30s clips from live streams via a scissor button - Feature flags: DB-backed system with per-user overrides, rollout %, and admin CRUD API - User preferences: cross-device settings (quality, notifications, theme, language, chat) with GET/PATCH endpoint - DB migration: add stream_clips, stream_whitelist, feature_flags, user_preferences tables - Settings nav: new Preferences tab wired into settings layout
Add POST endpoint supporting standard and URL-safe base64 encoding/decoding with optional padding control. Caps input at 1 MB, includes comprehensive test coverage for both variants and error cases. Refs StreamFi-x#570
Add GET endpoint for currency conversion with 20+ supported currencies using bundled exchange rates. Rounds to 4 decimals for rates, 2 for amounts, includes expiration metadata and full test coverage. Refs StreamFi-x#557
Add POST endpoint that decodes JWT header and payload without signature verification. Returns decoded claims, warnings for expiration and missing standard claims, and explicit 'not verified' notice. Includes tests for valid, expired, and malformed tokens. Refs StreamFi-x#572
Add POST endpoint for markdown-to-HTML conversion with heading extraction and word counting. Supports headings, bold, italic, inline code, code blocks, links, lists, and paragraphs. Sanitizes by default to strip scripts, event handlers, and javascript: URLs. Preserves code block content exactly. Refs StreamFi-x#635
add post /api/routes-f/feedback for anonymous feedback collection. - validates message length (10-2000), category enum, optional contact - strips html tags from message and contact before in-memory storage - in-folder rate limiter: 5 submissions per ip per hour - unit tests cover validation, html stripping, and rate limit per ip scoped entirely to app/api/routes-f/feedback/; no shared lib changes. closes StreamFi-x#566
ts1117: object literal had two 'right' entries (lines 11, 16). removing the second (65) preserves the higher-frequency value (420). unrelated to the feedback endpoint, but blocks ci typecheck across all open prs; folding into this pr to unblock StreamFi-x#566.
- wrap if-body in braces (curly rule) in stripHtmlTags - drop unused 'error' binding in catch in route.ts
mechanical lint fixes that block ci eslint on every open pr: - wrap single-statement if/else bodies in braces (curly rule) across anagram, captcha-math, emoji, isbn, joke, palindrome, register, user-agent, viewer/history, word-frequency, and addfundsbutton. - drop unused NextRequest import and dead 'usedTokens' set in captcha-math/route.ts. unrelated to this pr's feature work, but folded in to unblock StreamFi-x#566; each fix is mechanical and changes no runtime behavior.
feat: add clips, whitelist, feature flags, and user preferences
…fy (StreamFi-x#560-563) All files scoped entirely to app/api/routes-f/ per task constraints. No imports from lib/, utils/, types/, or components/. StreamFi-x#560 — Feature flag store endpoint - feature-flags/route.ts: GET (all / single / rollout check), PUT (create/update), DELETE. In-memory Map store in _lib/store.ts. - Deterministic percentage rollout via djb2-style hash of (flagKey:userId). - Tests cover CRUD, validation, rollout bucketing (~50% distribution check). StreamFi-x#561 — Event ingestion with batching - events/route.ts: POST accepts { event } or { events: [...] }, validates each event (required name+timestamp, optional properties object), rejects batches > 100. GET returns paginated results. - Bounded ring-buffer of 10,000 events in _lib/buffer.ts; oldest evicted on overflow. - Tests cover single/batch submit, validation, eviction, non-overlapping pages. StreamFi-x#562 — UUID generator endpoint (v4 and v7) - uuid/route.ts: GET ?version=v4|v7&count=1..100. - uuid/_lib/generators.ts: inline uuidV4() and uuidV7() using crypto.getRandomValues(); no external libraries. - v4: random 128 bits with RFC 4122 version/variant bits. - v7: 48-bit Unix-ms timestamp prefix for time-ordered sorting. - Tests verify format, version nibble, variant bits, uniqueness, time-ordering. StreamFi-x#563 — Slugify endpoint - slugify/route.ts: POST { text, separator?, maxLength? } → { slug }. - slugify/_lib/slugify.ts: NFD decomposition + diacritic strip, emoji removal, lowercase, separator collapse, word-boundary truncation. - Tests cover 15+ varied inputs: diacritics, emoji, punctuation, truncation.
…60-561-562-563
- avatar-initials/route.ts: GET ?name=...&size=128 returns image/svg+xml with Cache-Control: public, max-age=31536000 (deterministic output, 1-year cache). - avatar-initials/_lib/avatar.ts: extractInitials (first+last word, max 2), clampSize (32-512), deterministic background via djb2 name hash → HSL hue, WCAG luminance check to pick white or black foreground for adequate contrast. - Tests: initials extraction, size clamping, SVG determinism, foreground contrast, Content-Type header, Cache-Control header, size clamping via route, 400 on missing/blank name. All files inside app/api/routes-f/avatar-initials/.
dtrsmfi frontnd implementation
Adds /api/routes-f/email-validate with RFC 5322 subset validation, disposable-domain detection, role-based detection, and Gmail normalization. Includes scoped unit tests. Made-with: Cursor
… creator onboarding APIs Closes StreamFi-x#419, StreamFi-x#414, StreamFi-x#406, StreamFi-x#412
…60-561-562-563 feat(routes-f): feature flags, event ingestion, UUID generator, slugify, avatar-initials (StreamFi-x#560-563 StreamFi-x#582)
Adds missing admin helper export, fixes typed SQL parameter cast, and removes duplicate key in word-frequency corpus. Made-with: Cursor
… creator onboarding APIs (StreamFi-x#419, StreamFi-x#414, StreamFi-x#406, StreamFi-x#412)
…-referrals-presence-onboarding feat(routes-f): items catalog, creator referral program, viewer presence & onboarding checklist APIs
…terministic quotes, HTML escape/unescape, and case converter - Add HTTP status code lookup endpoint (StreamFi-x#663) - GET /api/routes-f/http-status?code=404 returns status details - GET /api/routes-f/http-status lists all statuses grouped by category - Includes ~60 HTTP status codes with RFC references - Returns 404 with suggestions for unknown codes - Add deterministic quote of the day endpoint (StreamFi-x#654) - GET /api/routes-f/quote/today returns deterministic quote by date - GET /api/routes-f/quote/random?category=... returns random quote - GET /api/routes-f/quote/[id] returns specific quote - Bundles ~200 quotes across 5 categories (technology, inspiration, business, science, philosophy) - Add HTML escape/unescape endpoint (StreamFi-x#662) - POST /api/routes-f/html-escape with {input, mode} converts text - Escape mode handles <, >, &, ", ' - Unescape mode handles ~80 named entities and numeric entities - 1MB input size limit with proper error handling - Add string case converter endpoint (StreamFi-x#658) - POST /api/routes-f/case-convert with {text, target?} converts case formats - Supports 7 formats: camelCase, snake_case, kebab-case, PascalCase, CONSTANT_CASE, Title Case, Sentence case - Auto-detects input case and preserves numbers - Returns all formats when no target specified All endpoints include comprehensive test coverage and follow the scope constraint of keeping files within app/api/routes-f/ directory. Closes StreamFi-x#663, StreamFi-x#654, StreamFi-x#662, StreamFi-x#658
…s, and raids - Close StreamFi-x#535 - Close StreamFi-x#459 - Close StreamFi-x#465 - Close StreamFi-x#463
…1-966-964 feat(routes-f): category switch, pinned msg, timeout, min tip
…ces, broadcast live closes StreamFi-x#1010 closes StreamFi-x#1012 closes StreamFi-x#1013 closes StreamFi-x#1018
…-subscription-tips-categories feat(routes-f): add tips, subscription, and category feeds
…re-feed-raid-notif-prefs-broadcast feat(routes-f): explore feed, raid suggestions, notification preferences, broadcast live
…s-f-features feat(routes-f): subscription and chat features
…-routes-f-stream-health-tips-badges feat(routes-f): stream heartbeat, tip alert config, tip goal progress, viewer badge grant
Adds app/api/routes-f/mute-creator/ with POST, DELETE, and GET handlers
so followers can mute creators (hiding live alerts) without unfollowing.
Implementation:
- _lib/types.ts — MuteRecord interface { follower_id, creator_id, muted_at }
- _lib/store.ts — in-memory Map store keyed by follower:creator composite
key for O(1) mute/unmute lookups; exports muteCreator, unmuteCreator,
listMutedCreators, and __resetMuteStore for test isolation
- route.ts — three handlers:
POST { follower_id, creator_id } → 201 { muted_at } or 409 if already
muted, 400 if self-mute attempted
DELETE { follower_id, creator_id } → 200 on success, 404 if no mute exists
GET ?follower_id=<id> → 200 { muted, count } sorted by muted_at
- __tests__/route.test.ts — 9 tests covering mute success, duplicate mute (409),
self-mute (400), missing fields (400), unmute success, unmute non-existent (404),
empty list, multi-creator list scoped to follower, and list after unmute
Closes StreamFi-x#982
Closes StreamFi-x#987
Closes StreamFi-x#991
Closes StreamFi-x#993
…87-991-993 feat(routes-f): add mute/unmute creator route
…comments, gift subscription (closes StreamFi-x#1000, StreamFi-x#996, StreamFi-x#1004, StreamFi-x#986)
Implements GET and POST for viewer watch history tracking. GET returns entries sorted by watched_at desc with configurable limit. POST records entries and deduplicates by (viewer_id, target_id), keeping the latest timestamp via ON CONFLICT ... DO UPDATE. Includes tests covering validation, dedup behavior, ordering, and error handling.
Implements GET for generating shareable tip recap card payloads. Returns creator, tipper (or anonymous placeholder), amount, asset, message, and image_meta for a given tip_id. Returns 404 for unknown tips. Includes tests covering present tips, anonymous tips, missing tips, and error handling.
Implements POST, DELETE, and GET for tracking and capping concurrent playback sessions per viewer. POST registers a session (returns 429 when the 3-session cap is hit), DELETE removes a session, and GET lists active sessions. Includes tests covering register, duplicate detection, cap enforcement, eviction, and error handling.
Implements POST, DELETE, and GET for scheduled stream reminder opt-in. POST sets a reminder for a scheduled stream (resolves fires_at from the stream's scheduled_at), DELETE unsubscribes, and GET lists upcoming reminders. Includes tests covering signup, cancel, listing, and error handling.
…-history-tip-recap-session-cap-reminders feat(routes-f): viewer watch history, tip recap, session cap, stream reminders
Implement POST endpoint that suggests tags for a clip from its title and description using an in-memory keyword-to-tag mapping. - Bundle keyword-to-tag mapping covering gaming, music, irl, crypto, creative, sports, tech, and just_chatting categories - Return top 5 matching tags ranked by relevance score - Support multi-word keyword matching (exact phrase and prefix) - Add input validation for title (required) and description (optional) - Include comprehensive tests for gaming/music/irl titles and edge cases Closes StreamFi-x#1050
Implement playlist management endpoints allowing viewers to maintain custom VOD watch playlists with append, remove, and reorder operations. - GET returns playlist for a viewer_id - POST appends a VOD to the playlist - DELETE removes a VOD from the playlist - POST /reorder reorders playlist items by vod_id array - Cap playlist at 100 items with validation - Prevent duplicate VOD additions - Include comprehensive lifecycle tests covering all operations Closes StreamFi-x#1051
Implement endpoints to configure a VOD to auto-play as a rerun when the creator is offline, with toggle and clear operations. - POST sets rerun config with creator_id, vod_id, and enabled flag - GET returns current rerun status for a creator - DELETE clears the rerun configuration - Track started_at timestamp when rerun is enabled - Include tests covering toggle, clearing, and inactive state Closes StreamFi-x#1052
Implement endpoints to set and retrieve a custom cover image for the most recent stream session with URL validation. - POST sets cover image with stream_id and cover_url - GET retrieves current cover for a stream_id - Validate URL format using new URL() constructor - Return updated_at timestamp on successful set - Include tests for set, retrieve, overwrite, and invalid URL cases Closes StreamFi-x#1053
👷 Deploy request for streamfi pending review.Visit the deploys page to approve it
|
|
@DeFiVC is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @DeFiVC — thanks for the contribution! This repo uses Please re-open this PR against
Or open a fresh PR from the GitHub UI with |
|
@DeFiVC Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1050, Closes #1051, Closes #1052, Closes #1053
Type of Change
Summary
This PR implements four new API routes under
app/api/routes-f/for the StreamFi platform: a clip auto-tag generator that suggests tags from title/description, a VOD playlist manager with append/remove/reorder operations, a stream rerun loop configuration for offline creators, and a featured stream cover image setter with URL validation. All routes use in-memory stores with comprehensive test coverage.Motivation / Context
These four features extend the StreamFi platform's content management and viewer experience capabilities. The clip auto-tag generator helps streamers categorize content, the VOD playlist lets viewers curate watch lists, the rerun loop keeps channels active when creators are offline, and the cover image endpoint enables stream branding.
Closes #1050, Closes #1051, Closes #1052, Closes #1053