mirror of
https://github.com/R0m1k3/FlowReader.git
synced 2026-10-11 17:28:05 +02:00
- New Reader (desktop + mobile): loads full content on open, prefetches the next article, reading progress and time, "Aa" settings (light / sepia / dark / auto theme, serif / sans / Atkinson Hyperlegible font, size, line height, measure), Space-to-next, keyboard shortcuts, focus management, inert background, URL-driven (?a=) so Back closes it. - Dashboard: cursor pagination, unread/all filter, CSS grid (no masonry), no re-sorting under the reader, optimistic cache patches instead of refetch storms, "new articles" banner, error/offline states, j/k/o/m/s/v shortcuts and help dialog. - Cards: keyboard-openable, lazy <img>, memoized, touch-only swipe. - Focus mode: framer drag (drop @use-gesture), Read button, undo restores unread state, arrow keys. - WebSocket: single connection, backoff, cache patching, no console logs. - Contrast fixes (on-nature tokens), 44px targets, lang="fr", reduced motion, self-hosted fonts, theme applied before first paint. - Code splitting + vendor chunk, prompt-based PWA updates, smaller precache, offline cache for opened articles and images, caches cleared on logout; upgrade react-router (CVE), drop unused deps and assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
import { API_BASE, handleResponse, apiFetch } from './client';
|
|
|
|
export interface Feed {
|
|
id: string;
|
|
user_id: string;
|
|
url: string;
|
|
title: string;
|
|
description?: string;
|
|
site_url?: string;
|
|
image_url?: string;
|
|
last_fetched_at?: string;
|
|
fetch_error?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
unread_count?: number;
|
|
}
|
|
|
|
export interface AddFeedRequest {
|
|
url: string;
|
|
}
|
|
|
|
export const feedsApi = {
|
|
list(): Promise<Feed[]> {
|
|
return apiFetch<Feed[]>('/feeds');
|
|
},
|
|
|
|
async add(data: AddFeedRequest): Promise<Feed> {
|
|
const response = await fetch(`${API_BASE}/feeds`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
credentials: 'include',
|
|
body: JSON.stringify(data),
|
|
});
|
|
return handleResponse<Feed>(response);
|
|
},
|
|
|
|
async get(id: string): Promise<Feed> {
|
|
const response = await fetch(`${API_BASE}/feeds/${id}`, {
|
|
credentials: 'include',
|
|
});
|
|
return handleResponse<Feed>(response);
|
|
},
|
|
|
|
async update(id: string, title: string): Promise<Feed> {
|
|
const response = await fetch(`${API_BASE}/feeds/${id}`, {
|
|
method: 'PATCH',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
credentials: 'include',
|
|
body: JSON.stringify({ title }),
|
|
});
|
|
return handleResponse<Feed>(response);
|
|
},
|
|
|
|
async delete(id: string): Promise<void> {
|
|
const response = await fetch(`${API_BASE}/feeds/${id}`, {
|
|
method: 'DELETE',
|
|
credentials: 'include',
|
|
});
|
|
await handleResponse(response);
|
|
},
|
|
|
|
refresh(): Promise<{ message: string }> {
|
|
return apiFetch('/feeds/refresh', { method: 'POST' });
|
|
},
|
|
|
|
async importOPML(file: File): Promise<{ imported: number; skipped: number; errors?: string[] }> {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
const response = await fetch(`${API_BASE}/feeds/import/opml`, {
|
|
method: 'POST',
|
|
credentials: 'include',
|
|
body: formData,
|
|
});
|
|
return handleResponse(response);
|
|
},
|
|
};
|