this repo has no description

webcal support

+18 -4
+13 -3
islands/URLInput.tsx
··· 47 47 // Handle URL input changes 48 48 const handleUrlChange = (e: Event) => { 49 49 const target = e.target as HTMLInputElement; 50 - onChange(target.value); 51 - if (onError) onError(null); 50 + const newValue = target.value; 51 + 52 + onChange(newValue); 53 + 54 + // Validate URL format 55 + if (onError) { 56 + if (newValue && !newValue.match(/^(https?:\/\/|webcal:\/\/)/i)) { 57 + onError("URL must begin with https://, http://, or webcal://"); 58 + } else { 59 + onError(null); 60 + } 61 + } 52 62 }; 53 63 54 64 // Handle URL input focus ··· 75 85 value={value} 76 86 onInput={handleUrlChange} 77 87 onFocus={handleUrlFocus} 78 - placeholder="https://example.com" 88 + placeholder="https://, http://, or webcal://" 79 89 className="url-input" 80 90 ref={urlInputRef} 81 91 />
+5 -1
utils/calendarUtils.ts
··· 33 33 if (!icalUrl) { 34 34 throw new Error("Must provide an iCalendar URL."); 35 35 } 36 - const response = await fetch(icalUrl); 36 + 37 + // Convert webcal:// to https:// for fetching 38 + const fetchUrl = icalUrl.replace(/^webcal:\/\//i, "https://"); 39 + 40 + const response = await fetch(fetchUrl); 37 41 if (!response.ok) { 38 42 throw new Error( 39 43 `Failed to fetch calendar data: ${response.statusText}`,