2025-10-28 12:17:58 +01:00
|
|
|
import { redirect } from "@sveltejs/kit";
|
2025-10-28 10:42:06 +01:00
|
|
|
import { getAnalytics, getFolders, getRecordings } from "$lib/services";
|
2026-03-05 10:19:05 +01:00
|
|
|
import { isModel } from "$lib/api";
|
2025-10-25 22:04:41 +02:00
|
|
|
|
|
|
|
|
export async function load({ locals, fetch }) {
|
2026-03-04 22:27:54 +01:00
|
|
|
// Redirect to login if not authenticated
|
|
|
|
|
if (!locals.authStatus.authenticated) {
|
|
|
|
|
throw redirect(302, "/login");
|
|
|
|
|
}
|
feat: add buttplug device recording feature (Phase 1 & 2)
Implemented complete infrastructure for recording, saving, and managing
buttplug device patterns with precise event timing.
**Phase 1: Backend & Infrastructure**
- Added Directus schema for sexy_recordings collection with all fields
(id, status, user_created, title, description, slug, duration, events,
device_info, tags, linked_video, featured, public)
- Created REST API endpoints in bundle extension:
* GET /sexy/recordings - list user recordings with filtering
* GET /sexy/recordings/:id - get single recording
* POST /sexy/recordings - create new recording with validation
* PATCH /sexy/recordings/:id - update recording (owner only)
* DELETE /sexy/recordings/:id - soft delete by archiving
- Added TypeScript types: RecordedEvent, DeviceInfo, Recording
- Created frontend services: getRecordings(), deleteRecording()
- Built RecordingCard component with stats, device info, and actions
- Added Recordings tab to /me dashboard page with grid layout
- Added i18n translations for recordings UI
**Phase 2: Recording Capture**
- Implemented recording state management in /play page
- Added Start/Stop Recording buttons with visual indicators
- Capture device events with precise timestamps during recording
- Normalize actuator values (0-100) for cross-device compatibility
- Created RecordingSaveDialog component with:
* Recording stats display (duration, events, devices)
* Form inputs (title, description, tags)
* Device information preview
- Integrated save recording API call from play page
- Added success/error toast notifications
- Automatic event filtering during recording
**Technical Details**
- Events stored as JSON array with timestamp, deviceIndex, deviceName,
actuatorIndex, actuatorType, and normalized value
- Device metadata includes name, index, and capability list
- Slug auto-generated from title for SEO-friendly URLs
- Status workflow: draft → published → archived
- Permission checks: users can only access own recordings or public ones
- Frontend uses performance.now() for millisecond precision timing
**User Flow**
1. User scans and connects devices on /play page
2. Clicks "Start Recording" to begin capturing events
3. Manipulates device sliders - all changes are recorded
4. Clicks "Stop Recording" to end capture
5. Save dialog appears with recording preview and form
6. User enters title, description, tags and saves
7. Recording appears in dashboard /me Recordings tab
8. Can play back, edit, or delete recordings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 04:05:09 +01:00
|
|
|
|
2026-03-04 22:27:54 +01:00
|
|
|
const recordings = await getRecordings(fetch).catch(() => []);
|
2025-10-28 12:17:58 +01:00
|
|
|
|
feat: add shared @sexy.pivoine.art/types package and fix type safety across frontend/backend
- Create packages/types with shared TypeScript domain model interfaces (User, Video, Model, Article, Comment, Recording, etc.)
- Wire both frontend and backend packages to use @sexy.pivoine.art/types via workspace:*
- Update backend Pothos objectRef types to use shared interfaces instead of inline types
- Update frontend $lib/types.ts to re-export from shared package
- Fix all type errors introduced by more accurate nullable types (avatar/banner as string|null UUIDs, author nullable, events/device_info as object[])
- Add artist_name to comment user select in backend resolver
- Widen utility function signatures (getAssetUrl, getUserInitials, calcReadingTime) to accept null/undefined
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 11:01:11 +01:00
|
|
|
const analytics = isModel(locals.authStatus.user!)
|
2026-03-04 22:27:54 +01:00
|
|
|
? await getAnalytics(fetch).catch(() => null)
|
|
|
|
|
: null;
|
2025-10-28 12:17:58 +01:00
|
|
|
|
2026-03-04 22:27:54 +01:00
|
|
|
const folders = await getFolders(fetch).catch(() => []);
|
2025-10-28 10:42:06 +01:00
|
|
|
|
2026-03-04 22:27:54 +01:00
|
|
|
return {
|
|
|
|
|
authStatus: locals.authStatus,
|
|
|
|
|
folders,
|
|
|
|
|
recordings,
|
|
|
|
|
analytics,
|
|
|
|
|
};
|
2025-10-25 22:04:41 +02:00
|
|
|
}
|