feat: add Atom feeds and JSON/CSV import/export
Phase 5 — Feeds & Import/Export:
- Atom feeds: global (/feed.xml), per-user (/u/{name}/feed.xml),
per-tag (/tags/{name}/feed.xml). Uses gorilla/feeds.
- JSON export: all user's faves with tags, pretty-printed
- CSV export: standard format with header row
- JSON import: validates and creates faves with tags
- CSV import: flexible column mapping from header row
- Import/export pages with format documentation
- Feed items include enclosure for images, author info
- Limited-visibility profiles excluded from feeds
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
13aec5be6e
commit
4e9db3f995
7 changed files with 463 additions and 0 deletions
|
|
@ -112,6 +112,18 @@ func (h *Handler) Routes() *http.ServeMux {
|
|||
mux.Handle("POST /settings/avatar", requireLogin(http.HandlerFunc(h.handleAvatarPost)))
|
||||
mux.Handle("POST /settings/password", requireLogin(http.HandlerFunc(h.handleSettingsPasswordPost)))
|
||||
|
||||
// Feeds (public, no auth required).
|
||||
mux.HandleFunc("GET /feed.xml", h.handleFeedGlobal)
|
||||
mux.HandleFunc("GET /u/{username}/feed.xml", h.handleFeedUser)
|
||||
mux.HandleFunc("GET /tags/{name}/feed.xml", h.handleFeedTag)
|
||||
|
||||
// Import/Export (authenticated).
|
||||
mux.Handle("GET /export", requireLogin(http.HandlerFunc(h.handleExportPage)))
|
||||
mux.Handle("GET /export/json", requireLogin(http.HandlerFunc(h.handleExportJSON)))
|
||||
mux.Handle("GET /export/csv", requireLogin(http.HandlerFunc(h.handleExportCSV)))
|
||||
mux.Handle("GET /import", requireLogin(http.HandlerFunc(h.handleImportPage)))
|
||||
mux.Handle("POST /import", requireLogin(http.HandlerFunc(h.handleImportPost)))
|
||||
|
||||
// Admin panel (requires admin role).
|
||||
admin := func(hf http.HandlerFunc) http.Handler {
|
||||
return requireLogin(middleware.RequireAdmin(http.HandlerFunc(hf)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue