Commit graph

6 commits

Author SHA1 Message Date
Huang Xin
85db6faf49
fix(opds): allow trusted private catalogs at runtime (#7225)
Add the server-only READEST_TRUSTED_PRIVATE_HOSTS exact hostname allowlist
for self-hosted OPDS catalogs. Read it at request time, recheck redirects,
and preserve private-address and DNS checks for unlisted destinations.
Let self-hosted catalog forms submit LAN URLs and document Docker setup.

Verified: 113 focused and neighboring proxy tests passed; pnpm lint,
Biome formatting, pnpm build-web and Docker Compose configuration passed.
The same production build denied private hosts by default, then allowed
GET/HEAD with a runtime-only allowlist after restart. A fresh browser
added the LAN catalog and opened its publication feed.

Without the fix, the new OPDS proxy tests returned 400 instead of 200,
and the self-hosted catalog form never called validateOPDSURL.

Full-suite verification is unresolved: the default run had 4 timeouts
and a TTS timer teardown error; the 4-worker rerun had 6 timeouts and
4 worker startup failures. An unchanged-main comparison reproduced a
ControlPanelUpdateReset timeout. Related reliability tracking: #7217.
No Docker image build or reporter deployment verification was performed.

Reported by YorrickBao on GitHub.
Fixes #7105

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-11-01 17:26:53 +01:00
Huang Xin
b80d83534e
feat(payments): separate storage and customization entitlements, unlock all when self-hosted (#5996)
* feat(payments): gate premium features on Full Customization

Premium access was any of plus, pro or purchase, and `getUserProfilePlan`
reports `purchase` for anyone holding ANY one-time purchase, which is how
a storage add-on presents. Buying space therefore unlocked cloud sync,
TTS download and Send to Readest as a side effect.

Route every premium gate through one predicate: a paid subscription, an
outright Full Customization unlock, or a self-hosted deployment.
`PREMIUM_PLANS` is plus and pro only; `purchase` is deliberately absent,
because that is exactly the value a storage-only buyer reports.

* isCloudSyncAllowed, isTTSCacheAllowed and isEmailInPlan now take the
  customization claim and delegate to isCustomizationAllowed. Both server
  routes under pages/api/send move with them, so the client and the
  server cannot disagree about who is entitled.
* Self-hosted deployments unlock everything, signed in or not. There is
  no store to buy from and the operator already runs the infrastructure
  the paywall funds. SELF_HOSTED is wired through runtimeConfig the same
  way STORAGE_FIXED_QUOTA is, and defaults to true in docker.
* STORAGE_GRANTS_CUSTOMIZATION keeps storage add-ons unlocking
  customization during the launch grace period. It drives a durable
  payment row rather than a derived rule, so switching it off cannot
  revoke anyone who bought while it was on: updateUserStorage is the only
  writer of customization_purchased and reruns on every later purchase.
  Recording the grant never fails the purchase it rides on.
* Google Play acknowledges a permanent unlock instead of consuming it.
  Consuming is what lets a SKU be rebought, which storage needs and an
  unlock must not have. isConsumablePurchase is an allowlist: an
  unrecognised product that cannot be repurchased is caught in testing,
  while wrongly consuming an unlock costs a user real money. It is still
  acknowledged, or Play auto-refunds after three days.
* The Lifetime card shows Full Customization as unlocked once owned,
  reusing the Current Plan chip so the card footers stay aligned.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(payments): clear the customization entitlement on sign-out

Three review findings.

The module-level entitlement cache survived a sign-out. `useQuotaStats`
returned early when there was no user or token, so nothing reset it, and
`resolveCloudSyncGate` reads it synchronously for non-React gates: a
signed-out session could still be treated as premium. Clear both caches
on that path, falling back to the restrictive side, which is how these
caches are already documented to behave before the first auth
resolution.

`customizationPurchased` is now derived from the token rather than held
in state. State lags a render behind a token change, which briefly
reported the previous account's entitlement after a switch.

`SELF_HOSTED` set to an empty string masked `NEXT_PUBLIC_SELF_HOSTED`,
because `??` only falls back on null or undefined, silently re-locking a
self-hosted deployment. Use `||` in both `isSelfHosted` and
`getServerRuntimeConfig`.

The Arabic and Turkish `Unlocked` strings inherited "open" from the
longer "Unlock All Customization Options" phrase, which reads as
"opened" when the word stands alone on a status chip. The remaining
locales keep their established verb deliberately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(payments): cover the real sign-out path for the entitlement caches

The existing test called setCachedCustomizationPurchased directly, so it
pinned the wiring between the cache and the gate but never ran the
cleanup in useQuotaStats. Deleting that cleanup would have left it
green, which is exactly the regression it was meant to catch.

Drive the hook through renderHook instead: render with a session, then
rerender without one, and assert both caches are cleared and the derived
value flips in the same pass. Verified by removing the cleanup and
confirming the test fails, then restoring it.

The cache-to-gate wiring test stays; it covers a different link.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 07:37:42 +02:00
Huang Xin
73e933eb33
fix(docker): apply db migrations on first boot and let the font CDN be overridden (#5550) (#5551)
* fix(docker): apply db migrations on first boot and let the font CDN be overridden (#5550)

A fresh self-hosted stack only ran volumes/db/init/schema.sql, so the
incremental files under volumes/db/migrations never reached the database.
Deployments came up without files.replica_id, the replicas table and the
claim_inbox_item RPC, which broke uploads, replica sync and Send to Readest.

Mount the migrations directory into the db container together with an
apply-migrations.sh hook named so it sorts after the supabase image's own
migrate.sh. It globs the mounted directory, so a new migration file needs no
compose change, and it records what it applied in readest_meta.migrations so
it can be re-run by hand after an upgrade.

The reader also loaded its CJK webfont bundles from storage.readest.com, which
only sends CORS headers for readest.com origins, so they were blocked on a
custom domain. Read the base URL from runtime config via FONT_BASE_URL and keep
the CDN as the default.

Let SUPABASE_PUBLIC_URL and S3_PUBLIC_ENDPOINT be set directly instead of only
being derived from HOST_IP, so the stack can be served from one HTTPS origin.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(docker): add an example nginx config for a single HTTPS origin

Keeps the template out of the README as a copyable file next to .env.example.
Routes / to the client, /auth/v1 and /rest/v1 to kong, and the bucket prefix to
minio with the Host header preserved so presigned signatures still verify.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 10:19:44 +02:00
Amir Pourmand
9ad43aa8b2
feat(docker): add GHCR and Docker Hub image publishing (#4250)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
Publish Docker image / publish (push) Waiting to run
PR checks / rust_lint (push) Waiting to run
PR checks / build_web_app (push) Waiting to run
PR checks / test_web_app (push) Waiting to run
PR checks / build_tauri_app (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Deploy to vercel on merge / build_and_deploy (push) Waiting to run
* Add GHCR and Docker Hub image publishing with fully runtime-configurable pull-first Docker setup (#1)

* feat: add container image publishing workflow and pull-based compose setup

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/23c31167-9e15-4d44-ab89-f267b8cd6304

* refine docker publishing workflow and pull-first compose docs

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/23c31167-9e15-4d44-ab89-f267b8cd6304

* chore: temporarily expose docker publish run results for pr branch

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/c946a2f2-2219-4dea-a829-61b287bc4859

* fix: update pinned SHAs for setup-qemu-action and setup-buildx-action to v3 heads

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/0db6957e-476b-48e0-acf3-bee6964c3b32

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* chore: switch all workflow action refs from SHA pins to stable version tags

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/19334b37-9b4c-45df-9c3c-81a497cef8e8

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* fix: restore missing `with:` blocks lost during SHA-to-tag substitution

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/f204f742-5b7d-4f05-9647-03b9db86ea3d

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* fix(ci): checkout submodules for docker image workflow

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/72309e8a-6c7c-4004-902a-565f67e5c15f

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* feat(docker): support runtime client env for pulled web image

* refactor(web): serve runtime config via script endpoint

* fix(web): escape runtime config script payload

* fix: align docker runtime config with internal/public backend urls

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/3bbcb608-6202-4f9e-b288-5c95a259da93

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* chore: align published workflow tags with docs

* docs: clarify runtime config precedence and linux host mapping

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/3bbcb608-6202-4f9e-b288-5c95a259da93

* refactor: move storage/quota config from build args to runtime env

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/da9b749e-0b1c-47b9-b474-5009765b6ea6

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* fix: load runtime config in pages router app shell

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/b375132c-8317-4c98-b437-ae48c0153e3d

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* fix: apply biome formatting for runtime config quota helpers

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/778f5d75-884e-401b-b7cb-4ab40bc64a11

Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>
Co-authored-by: Amir Pourmand <pourmand1376@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: S3_PUBLIC_ENDPOINT, _document.tsx for beforeInteractive, runtimeConfig fallbacks, README port (#2)

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/4f92f818-c008-4caa-9684-d530500b5fb2

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

* fix: reformat runtimeConfig.ts to satisfy biome formatter (#3)

Agent-Logs-Url: https://github.com/pourmand1376/readest/sessions/4eea77f4-67ab-4428-b59e-0b21be988037

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pourmand1376 <32064808+pourmand1376@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-21 19:57:35 +02:00
Huang Xin
29df8522fa
chore(bump): bump Tauri to the latest version (#3716) 2026-04-01 10:06:23 +02:00
Aniket Kotal
eec2c39f19
feat(docker/podman): self-hosting with docker/podman compose (#3312)
Some checks failed
Deploy to vercel on merge / build_and_deploy (push) Has been cancelled
* initial files

* added testing files

* removed unused files

* cleaned additional mounts

* fixed sql init

* removed more unused files

* moved to docker folder

* revert package.json

* gitignore update

* env example comments and compose necessary healthcheck

* ghcr package impl

* updated dockerfile steps  for layer caching

* added development-stage to dockerfile to dev environment

* added documentation on how to use dockerfile and compose.yml

* fixed prettier issues

* fixed image tag

* removed workflow for later
2026-02-18 14:28:10 +01:00