6.3 kB 90 lines
f1ceffba
⋯
apps/news/CLAUDE.md
download raw history
at main Markdown

c8-news #

News: the feed reader, and c8-news-tile that keeps its live tile fresh. Depends on: c8ui, libxml2, gdk-pixbuf, curl (run time).

org.cont8nuum.News, one copy (c8ui_app_main). Shared core (news-core, no window system, also linked by the tile provider): store.c (feeds and settings in ~/.config/cont8nuum/news.ini, read stories as a list of hashes in the data dir, news_flush), fetch.c (curl as a subprocess: conditional GET with ETag/Last-Modified, http/https only, file:// when C8_NEWS_ALLOW_FILE is set, which is how to test), feed.c (libxml2: XML_PARSE_NO_XXE is 2.14's, defined as 0 for older ones (Debian 13's), which never load external entities unasked; RSS 2, RSS 1/RDF and Atom, the raw file cached under ~/.cache/cont8nuum/news/ so stories show before the network answers; a page that isn't a feed is searched for <link rel=alternate> once, and one that leads to a feed already followed is refused), html.c (feed HTML to Pango markup for the article, to text for summaries, libxml2's HTML parser; the first real <img> is the picture when the feed gives none), image.c (pictures downloaded into the cache and decoded on demand, 480 px, 64 kept, never enlarged; news_image starts the download and returns NULL until it is there, news_image_on_ready; news_image_large up to 1920 px, 2 kept, for the top story and the article), news_feed_logo (feed.c: RSS <image>, Atom <icon>/<logo>, else the site's /favicon.ico), tile.c (newest five as tagged updates, peek with a picture, text without, wide.template=imagetext, unread count as the badge; sent to both org.cont8nuum.News and the news tile of news.widget). main.c is the app, after Windows 8's News (groovyPost's Release Preview walkthrough): light grey, a hub (no title) opening on the top story (hero, a full section: the newest unread story with a picture, across the window, "NEWS / TOP STORY", a white rule, the headline in big bold capitals, the source line, the summary in serif), then Latest (without the top story) and a section per feed: a two-line header ("SITE / FEED ▸", head, opens the section's page, focusable) over two columns of CELL tiles (hubsec fits as many rows as the height has room for), the newest story with a picture 2x1 first. draw_tile: a picture with the headline over it, or a red or black gradient (is_red, by id) with the headline in bold capitals, the source line (logo, name, "7 HOURS AGO") and the summary in SERIF (Source Serif Pro); read ones fade. The section lists keep their tiles (c8ui_list_set_keep) and the top story is a c8ui_kept_draw; news_image_missed (set when news_image says NULL for a picture still downloading or decoding, on a thread) makes them not final; the minute timer redraws for the ages. Pages go on a stack over the hub (push_page/pop_page, Escape/back): a section's page (every story, the lead one 2x2), Sources (every feed as its logo or its letter on red, Add a source), the article (back button and header, lead column: bold headline, "By author, feed", date, picture; the body in serif c8ui_rich_columns_new across a sideways scroll). Right-click/hold or the Menu key shows both bars: the nav bar (maroon, Top stories / Sources, glyphs in data/glyphs, installed to share/c8-news) and the app bar (story: open, copy link, mark read/unread, unfollow; global: refresh, add a source, mark all read); feeds changing rebuild the hub and drop the pages (Sources comes back). The add dialog (Enter adds; the entry is c8ui_entry_set_enter_only, so leaving it with text typed doesn't), the Search charm over every story and the Settings charm's Options and Feeds pages. Narrow: every page is built once and reflows (2026-12-01; before, a relayout built the hub and the article again per width). The hub is c8ui_hub_set_narrow_column: its sections go down one column (the hero as a NARROW_HERO_H card, each section's head over two columns of tiles: hubsec measures to NARROW_FITS tiles when narrow), the article's row turns vertical and its scroll goes down (c8ui_scroll_set_narrow_directions; the rich columns become one), margins NARROW_PAD by the boxes' narrow paddings. resized only sets the lists' cell sizes. Tested headless, 2026-12-01: hub and article snapped and back mid-article, the column's wheel, snapping from a panned hub (starts at the section mostly in view). Stories are found again by feed url + id because a refresh replaces them. rssnail (rssnail.c, in news-core): when c8-accounts has an account with rssnail on, news_feeds becomes its subscriptions (feed->remote = subscription id; the local ones stay in news_local_feeds(), news.ini), switched only once they arrive (rs.attached before news_synced) or from the cache (rssnail-subscriptions.json, rssnail-ID.json per feed's posts, all deleted with the account). Posts become stories (story->post; full text, else content, else summary; pictures only from rssnail's image proxy: its image_url, else the text's first /api/img/ one, never the site's own; the API address is kept in rssnail.ini so cached posts resolve them before the token comes; feed logos are still the site's favicon, rssnail has none). Read state, mark all, add (POST /api/feeds) and unfollow (DELETE /api/subscriptions/ID) go to the server; a 401 asks for a fresh token once. The first time an account is used the app adds the local feeds it lacks (remembered per account in ~/.local/share/cont8nuum/news/rssnail.ini; the tile provider never does). Accounts' Changed makes it ask again (turned off: back to the local feeds). news_remote_fn tells the app (rebuild, or a dialog when loud). The Feeds charm page says when it's synced. c8-news-tile TILE-ID (provider.c, from news.widget's Provider=) refreshes without a window and quits on Restarting or when the shell has been gone a minute. Tested: parsing, discovery, read state, pictures; the redesign in a nested headless c8 with local feeds (C8_NEWS_ALLOW_FILE): hub, top story, sections, a section's page, Sources, the article, both bars, by keyboard. Untested: the mouse and touch paths (header click, right-click on a tile), real feeds and favicons over the network, the app on a real session, the charms pages.