feat: add generic custom data source widget#610
feat: add generic custom data source widget#610RC1140 wants to merge 1 commit intoimmichFrame:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (8)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThis PR adds a custom widget feature that enables users to display data fetched from external HTTP endpoints. It includes service-layer caching, API endpoints, configuration management, and a frontend Svelte component for rendering the widgets on the home page. Changes
Sequence DiagramsequenceDiagram
participant FrontEnd as Frontend Component
participant API as CustomWidget<br/>Controller
participant Service as CustomWidget<br/>Service
participant Cache as Memory Cache
participant External as External<br/>HTTP Source
FrontEnd->>API: GET /api/CustomWidget<br/>(clientIdentifier)
API->>Service: GetCustomWidgetData()
loop For each CustomWidgetSource
Service->>Cache: Check cache<br/>(key: customwidget_{url})
alt Cache Hit
Cache-->>Service: Return CustomWidgetData
else Cache Miss
Service->>External: GET {source.Url}
External-->>Service: JSON Response
Service->>Service: Deserialize JSON<br/>→ CustomWidgetData
Service->>Cache: Store with TTL<br/>(RefreshMinutes)
end
alt Success
Service->>Service: Add to results
else Error
Service->>Service: Log error,<br/>continue
end
end
Service-->>API: List<CustomWidgetData>
API-->>FrontEnd: HTTP 200 + Data
FrontEnd->>FrontEnd: Update widgetData<br/>Schedule next refresh
FrontEnd->>FrontEnd: Re-render widgets
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested Labels
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add a configurable widget that fetches structured data from user-specified URLs and displays it on the photo frame. Supports multiple data sources, each with independent cache TTL via CustomWidgetSources config. Backend: - CustomWidgetSourceConfig model for per-source URL + refresh interval - CustomWidgetData/CustomWidgetItem response models - ICustomWidgetService interface + CustomWidgetService with per-source caching - CustomWidgetController proxying data (keeps URLs server-side) - Settings: ShowCustomWidget, CustomWidgetSources, CustomWidgetPosition - ClientSettingsDto exposes ShowCustomWidget and CustomWidgetPosition Frontend: - custom-widget.svelte component with configurable corner positioning - Integrated into home-page.svelte with conditional render - Regenerated oazapfts API client with new types
|
Do you have any example sources by chance to test? |
|
@JW-CH Sorry I built that out myself will add some screenshots in a bit. This is what it looks like when rendered using the webview As mentioned the API endpoint I hit to get my strength data is a custom service and not really anything public, but returning the data in the structure below works for me atleast The idea here is that you have a title and then any number of rows returned which then gets rendered. You can add multiple sources if your data is not centralized |
50b48a5 to
8066eee
Compare
|
Dont know how much extra work this would be but you can test it with a small python server like this Paste that in a console and hit localhost:8080 |

Summary
Adds a configurable widget that fetches structured data from user-specified URLs and displays it on the photo frame. This enables displaying arbitrary external data (fitness stats, Home Assistant sensors, weather from custom sources, etc.) alongside photos.
/api/CustomWidget) — only display config is exposed to the clientConfiguration
Expected response format from data sources
{ "title": "My Stats", "items": [ { "label": "Metric A", "value": "42", "secondary": "optional detail" }, { "label": "Metric B", "value": "100" } ] }Changes
Backend (C# / ASP.NET Core):
CustomWidgetSourceConfigmodel for per-source URL + refresh intervalCustomWidgetData/CustomWidgetItemresponse modelsICustomWidgetService+CustomWidgetServicewith per-source cachingCustomWidgetController— proxies data (keeps URLs server-side)ShowCustomWidget,CustomWidgetSources,CustomWidgetPositionClientSettingsDtoexposes display config onlyFrontend (Svelte 5):
custom-widget.sveltecomponent with configurable corner positioninghome-page.sveltewith conditional renderingTest plan
ShowCustomWidget: falseSummary by CodeRabbit