Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/preview-branch-cloudflare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Preview branch (Cloudflare)

on:
push:
branches-ignore:
- main

permissions:
contents: read
pull-requests: read

concurrency:
group: preview-branch-cloudflare-${{ github.ref_name }}
cancel-in-progress: true

jobs:
preview:
runs-on: ubuntu-latest
env:
BRANCH: ${{ github.ref_name }}

steps:
- name: Check out code
uses: actions/checkout@v5

- name: Check for an open pull request
id: pr
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
number=$(gh pr list \
--head "$BRANCH" \
--state open \
--json number \
--jq '.[0].number // empty')
echo "number=$number" >> "$GITHUB_OUTPUT"

- name: Skip branch preview when a PR preview owns it
if: steps.pr.outputs.number != ''
run: |
echo "Open PR #${{ steps.pr.outputs.number }} already deploys this branch's preview."

- name: Set up Node.js
if: steps.pr.outputs.number == ''
uses: actions/setup-node@v5
with:
node-version: "24"
cache: npm

- name: Install dependencies
if: steps.pr.outputs.number == ''
run: npm ci

- name: Type check
if: steps.pr.outputs.number == ''
run: npm run typecheck

- name: Run tests
if: steps.pr.outputs.number == ''
run: npm test

- name: Compute preview alias
if: steps.pr.outputs.number == ''
id: alias
run: |
alias=$(printf '%s' "$BRANCH" \
| tr '[:upper:]' '[:lower:]' \
| sed -E 's/[^a-z0-9-]+/-/g; s/^-+|-+$//g' \
| cut -c1-40)
if [ -z "$alias" ]; then
alias="branch-$(git rev-parse --short HEAD)"
fi
echo "value=$alias" >> "$GITHUB_OUTPUT"

- name: Upload preview version
if: steps.pr.outputs.number == ''
id: upload
run: |
npx wrangler versions upload \
--config platforms/cloudflare/wrangler.toml \
--preview-alias "${{ steps.alias.outputs.value }}" \
--var "APP_VERSION:branch-$(git rev-parse --short HEAD)" \
--message "Branch $BRANCH @ $(git rev-parse --short HEAD)" \
| tee wrangler-upload.log
url=$(sed -n 's/.*Version Preview Alias URL: \(https:[^[:space:]]*\).*/\1/p' wrangler-upload.log | head -1)
if [ -z "$url" ]; then
url=$(grep -oE 'https://[^[:space:]]*workers\.dev[^[:space:]]*' wrangler-upload.log | head -1)
fi
if [ -z "$url" ]; then
echo "::error::Could not find a preview URL in wrangler output."
exit 1
fi
echo "url=$url" >> "$GITHUB_OUTPUT"
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Write preview summary
if: steps.pr.outputs.number == ''
run: |
{
echo "### Cloudflare branch preview"
echo ""
echo "- **Branch:** \`$BRANCH\`"
echo "- **Commit:** \`${{ github.sha }}\`"
echo "- **Preview:** ${{ steps.upload.outputs.url }}"
echo ""
echo "This is a Worker *version* preview — it shares the production D1 database, so it reads/writes real data; it does not receive cron-triggered refreshes."
} >> "$GITHUB_STEP_SUMMARY"
9 changes: 7 additions & 2 deletions .github/workflows/preview-cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ jobs:

- name: Compute preview alias
id: alias
env:
PR_BRANCH: ${{ github.head_ref }}
run: |
alias=$(echo "${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/^-+|-+$//g')
alias=$(printf '%s' "$PR_BRANCH" \
| tr '[:upper:]' '[:lower:]' \
| sed -E 's/[^a-z0-9-]+/-/g; s/^-+|-+$//g' \
| cut -c1-40)
echo "value=$alias" >> "$GITHUB_OUTPUT"

- name: Upload preview version
Expand All @@ -43,7 +48,7 @@ jobs:
npx wrangler versions upload \
--config platforms/cloudflare/wrangler.toml \
--preview-alias "${{ steps.alias.outputs.value }}" \
--var APP_VERSION:pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) \
--var "APP_VERSION:pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD)" \
--message "PR #${{ github.event.pull_request.number }}" \
| tee wrangler-upload.log
url=$(grep -oE 'https://[^[:space:]]*workers\.dev[^[:space:]]*' wrangler-upload.log | head -1)
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>
<img alt="feedreader logo" src="web-static/favicon.svg" width="70" valign="middle">
&nbsp;reader
&nbsp;reader&thinsp;<img alt="" src="docs/assets/orange-dot.svg" width="8" height="8" valign="baseline" />
</h1>

<p>
Expand All @@ -16,7 +16,7 @@
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" />
</p>

![feedreader social card](web-static/og-image.png)
![feedreader social card](web-static/og-image.png?v=3)

---

Expand Down Expand Up @@ -62,7 +62,7 @@ npx lighthouse https://reader.boringcode.dev --view
- source filters
- real source icons in filters, dialog rows, and card metadata
- RSS-based app icon/favicon branding
- dark/light mode
- seven themes — Auto (follows the device), Ink, Paper, Sepia, Terminal, Glacier, and Ember — with a visual swatch picker
- inline expanding search
- reader settings dialog for theme, density, and source visibility
- iPhone landscape safe-area handling so content stays clear of the notch and Dynamic Island
Expand Down Expand Up @@ -335,12 +335,15 @@ Presentation-layer note:
- `Reading` — Article preview, bookmarks, and AI personalization
- `Sources` — visible sources
- tabs support click, arrow keys, Home, and End; validation jumps to `Sources` or `Reading` when that tab needs attention
- theme and density options are shown in a 2-column layout to reduce dialog height
- themes are shown as a 2-column swatch grid; density options sit below in a 2-column row
- the selected theme is applied when the dialog is saved, and the settings form scrolls internally on short screens
- clicking the dialog backdrop closes it
- background page scrolling is locked while the dialog is open
- selected sources are stored in `localStorage` under `feedreader.sources`
- selected density is stored in `localStorage` under `feedreader.uiDensity`
- selected theme is stored in `localStorage` under `feedreader.theme`
- selected theme is stored in `localStorage` under `feedreader.theme`; valid values are `system` (default), `dark`, `light`, `sepia`, `terminal`, `glacier`, and `ember`
- `system` resolves to the device's current light/dark preference and follows changes live; existing `dark`/`light` preferences keep working
- an inline pre-paint theme init script applies the stored preference before the stylesheet loads, avoiding a light/dark flash
- article preview is off by default and stored in `localStorage` under `feedreader.articlePreviewEnabled`
- bookmark controls are off by default and stored in `localStorage` under `feedreader.bookmarksEnabled`; enabling them shows the bookmark controls and Saved filter, and disabling them hides those controls without deleting saved items
- source-specific filters render as **real icon-only buttons**
Expand All @@ -360,6 +363,8 @@ Presentation-layer note:
- when enabled in Reader settings, clicking any card (including its title) loads a reader view in a right-hand panel instead of opening a new tab
- `Cmd`/`Ctrl`/`Shift`-clicking a title still opens the article in a new tab
- the panel shows the extracted title, byline, publication date/reading time, rich text with validated inline links/emphasis/inline code, image blocks with captions and intrinsic dimensions, and semantic tables; images load directly from the source with lazy loading and no referrer; `Open source` opens the original page
- consecutive list items render as one list and prose uses the full preview width; figures are capped in height so a single image cannot dominate the panel
- previews are source-aware: GitHub README previews drop the `GitHub - ` title prefix and decorative SVG/badge images, while Hugging Face paper previews render the abstract, authors, arXiv/PDF/project/GitHub links, and citing model, dataset, space, and collection lists instead of community comment chrome
- Hacker News items also show a **Comments** action inside the preview and card `…` dialogs; other sources omit it
- each card’s `…` dialog includes an **Open source** action that opens the article directly without opening the preview
- **Share** uses the device/browser share sheet when available and falls back to copying the article link; it is available in both the card and preview `…` dialogs
Expand Down Expand Up @@ -421,6 +426,8 @@ npm run db:migrate:local

- CI runs on pull requests and `main` pushes.
- CI checks type safety, unit tests, and a local D1 migration smoke run.
- Pull requests get a Cloudflare version preview commented on the PR.
- Non-`main` branch pushes get an automatic per-branch preview alias in the Actions run summary; branches with an open PR defer to the PR preview.
- Deploy runs on `main` pushes and manual dispatch.
- Deploy validates Cloudflare credentials, re-runs verification, applies remote D1 migrations, and deploys the Worker.

Expand Down
Loading
Loading