Skip to content

Add credentials option for self-hosted sign-in, and site-wide export/import - #11

Merged
akashgoswami merged 3 commits into
mainfrom
feat/fork-and-issue-features
Nov 4, 2026
Merged

akashgoswami merged 3 commits into
mainfrom
feat/fork-and-issue-features

Conversation

@akashgoswami

Copy link
Copy Markdown
Contributor

Two features: one from the issue tracker, one adapted from a fork.

Add a credentials option and auth.getReviewer (closes #10)

  • Requests to the backend and to postUrl always sent credentials: "omit". So a backend on the same site, behind the site's own cookie sign-in (an identity-aware proxy, for example), never received the session cookie and refused every request.
  • New credentials option, set with data-credentials or config.credentials. It accepts omit (still the default), same-origin or include, and any other value falls back to omit. It is passed to fetch for both kinds of request.
  • New optional auth.getReviewer() returning { id, name, role }. When you use your own sign-in, it tells Annotate who the viewer is, so review owners get their owner controls, and it fires annotate:auth. If it fails or returns something malformed, it is ignored.

Export and import every page of a site in one file

  • Download only ever covered the current page. A reviewer working through a multi-page site had to export each page separately, and Import put every comment onto whichever page opened the file.
  • Annotate.export({ scope: "site" }) and a new All pages (N comments, M pages) link in the footer download every comment in the project, marked scope: "site". The link only appears in local mode, when other pages have comments.
  • Importing that file puts each comment back on its own page, re-keyed to the importing project, so the project name can differ between the two browsers.
  • Page exports and how they import are unchanged.
  • In a synced review, site export is refused, because the browser only caches the pages it has visited.
  • The idea comes from the overbit/annotate fork (domain-wide export, and import that rebases comments to their source pages). It is rewritten for the current code, since that fork is based on 1.2.0.

Tests

  • npx playwright test --project=chromium: 158 passed, including 5 new tests (2 in integration.spec.js, 3 in the new site-export.spec.js).
  • npm run test:server: 21 passed.
  • Firefox, WebKit and the mobile projects were not run locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BdoyChV7asEejrrmiJbN12

akashgoswami and others added 3 commits November 3, 2026 00:18
Backend and postUrl requests always sent credentials: "omit", so a
same-origin backend behind a cookie sign-in (an identity-aware proxy)
never saw its session cookie. A new credentials option (data-credentials
or config.credentials: "omit" | "same-origin" | "include", default
"omit") is passed to fetch for both. Unknown values fall back to "omit".

With the auth hook, the viewer was never identified, so review owners
had no author controls. An optional auth.getReviewer() returning
{ id, name, role } now sets the reviewer and fires annotate:auth; a
failing or malformed answer is ignored.

Closes #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdoyChV7asEejrrmiJbN12
Download only ever covered the current page, so a reviewer working
through a multi-page site had to export each page separately, and
import pinned every comment onto whichever page opened the file.

Annotate.export({ scope: "site" }) and a new "All pages" footer link
(shown in local mode when other pages hold comments) download every
comment in the project, marked scope: "site". Importing such a file
puts each comment back on its own page, re-keyed to the importing
project. Page exports and their import behaviour are unchanged. A
synced review refuses a site export, since this browser only caches
the pages it visited.

Adapted from the overbit/annotate fork (domain-wide export and
import that rebases comments to their source pages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdoyChV7asEejrrmiJbN12
Playwright's WebKit does not expose the Cookie header to route handlers,
even for a plain fetch with credentials: 'include', so the cookie-header
assertions failed on WebKit only. The test now records the credentials
mode passed to fetch in every browser, and checks the Cookie header only
where Playwright exposes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akashgoswami
akashgoswami merged commit ff27053 into main Nov 4, 2026
4 checks passed
@akashgoswami
akashgoswami deleted the feat/fork-and-issue-features branch November 4, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to send credentials on the sync fetch (same-origin backend behind cookie sign-in)

1 participant