5* Returns null if authentication is successful, or a Response if it fails
6*/
7export async function basicAuthMiddleware(req: Request): Promise<Response | null> {
8const realm = "Usage Dashboard";
9const unauthorizedResponse = new Response("Unauthorized", {
17});
1819export function App() {
20const [audio, setAudio] = useLocalStorage("AUDIO", false);
21const user = useUser();
america-chronmain.tsx1 match
3const url = "https://voxdeitv-411l.onrender.com/";
45export default async function(req: Request): Promise<Response> {
6try {
7https
africa-chronmain.tsx1 match
3const url = "https://chron-waker.onrender.com";
45export default async function(req: Request): Promise<Response> {
6try {
7https
Okmigrations.ts6 matches
16* Initialize all database tables
17*/
18export async function initializeDatabase(): Promise<void> {
19await createParentsTable();
20await createDevicesTable();
26* Create parents table
27*/
28async function createParentsTable(): Promise<void> {
29await sqlite.execute(`
30CREATE TABLE IF NOT EXISTS ${TABLES.PARENTS} (
43* Create devices table
44*/
45async function createDevicesTable(): Promise<void> {
46await sqlite.execute(`
47CREATE TABLE IF NOT EXISTS ${TABLES.DEVICES} (
66* Create recording sessions table
67*/
68async function createSessionsTable(): Promise<void> {
69await sqlite.execute(`
70CREATE TABLE IF NOT EXISTS ${TABLES.SESSIONS} (
92* Create uploads table for tracking Google Drive uploads
93*/
94async function createUploadsTable(): Promise<void> {
95await sqlite.execute(`
96CREATE TABLE IF NOT EXISTS ${TABLES.UPLOADS} (
114* Create indexes for better performance
115*/
116export async function createIndexes(): Promise<void> {
117const indexes = [
118`CREATE INDEX IF NOT EXISTS idx_devices_parent_id ON ${TABLES.DEVICES}(parent_id)`,
1// Shared utility functions
23import type { RecordingDuration, ApiResponse } from './types.ts';
6* Generate a unique ID for sessions, devices, etc.
7*/
8export function generateId(): string {
9return crypto.randomUUID();
10}
13* Format duration for display
14*/
15export function formatDuration(duration: RecordingDuration): string {
16switch (duration) {
17case '10min':
29* Convert duration to milliseconds
30*/
31export function durationToMs(duration: RecordingDuration): number {
32switch (duration) {
33case '10min':
45* Format timestamp for display
46*/
47export function formatTimestamp(date: Date): string {
48return new Intl.DateTimeFormat('en-US', {
49year: 'numeric',
59* Check if device is online (last seen within 5 minutes)
60*/
61export function isDeviceOnline(lastSeen: Date): boolean {
62const fiveMinutesAgo = new Date(Date.now() - 5 * 60 * 1000);
63return lastSeen > fiveMinutesAgo;
67* Create a standardized API response
68*/
69export function createApiResponse<T>(
70success: boolean,
71data?: T,
84* Validate recording duration
85*/
86export function isValidDuration(duration: string): duration is RecordingDuration {
87return ['10min', '40min', '24hr'].includes(duration);
88}
91* Generate a secure device ID based on browser fingerprint
92*/
93export function generateDeviceId(): string {
94const canvas = document.createElement('canvas');
95const ctx = canvas.getContext('2d');
108].join('|');
109
110// Simple hash function
111let hash = 0;
112for (let i = 0; i < fingerprint.length; i++) {
122* Check if browser supports required features
123*/
124export function checkBrowserSupport(): { supported: boolean; missing: string[] } {
125const missing: string[] = [];
126
150* Request necessary permissions
151*/
152export async function requestPermissions(): Promise<{ granted: boolean; errors: string[] }> {
153const errors: string[] = [];
154
422. Configure parent authentication
433. Install the child interface on the target device
444. Test recording and upload functionality
4546## Environment Variables
untitled-7533ESM.tsx1 match
14};
1516export default function HustlersToolkitApp() {
17const [isLoggedIn, setIsLoggedIn] = useState(false);
18const [user, setUser] = useState({
1export default async function(req: Request): Promise<Response> {
2const html = `<!DOCTYPE html>
3<html lang="en">
1export default async function(req: Request): Promise<Response> {
2try {
3// Fetch the HTML from the specified URL