Skip to content

feat: add pagination support to feeds#173

Merged
WaylonWalker merged 26 commits intodevelopfrom
feeds-are-too-big
Jan 22, 2026
Merged

feat: add pagination support to feeds#173
WaylonWalker merged 26 commits intodevelopfrom
feeds-are-too-big

Conversation

@WaylonWalker
Copy link
Owner

@WaylonWalker WaylonWalker commented Jan 19, 2026

Summary

Add pagination support to feeds with three pagination types and comprehensive security hardening.

Features

  • Add feed pagination configuration (items_per_page, pagination_type, enabled)
  • Implement three pagination types: htmx, manual, js
  • HTMX infinite scroll with partial loading
  • JavaScript-based infinite scroll using Intersection Observer
  • Manual page navigation with prev/next controls
  • Improve feed name sanitization with Python identifier conversion

Security

  • SHA-256 integrity verification for HTMX downloads (25+ versions supported)
  • Path traversal protection for feed slugs
  • XSS prevention in templates using |tojson filter
  • No CDN fallback - fail securely if HTMX download fails
  • Comprehensive security test suite

Other Changes

  • Add pagination static assets (CSS/JS)
  • Add pagination templates (feed_partial.html, feed_items_partial.html, pagination_controls.html)
  • Add pagination implementation guide documentation
  • Bump Python minimum version due to pydantic requirements
  • Add helper script for managing HTMX integrity hashes

- Add feed pagination configuration (items_per_page, pagination_type)
- Implement three pagination types: htmx, manual, js
- Add pagination templates for different UX patterns
- Include HTMX infinite scroll with partial loading
- Add JavaScript-based infinite scroll fallback
- Support manual page navigation
- Improve feed name sanitization with Python identifier conversion
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 19, 2026

Deploying markata with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89f316c
Status: ✅  Deploy successful!
Preview URL: https://c15a1803.markata.pages.dev
Branch Preview URL: https://feeds-are-too-big.markata.pages.dev

View logs

- Add SHA-256 integrity verification for HTMX downloads with timeout
- Remove unsafe CDN fallback, fail securely on download errors
- Sanitize config data in templates to prevent XSS injection
- Implement path traversal protection for feed slugs
- Fix duplicate resource injection in _ensure_head_links()
- Eliminate unsafe state mutation in pagination
- Add comprehensive security test suite

Addresses all critical issues from PR173-Security-Review.md
Security fixes:
- Add SHA-256 integrity verification for HTMX downloads with timeout
- Remove unsafe CDN fallback, fail securely on download errors
- Sanitize config data in templates to prevent XSS injection
- Implement path traversal protection for feed slugs
- Fix duplicate resource injection in _ensure_head_links()
- Eliminate unsafe state mutation in pagination
- Add comprehensive security test suite

Template refactoring:
- Extract 115-line pagination-js.js module with infinite scroll logic
- Generate pagination-config.js only when JS pagination is needed
- Replace 277-line template with 85-line clean template (70% reduction)
- Move CSS to existing pagination.css file
- Fix template variable conflicts (config vs pagination_context)
- Remove orphaned pagination.js file, keep pagination-js.js

Addresses all critical security issues and eliminates template bloat while maintaining functionality.
- Rename pagination-js.js to pagination.js to simplify naming
- Update all plugin references from pagination-js.js to pagination.js
- Update template script src reference to use pagination.js
- Maintains functionality with cleaner file naming
- Update pagination implementation guide to reference correct plugins
- Remove unneeded temporary files (paginated_feeds.py, pagination.py, partial/, etc.)
- Correct documentation to focus on feeds.py with integrated pagination
- Remove references to non-existent pagination plugin hooks
- Provide accurate examples for current implementation

Documentation now accurately reflects the actual codebase structure with pagination integrated into feeds plugin.
- Add from __future__ import annotations for PEP 563 deferred evaluation
- Move SilentUndefined and MarkataFilterError outside TYPE_CHECKING block
- Clean up duplicate imports and consolidate rich imports
- Add per_page validation to prevent division by zero
- Handle empty feeds gracefully (create one empty page)
- Add XSS protection with |tojson filter in feed_partial.html template
- Add response.ok check in pagination.js fetch handling
- Add retry limit (maxRetries=3) for infinite scroll to prevent loops
- Add showError method to display error message after max retries
- Add destroy method and beforeunload cleanup to prevent memory leaks
- Add container null check before DOM manipulation
@WaylonWalker WaylonWalker merged commit 836feb4 into develop Jan 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant