$ show nextcloud/news
Nextcloud News is an RSS/Atom feed reader app for Nextcloud. It provides a PHP backend (MVC with controllers, services, DB mappers) and a Vue 3 + TypeScript frontend. Users can subscribe to feeds, organize them into folders, read articles with read/unread/starred states, apply keyword filters, import/export OPML, and sync with mobile/desktop clients via REST APIs. Background cron jobs handle feed updates and cleanup. The architecture follows Nextcloud's app framework with scoped dependencies to avoid conflicts. Key entry points include the web UI (Vue SPA), CLI commands (`occ news:*`), and API endpoints (v1-2, v1-3, v2). External dependencies include feed-io for parsing, Guzzle/PSR-18 for HTTP, and Readability.php for full-text extraction. The codebase is well-tested with unit, integration, and BATS tests, and uses modern tooling (Vite, PHP 8.2+).
The LLM identified 5 files worth highlighting for reuse:
Generates OPML XML from folder and feed data. Uses DOMDocument for well-formed output, handles encoding, and is decoupled from Nextcloud specifics (only requires feed/folder entities). Can be extracted as a standalone OPML writer for any feed reader application.
Parses OPML XML into a structured array of folders and feeds. Handles error recovery (malformed XML, missing attributes) and returns a clean result object. Standalone and reusable for any OPML import workflow.
Sanitizes HTML content from feed articles using DOMDocument and an allowlist of tags/attributes. Removes dangerous elements (script, iframe, object) while preserving safe formatting. Configuration-driven and easily portable to other PHP projects needing HTML cleaning.
A trait that adds `toAPI()` and `toAPI2()` methods to Nextcloud entities for consistent JSON API output. Uses reflection to convert public properties to camelCase keys, with optional field reduction. Can be adapted for any ORM entity requiring standardized API serialization.
A wrapper around Nextcloud's HTTP client that adds request-level scoping (timeout, redirect limits, SSRF validation) for feed fetching. Demonstrates the decorator pattern for adding security constraints to an existing HTTP client. The SSRF protection via IRemoteHostValidator is a reusable security pattern.