Commit Graph
7407 Commits
Author SHA1 Message Date
CommaBotandDarkSky 5b779b42fa fix(core): scope realtime connections per server endpoint (#16008)
- Isolate worker realtime managers per server endpoint and route
frontend realtime calls through `ServerRealtimeService`.
- Show the joined workspace indicator only when `isOwner` is `false`.
- Use the mobile web sign-in panel when the target server differs from
the active native server.

Closes #16007
Closes #14031

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-12-02 03:49:23 +08:00
CommaBotandDarkSky 4e5ed5af8a fix(core): fix self-hosted image proxy and link preview (#16009)
Configure `ImageProxyService` in `AffineLinkPreviewExtension`, make its
URL reactive, and add `crossorigin="anonymous"` to image-proxy images.
Add an Electron `Referer` header for internal `assets://` worker
requests. Normalize custom-scheme and IP origins in
`worker.allowedOrigin`, and allow `x-affine-client-kind` in link-preview
CORS preflight responses.

Closes #14865

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-12-02 03:49:05 +08:00
CommaBotandDarkSky 7e27087a53 fix(mobile): recover native auth refresh after response loss (#15977)
Persist a refresh attempt ID before native token refresh requests on iOS
and Android, and send it in the `x-affine-refresh-attempt` header.
Retain rotated iOS token pairs across transient Keychain write failures,
and forward structured auth error codes from `AuthPlugin`.

Closes #15975

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-30 18:16:06 +00:00
CommaBotandDarkSky 6ba9044458 fix: update broken release notes links (#15974)
Update broken release notes links in `CHANGELOG.md`, `README.md`, and
the app sidebar.

Point `CHANGELOG.md` to GitHub Releases and the new AFFiNE Blog release
notes tag page. Update `README.md` and `RootAppSidebar` to use
`https://affine.pro/blog/tag/release-note`.

Closes #15973

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-30 06:53:35 +00:00
CommaBotandDarkSky 0cb3eca05f fix(server): handle missing app_configs table and exit CLI on failure (#15972)
Return empty overrides from ServerService.loadDbOverrides on Prisma
P2021 errors in script flavor.

Skip MonitorService cron work in script flavor. Pass abortOnError: false
to NestFactory.createApplicationContext. Call process.exit after runCli
completes so bootstrap failures exit promptly.

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-30 03:42:52 +00:00
CommaBotandDarkSky adefb43588 fix(core): restore sync progress tooltip and remove nested hover (#15971)
Use Tooltip for non-diagnostic sync status in WorkspaceCard so hover
shows sync progress and clicks still open the workspace selector. Pass
withoutHover and tooltip to the diagnostic status Button to prevent
double hover backgrounds.

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-29 20:43:30 +00:00
CommaBotandDarkSky b0fe3c351d fix(mobile): show doc rows before read permission resolves (#15970)
Render mobile navigation doc rows with their local title when `canRead`
is undefined, showing the no-permission row only when `canRead` is
`false` to match the desktop sidebar and avoid permanent `Loading...`
states offline or on transient permission errors.

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-29 19:24:35 +00:00
DarkSky eff11b5174 chore: bump deps (#15969) 2026-11-30 01:24:19 +08:00
CommaBotandDarkSky 1d60976245 fix(core): run Option+letter shortcuts outside text input on macOS (#15896)
On the US macOS layout Option+S produces `ß`. The guard from #14866
skips every Alt shortcut whose key is a non-ASCII character, so the
page/edgeless switch never fired there.

The event cannot tell a US user pressing Option+S for the shortcut from
a Polish user typing `ś` with the same keys, so this keys the guard on
the target instead: when the event targets an editable element (input,
textarea, contenteditable) the character is text input and the shortcut
is skipped, as in #14866; anywhere else there is nothing to type and the
shortcut runs.

Note: in page mode the doc root is contenteditable, so with the caret in
the doc Option+S still types `ß`; the shortcut works when focus is
outside text (edgeless canvas, header, sidebar). Fixing it inside text
would mean dropping #14866's protection or changing the binding.

fix #15232

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-29 23:38:05 +08:00
yuki.kandDarkSky d862d2785d chore(i18n): fill missing Japanese strings (43 keys) (#15966)
Brings `ja.json` in line with `en.json` for the AFFiNE AI chat panel by
adding all 43 missing `com.affine.ai.*` Japanese translations (chat
panel tools, scopes, session deletion, and selected-source errors) and
updating `ja` in `i18n-completenesses.json` from 83 to 84.

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-29 12:52:26 +00:00
James Du 92fa91066c fix(i18n): stop showing blank Norwegian labels and update stale SSRF errors (#15964)
**Blank Norwegian labels.** `nb-NO.json` had 168 keys with empty values
(for example `Publish`, `Link`, `Unpin`, `Disable Public Sharing`).
i18next returns an empty string for those instead of falling back, so
Norwegian users saw blank buttons and labels. This removes the empty
entries so they fall back to English, and updates `nb-NO` in
`i18n-completenesses.json` from 41 to 35.

**Stale SSRF error.** `error.SSRF_BLOCKED_ERROR` still said "Invalid
URL" in ar, de, fr, kk, ur, zh-Hans and zh-Hant. That text predates the
English message "URL blocked by SSRF protection: {{reason}}", so those
users never saw the reason. The current message is now translated in all
seven, including `{{reason}}`.
2026-11-29 09:09:58 +00:00
CommaBotandDarkSky 5488caab6c fix(server): fix payment test flakes, predeploy steps, and large root doc refs (#15962)
- Avoid TIMESTAMPTZ(3) future rounding on `next_attempt_at` and release
`PaymentConnection` locks before returning.
- Align `self-host-predeploy.js` with `package.json` predeploy steps
(`admit-legacy-context-blobs` and `validate-cutover`).
- Share bounded workspace root avatar extraction across `blob_access`
and `doc_blob_refs`.

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-28 19:06:42 +00:00
CommaBotandDarkSky 9e37f4caa2 fix(server,core): reject legacy space:join, update affine_merge, and normalize GPT model labels (#15961)
Closes #15954
Closes #15937

- Reject legacy `space:join` requests with `UnsupportedClientVersion`
and disconnect the socket.
- Update `affine_merge` to `0.4.1` so markdown updates with repeated
characters succeed.
- Split model display names on whitespace or hyphens so GPT labels
highlight only `GPT`.

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-29 00:16:05 +08:00
CommaBotandDarkSky 90d093f418 fix(server): raise Manticore max_matches and bound cursor offsets (#15958)
Closes #15953

## What changed

- Set `options.max_matches` to `offset + size` in
`translate_search_request` when that sum exceeds 1000.
- Return `nextCursor` from `normalize` only when the page has hits and
the next offset stays below `total`.
- Enforce the 10000 pagination offset limit on offset-based cursors in
`query::compile` using the shared `parse_offset_cursor` helper.
- Keep non-offset cursors and background scan paths unchanged.
- Add table-driven unit tests for `max_matches` sizing, `nextCursor`
termination, and cursor offset bounds.

## Why

Manticore Search keeps 1000 matches per query by default. Requests past
that window return truncated pages or zero hits while reporting the full
`total`. Previously, `normalize` did not check for an empty page. An
empty page returned the same cursor and caused background sweeps to loop
on the same offset.

Raising `max_matches` also allows an external query with a large offset
cursor to request a large match buffer. Checking offset-based cursors in
`query::compile` blocks oversized user requests while keeping background
scans past 10000 rows working.

## Verification

- Model: Gemini 4 Neon
- Test frameworks: `cargo test` (`affine_server_native` search unit
suite, 36 passed), `rustfmt --check`, and a live pagination test against
`manticoresearch/manticore:29.0.2` with 1050 indexed rows.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Search pagination now handles empty and completed result pages more
reliably, avoiding misleading next-page links.
* Cursor offsets and page limits are checked more consistently,
including when values are unusually large.
* **Improvements**
* Searches that need to reach beyond the default result threshold can
now retrieve the requested page.
  * Page limits above 10,000 are rejected.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-28 10:04:02 +00:00
Mehedi Hasan bae99fcecd fix(i18n): correct Persian calendar week day labels (#15948)
## Description

The Persian (`fa`) value of `com.affine.calendar-date-picker.week-days`
was `ش,ی,د,س,چ,ج,ش`. It starts on Saturday (شنبه) and skips Thursday
(پنج‌شنبه). The date picker renders this string as a Sunday-first
header, so every Persian column was labelled with the wrong day:

| Column | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|---|
| Before | ش (Sat) | ی (Sun) | د (Mon) | س (Tue) | چ (Wed) | ج (Fri) | ش
(Sat) |
| After | ی | د | س | چ | پ | ج | ش |

The new value matches the CLDR narrow weekday names
(`Intl.DateTimeFormat('fa', { weekday: 'narrow' })`).

Tests: added `packages/frontend/i18n/src/__tests__/week-days.spec.ts`.
- Every supported locale has 7 week-day labels.
- Locales with single-character labels (`fa`, `ja`, `ko`) match `Intl`'s
narrow weekday names in Sunday-first order. The `fa` case fails on
current canary and passes with this change.

I checked the other non-Latin locales by hand (ar, kk, tr, ur, zh, ru,
uk, el-GR); they are already Sunday-first.

```
yarn vitest run packages/frontend/i18n/src/__tests__/week-days.spec.ts   # 25 passed (fa fails without the fix)
yarn oxlint --deny-warnings packages/frontend/i18n/src/__tests__   # clean
yarn oxfmt --check <changed files>   # clean
yarn tsc -b packages/frontend/i18n/tsconfig.json   # no errors
```

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally (run on the changed
package)
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.

This PR was written with AI assistance and reviewed before submitting.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected the weekday labels shown in the Persian calendar date
picker, providing a consistent sequence of day names.
* The updated labels help users identify weekdays more accurately when
selecting a date.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-27 18:38:47 +00:00
Prezsi 5444d929c2 feat(i18n): add Hungarian translation (#15947)
## Description

Adds Hungarian (`hu`) to the supported languages, with all 2,643 keys
translated.

Closes #15926

This replaces #15922, which I opened by mistake before the translation
was finished. Sorry for the noise.

**Changes** (three files, the same shape as the Turkish translation in
#15000):

- `resources/hu.json`: the new translation
- `resources/index.ts`: `hu` in `Language` and `SUPPORTED_LANGUAGES`
- `i18n-completenesses.json`: `hu` at 100

**How it was made and checked:**

- The translation was drafted by machine and revised with AI assistance.
I am a native Hungarian speaker and reviewed the result in the running
app.
- A script checked every key against `en.json`: placeholders, tags,
`$t()` references, line breaks and leading or trailing spaces all match.
- I built it on v0.27.4 and ran it on a self-hosted instance. In
Hungarian I went through the settings, sidebar, doc list, doc
properties, collections, tags, journals, trash, share menu and quick
search.

Some strings stay in English because they are hardcoded rather than in
`en.json`. They are not part of this PR.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE)
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [ ] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added Hungarian as a supported language, with translations across the
interface and a reported translation completeness of 100%.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-26 14:31:42 +00:00
ApplesBear-XandDarkSky 73d00e7c28 chore(i18n): fill missing Simplified Chinese strings (158 keys) (#15724)
## What

Brings `zh-Hans.json` in line with `en.json`.

| | before | after |
|---|---|---|
| keys | 2450 | **2608** |
| falling back to English | 158 | **0** |

Also refreshed ~25 entries that still held the English source string.

## Notes

- `{{placeholders}}` preserved verbatim; verified zero placeholder
mismatches across all changed strings.
- JSON only, no code changes.
- **If you sync this file from Crowdin**, just say so and I'll close
this in favour of the Crowdin round instead — I mostly wanted to flag
that Simplified Chinese is currently ~6% behind `en`.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **Localization**
- Expanded Simplified Chinese translations for journal labels,
properties, menus, empty states, and the Intelligence workspace.
- Added translations for AI editor tools, BYOK provider and model
settings, mobile settings, and device management.
- Added localized messages for selected-source errors, billing and
purchases, document validation, invitation account mismatches,
authentication, sync, search, and real-time connection failures.
  - Updated existing Chinese labels and descriptions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-26 13:12:16 +00:00
James Du a580c92f72 fix(i18n): close unbalanced tags and fix broken placeholders in translations (#15942)
## Description

This fixes translation strings that render as broken text. I found them
with a placeholder and markup check across all locale files, then
checked each one against how its key is rendered (`<Trans>` or plain
`t()`).

**Unclosed `<Trans>` tags.** For example, `<1>7 days<1>` should be `<1>7
days</1>`. Without the closing tag, `<Trans>` nests the second tag and
the rest of the sentence turns bold.
- Version history prompts
(`com.affine.history.confirm-restore-modal.{free,pro}-plan-prompt.description`):
en.json and the 17 locales copied from it. ca, ko and pl already had it
right.
- `recommendBrowser`: ca, es.
- `com.affine.payment.lifetime.caption-2`: ru, where `<a>…<a>` made the
link swallow the end of the sentence.
- `com.affine.payment.upgrade-success-page.support`: fr used `<3>`, but
only component `1` is passed, so the support email link was missing.

**Literal markup in plain `t()` strings.** These strings are rendered as
text, so the tags appear on screen.
- `<b>(</b>` in `com.affine.m.explorer.tag.manage-docs` (ar, it, pl, uk)
and in
`com.affine.m.selector.{info-total,title,info-added,info-removed}` (ar,
it, pl).
- `<b>` in `com.affine.payment.cloud.team-workspace.benefit.g1-3/g1-4`
(ja, zh-Hant) and in `Find 0 result` (sv-SE).
- `{AFFiNE}` in `com.affine.ai-onboarding.general.2.{title,description}`
(es).

**Wrong or missing variables.**
- ru `com.affine.payment.ai.billing-tip.end-at` used `{{due}}`, but the
code passes `end`, so the expiry date showed as a literal `{{due}}`.
- ru `com.affine.editor.at-menu.more-{docs,members}-hint` packed all
four plural forms into one string, so users saw "5 документа, 5
документов, 5 документов, 5 документа(ов)". They are now "Ещё
документов: {{count}}" and "Ещё участников: {{count}}", which read
correctly for any count, including `100+`.
- fr `com.affine.cmdk.affine.create-new-edgeless-as` dropped
`{{keyWord}}`. It now reads `Nouvelle page sans bords "{{keyWord}}"`, in
line with the existing French strings.

| Before (en, version history prompt) | After |
| --- | --- |
| …up to **7 days of version history.** | …up to **7 days** of version
history. |

I rendered the four `<Trans>` keys in every locale with react-i18next
15.5.1 and html-parse-stringify 3.0.1 (the versions in `yarn.lock`),
before and after the change, and all 26 locales now render correctly.
Only values change: key order and completeness are the same, and the
files keep their existing JSON format. The two doc comments in
`i18n.gen.ts` that quote the English history prompts are updated to
match.

Not included, left for a separate change: stale
`error.SSRF_BLOCKED_ERROR` translations that drop `{{reason}}`, and
style-only differences such as a missing highlight.

The fixes were drafted with AI assistance (Claude).

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [ ] Tests are added or updated where it makes sense (translation-only
change)
- [ ] `yarn lint` and `yarn typecheck` pass locally (not run: the change
touches JSON values and two comments only)
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected malformed rich-text markup in document-history prompts
across multiple languages, improving the display of plan details and
durations.
* Fixed several translation issues in browser recommendations,
onboarding, billing, editor hints, and tag-management labels.
  * Cleaned up stray formatting in localized text.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-26 13:56:41 +08:00
DarkSky 08622a4322 fix(server): handle invalid root (#15941)
#### PR Dependency Tree


* **PR #15941** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Document update tools now distinguish missing documents from other
failures and provide clearer error messages.
* Invalid legacy workspace snapshots are reported consistently, and
embedding sync retries those workspaces after a brief delay.
* **Chores**
  * Updated a workspace dependency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-26 13:55:23 +08:00
hwaandDarkSky 81da59d63d feat(editor): support fullscreen Mermaid preview (#15390)
## Summary

- add a fullscreen control to Mermaid previews
- use the browser Fullscreen API to enter and exit fullscreen
- add fullscreen-specific layout styles
- add E2E coverage for the fullscreen request


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added a fullscreen control to Mermaid diagram previews. Previews
expand to fill the screen with adjusted spacing and dimensions, and the
same control exits fullscreen. This gives diagrams more room to view
while keeping the preview’s fullscreen controls available.
* **Tests**
* Added end-to-end coverage verifying that the fullscreen control enters
and exits fullscreen mode for Mermaid previews.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-25 01:48:13 +08:00
8ba3c909f4 fix(core): add per-page read/edit toggle in header (#15522)
Resolves #15423

## Summary
Adds a per-doc read/edit toggle button to both the desktop and mobile
document headers, so a doc can be locked into a read-only view without
navigating away — primarily to avoid the mobile on-screen keyboard
popping up while scrolling.

## Relation to #15453
This replaces #15453, which was opened from a branch named
`fix/issue-15435` (an unrelated date-picker bug) and linked the wrong
issue (#15444, which is actually a previous closed PR, not an issue).
This PR carries forward all of that PR's code, rebased on latest
`canary`, plus fixes for the review feedback left on #15453:

- **Mobile toggle guard**: the mobile toggle button had no
`canEdit`/trash guard at all (desktop already had one) — both platforms
now hide/disable the toggle when the user can't edit or the doc is
trashed.
- **i18n**: added the missing
`com.affine.header.readonly-toggle.read-only` / `...editing` translation
keys (previously referenced keys that did not exist in `en.json`).
- **Styling**: removed redundant inline `style={{ marginRight: 8 }}` on
both header buttons — the surrounding containers already apply the
correct `gap`.
- **Analytics**: added a typed `toggleReadOnlyMode` event under
`track.$.header.actions`, following the existing `toggleFavorite: { on:
boolean }` convention.
- **Tests**: added `tests/affine-local/e2e/readonly-toggle.spec.ts`
covering toggle-on → body not editable → toggle off → editable again →
navigate to a new doc → no state leak.

## Known follow-up (not in this PR)
As raised in review, routing this through `doc.blockSuiteDoc.readonly`
(the same channel `DetailPageWrapper` already uses for trashed docs)
instead of local `isReadOnlyMode` state duplicated across desktop/mobile
would also fix the title editor staying editable while the body is
read-only. Keeping this PR scoped to the existing local-state approach;
open to a follow-up if the team wants the architecture change.
Interaction design (mobile-only vs. desktop+mobile, persisted vs.
ephemeral) is also still open for design feedback.

## Test plan
- [x] `tsc --noEmit` clean on all touched files
- [x] New e2e test covering the toggle/reset flow
- [ ] CI (build/typecheck/e2e workflows)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added a read-only/editing toggle to eligible document headers on
desktop and mobile. Its icon and label reflect the current mode.
  * Read-only mode resets when you open a different document.

* **Bug Fixes**
* Prevented edits to document content, titles, and names while read-only
mode is enabled.
* Limited editing and the toggle to eligible documents. On mobile, the
toggle is unavailable in Edgeless mode when editing is disabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: donqu1xotevincent <vincent@toeverything.info>
Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 19:39:07 +08:00
Jang Dong Ik 40538f2719 fix(core): render block diff playground modal outside editor host (#15890)
## Description

The Block Diff Playground modal (the dev-only 🧪 button) was portaled
into `editor-host` via `container: this.host`. `editor-host` sets
`isolation: isolate`, so the modal's z-index only applies inside that
stacking context. Anything painted after the editor at the same level
ends up on top of the modal — in practice the backlinks panel's "Show"
button shows through right over the action buttons.

Removing the `container` option lets `createLitPortal` fall back to its
default (`document.body`), so the modal is no longer trapped under the
editor's stacking context. Positioning is unaffected since it's still
computed against the 🧪 button.

To reproduce: run the web app in dev mode, open a doc that's long enough
for the backlinks panel to sit behind the modal, click 🧪.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [ ] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally
- [ ] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Refactor**
  * Updated the playground portal to use its default container behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-24 18:21:15 +08:00
Kamal f8c1d3d214 feat(i18n): expand Hindi translation for sign-in, sidebar and docs (#15881)
## Description

`hi.json` translates 5 of the 2,622 current keys in `en.json`, so Hindi
is selectable in the language menu but almost every screen stays in
English. This PR adds 229 Hindi strings for the first-run path:

- `com.affine.auth.*` (sign in, sign up, magic link, password,
self-hosted server)
- `com.affine.rootAppSidebar.*` (favorites, organize, tags, collections)
- `com.affine.all-docs.*`, `com.affine.page.*` (doc list and display
options)
- `com.affine.workspace.*`, `com.affine.empty.*`,
`com.affine.toastMessage.*`

`i18n-completenesses.json` is updated with the same formula as
`build.ts` (`ceil(keys / en keys * 100)`): `hi` 1 -> 10. The formula
reproduces the committed `ur` value (90), which is how I checked it.

Every added string keeps the exact interpolation and tags of `en.json`
(`{{email}}`, `{{count}}`, `<1></1>`, `<a></a>`, `<b></b>`, `<0></0>`),
checked per key with a script that fails on any mismatch. Existing Hindi
entries are untouched; new keys are inserted in `en.json` order, so the
diff is additions only. Terminology matches the existing file
(कार्यक्षेत्र for workspace).

Same shape as the Urdu expansion in #14995.
2026-11-24 18:19:53 +08:00
CommaBotandDarkSky 9afa11a25f fix(mobile): open search results at the matched block (#15893)
Mobile search rendered doc results with a plain `DocCard` linking to
`/<docId>`, dropping the `blockId` of the matched block from the search
payload. Opening a result therefore neither scrolled to nor highlighted
the match.

The search page now keeps the matched `blockId`, and `DocCard` takes
`blockIds` and links to `/<docId>?blockIds=<id>`. The mobile detail page
already binds the editor to the view's query string, so this is the same
path desktop quick search uses (`workbench.openDoc({ docId, blockIds
})`): the editor scrolls to and highlights the block.

fix #15153

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Mobile search results now open the matching document and navigate to
the specific section where the result was found, highlighting that
section when available.
* When a result has no matched section, selecting it opens the document
without a section-specific destination, preserving the existing
document-level navigation behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 18:06:44 +08:00
CommaBotandDarkSky 97602cf734 fix(core): report files skipped during import (#15892)
Markdown, HTML and Word imports silently dropped a file when it could
not be read or converted: the per-file loop only kept files that
returned a doc id, and the file picker's snapshot step dropped
unreadable files with a `console.error`. The dialog then reported
"Import completed".

This change:
- moves snapshotting of picked files into the importer
(`snapshotReadableFiles`, already used by the Obsidian import), which
records unreadable files as warnings; the picker no longer has a
`snapshot` option
- records files the converter returned no doc for as `skipped_doc`
warnings
- shows "Import completed with warnings" and the list of warnings
instead of the success message when there are any
- sets `sourcePath` on Markdown zip docs so skipped entries are named by
path instead of a generated id

fix #15718

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Import status now reports when files are skipped, unreadable, or only
partially imported.
* Imported Markdown documents retain their source paths within the
archive.
* File and directory pickers can use the standard browser picker instead
of the File System Access API.
* **Bug Fixes**
* Importing multiple files now handles unreadable files and files that
cannot be converted without interrupting the remaining imports.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 18:04:36 +08:00
CommaBotandDarkSky c31c1323e4 fix(core): let the sign-in dialog shrink and scroll in short windows (#15894)
The desktop sign-in dialog set an inline `min-height: 550px`, which wins
over the modal's `calc(100dvh - 32px)` cap, and the dialog content had
no overflow, so in a window shorter than the dialog the controls below
the fold could not be reached.

This caps the min and max height at the viewport and lets the dialog
scroll. An e2e test opens the dialog in a 400px-high viewport and checks
that it fits and that its last button can be scrolled into view.

fix #15620

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* The sign-in dialog now adapts to shorter screens and scrolls when its
content exceeds the available space.
* **Tests**
* Added coverage to check that the login dialog and its final button
remain accessible in a short viewport.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 18:03:55 +08:00
CommaBotandDarkSky bb996d298f fix(mobile): remove the collection edit action (#15897)
The mobile collection menu offered "Edit collection", which opens the
`collection-editor` dialog, but the mobile dialog registry never
registered it (the editor is the desktop dialog and was left commented
out when the mobile app got its own dialogs), so tapping it did nothing.

This removes the action and the handlers that only served it. A mobile
e2e test checks the collection menu no longer offers it.

fix #15005

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Changes**
* Removed the “Edit collection” action from collection menus in mobile
navigation.
* Collection menus continue to offer rename, add page, favorite, open,
split view, and delete actions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 15:31:38 +08:00
9972c63524 fix(editor): fall back to bundled fonts when PDF export cannot reach the CDN (#15859)
Fixes #15658

## Problem

With `enable_pdfmake_export` on, **Export to PDF** loads its fonts from
hardcoded `https://cdn.affine.pro/fonts/...` URLs. The CDN only sends
`Access-Control-Allow-Origin: https://app.affine.pro`, so the font fetch
fails on self-hosted origins and in the desktop app.

The export then gives no feedback at all. In pdfmake 0.2.x, `_createDoc`
rethrows a failed font fetch from inside a promise handler
(`urlResolver.resolved().then(..., result => { throw result })`), so the
`getBlob` callback never runs. `PdfAdapter._createPdfBlob` therefore
never settles, and `useExportPage` never reaches its "Export failed"
toast.

## Fix

The adapter now loads the fonts itself before calling pdfmake, through
`createPdfFontLoader` in `adapters/pdf/fonts.ts`:

- Each font is fetched from the CDN first, as before. If that fails, the
loader uses the matching Inter face (same weight and style) from the
editor's `FontConfigIdentifier`. The app already points that config at
its own `fonts/*.woff2` files (`environment.publicPath + 'fonts/'` in
`blocksuite/manager/view.ts`), which
`scripts/download-blocksuite-fonts.mjs` bundles. This mirrors the
CDN-to-local fallback the Typst renderer already has
(`createTypstFontFetcher`).
- The CJK font (`SarasaGothicCL-Regular.ttf`) has no bundled copy, so it
falls back to Inter Regular, as the Typst fallback does. Export then
works, but CJK glyphs need the CDN.
- The loaded fonts are passed to `pdfMake.createPdf(definition,
undefined, fonts, vfs)`, and the global `pdfMake.fonts` assignment is
removed.
- If neither source loads, the adapter rejects instead of hanging, so
the existing "Export failed" toast shows.
- Loaded fonts are cached per URL, as pdfmake's own URL resolver did.
Failures are not cached.
- `PdfTransformer.exportDoc` takes an optional provider, and
`useExportPage` passes `std.provider`. The font config is registered on
the editor (view) provider, not on `doc.provider`.

## Testing

- New `src/__tests__/adapters/pdf/fonts.unit.spec.ts` in
`@blocksuite/affine-shared` covers four cases:
  - CDN fonts are used when they load;
- the editor's woff2 fonts are used when the CDN fetch throws, with the
CJK font falling back to Inter Regular;
  - the loader rejects when a font loads from nowhere;
  - a second export reuses loaded fonts.
- I also ran a throwaway check, not committed, in the same happy-dom
environment. pdfmake's browser build rendered a PDF from the loader's
vfs using the real `Inter-*.woff2` files. With the CDN blocked, the PDF
embeds `Inter-Regular` and `Inter-SemiBold`, and the CJK text falls back
to Inter. In Node, pdfmake 0.2.20 also embeds the woff2 faces (as CFF
`FontFile3`).
- `yarn vitest run` passes in `blocksuite/affine/shared` (17 files, 129
tests). The existing 34 tests in
`blocksuite/affine/all/src/__tests__/adapters/pdf.unit.spec.ts` also
pass.
- `tsc -b` passes for `blocksuite/affine/widgets/linked-doc` and
`packages/frontend/core`.
- `oxlint --deny-warnings` and `oxfmt --check` pass on the changed
files.

I couldn't test a self-hosted Docker build end to end.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* PDF exports now load fonts for supported typefaces, including Inter
and Sarasa Gothic CL.
* If a font cannot be fetched from the CDN, exports can fall back to a
matching font configured in the editor.
* PDF exports use the editor’s standard provider to reflect its current
configuration.
* **Bug Fixes**
* PDF export reports an error when required fonts cannot be loaded,
rather than proceeding without them.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
Co-authored-by: m86hussein <317587333+m86hussein@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-24 15:20:30 +08:00
xuczxc100andDarkSky 25d7dd0edc chore(i18n): improve Traditional Chinese (Taiwan) coverage and wording (#15852)
## Summary
- Raise `zh-Hant` coverage from ~86% to full key parity with `en.json`
(+392 keys).
- Polish existing Traditional Chinese toward Taiwan wording
(工作區、垃圾桶、資料夾、連結、設定、預設、匯入/匯出、用戶端、本機、載入…).
- Fix Simplified leftovers (e.g. 删除 / 邀请链接) and translate newer AI /
BYOK / devices / realtime error strings.
- Update `i18n-completenesses.json` (`zh-Hant` → 100 by key count).

## Notes for maintainers
AFFiNE’s community translation flow currently points to Crowdin
(`i18n.affine.pro`). Happy to re-apply these strings on Crowdin if
preferred; this PR is a reviewable full `zh-Hant.json` patch for canary.

## Test plan
- [ ] Diff `packages/frontend/i18n/src/resources/zh-Hant.json` against
previous canary
- [ ] Spot-check settings / trash / workspace / AI BYOK / mobile
settings in `zh-Hant`
- [ ] Confirm interpolation placeholders `{{...}}` and tags like
`<1>...</1>` remain intact
- [ ] Run i18n package build / completeness generation if required by CI


Made with [Cursor](https://cursor.com)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Localization**
* Updated Traditional Chinese translations across workspace,
authentication, AI, settings, billing, sharing, integrations, and error
messages.
* Added translations for several settings, account and device controls,
analytics, integrations, and mobile empty states.
* Turkish and Traditional Chinese translation completeness now both show
100%.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 15:17:55 +08:00
DarkSky 172b8bc4c2 fix(server): search lock handle (#15927)
#### PR Dependency Tree


* **PR #15927** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Snapshot database transactions now have a one-minute idle timeout when
no timeout is configured or the configured timeout is longer, helping
prevent transactions from remaining idle indefinitely.
* Search generation operations now retry lock acquisition for up to five
seconds instead of waiting indefinitely. If the lock remains
unavailable, the operation reports that the search index is not ready.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-24 14:02:36 +08:00
CommaBotandDarkSky 3da5be4097 fix(core): stop the invite spinner when inviting members fails (#15898)
When inviting members failed (for example with `TOO_MANY_REQUEST`), the
error escaped before `isMutating` was reset, so the invite dialog kept
spinning and no error was shown.

The flag is now reset in a `finally` block and the error is shown in a
toast. A unit test covers the success and failure paths.

fix #15536

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Workspace member invitations now display a clear error notification
when an invite attempt fails, including when too many requests are made.
* The invitation button returns to its ready state after either a
successful or failed attempt, so users can continue interacting with the
panel.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 12:27:37 +08:00
CommaBotandDarkSky f89487fa20 fix(electron): localize the tray menu (#15895)
The tray menu labels were hardcoded in English. They now come from i18n
keys, and the tray menu is rebuilt when the main process language
changes (the renderer already syncs its language to the main process).
Adds the Simplified Chinese translations.

A unit test builds the tray menu, switches the language to zh-Hans and
checks the labels.

fix #15684

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Desktop tray menu labels are now localized in English and Simplified
Chinese.
* Tray labels update when the app’s language changes, including
recording controls, settings, and app information.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 12:02:20 +08:00
CommaBotandDarkSky c91b08fbcc fix(android): allow plain http only to local network servers (#15925)
Release builds of the Android app set `usesCleartextTraffic=false` and
`MIXED_CONTENT_NEVER_ALLOW` (#15118), so the app could not reach a
self-hosted server over http at all, including one on the local network.

This allows plain-text http/ws only to local network hosts, matching iOS
`NSAllowsLocalNetworking`:

- unqualified single-label names (`nas`, `localhost`) and `.local` names
- loopback, private and link-local IP literals: 127/8, 10/8, 172.16/12,
192.168/16, 169.254/16, `::1`, fc00::/7, fe80::/10

Anything else is refused, including public-looking names that resolve to
a private address (names are never resolved).

Android WebView cannot allow mixed content per host: the app runs at
`https://localhost`, so every http/ws request is mixed content,
`mixedContentMode` is WebView-wide, and WebView only honours the
app-wide cleartext flag. So cleartext and `MIXED_CONTENT_ALWAYS_ALLOW`
are enabled globally, and the rule is enforced in three places with the
same host check:

- `AffineWebViewClient.shouldInterceptRequest` answers plain http
requests to other hosts with a 403.
- The web app wraps `WebSocket` and `fetch` (main thread and the nbstore
worker), because WebView request interception never sees WebSocket
handshakes. This is where the sync `ws://` connection is refused.
- An OkHttp interceptor rejects plain http to other hosts for the native
clients (GraphQL, SSE, auth).

On Android and iOS, the add-server step rejects public `http://`
addresses with a message asking for an https address, a local IP or a
`.local` name.

The host check exists in TS (`@affine/core/utils/local-network`) and
Kotlin (`LocalNetwork.kt`); both are tested against the same table,
`core/src/utils/local-network/fixtures/hosts.json` (the Android unit
tests read it as a test resource). Other tests show public `http://` and
`ws://` are blocked in the web guard and in an OkHttp client, while LAN,
`.local` and https pass.

#15509 (server on a LAN IP) is fixed by this. The setup in #15438
(`http://affine.home.com`) stays blocked, as it is on iOS: that server
needs https, a local IP address or a `.local` name.

Tested: the TS tests with vitest, the Kotlin tests with JUnit outside
Gradle (Kotlin 2.2.20, JDK 21). Not run on a device or emulator; the
WebView and WebSocket behaviour is covered by unit tests only.

fix #15438
fix #15509


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Android now allows HTTP connections to servers on the local network,
while blocking insecure connections to public servers. HTTPS connections
remain available.
* When adding a self-hosted server on Android or iOS, you’ll see
guidance if its public address uses HTTP. Use an HTTPS address or a
local network address instead.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 12:01:26 +08:00
Nyota MugethiandDarkSky 89bdb9c1e9 fix(editor): fix markdown/html export and copy-as-markdown on string table cells (#15819)
### Summary

Fixes #15818.

1.
**`blocksuite/affine/blocks/table/src/adapters/{utils,markdown,plain-text}.ts`**:
- Match `database/src/adapters/` and `table/src/adapters/html.ts` by
supporting plain-string cell values (`typeof v.value === 'string'`) and
missing/undefined `.text` in `processTable` (`utils.ts`),
`tableBlockMarkdownAdapterMatcher` (`markdown.ts`), and
`tableBlockPlainTextAdapterMatcher` (`plain-text.ts`).
- Previously, `table/src/adapters/markdown.ts` and `plain-text.ts`
unconditionally called `deltaConverter.deltaToAST(v.value.delta)`, which
threw `TypeError: Cannot read properties of undefined (reading 'map')`
when `cell.text` was a string or missing `.delta`, causing both `Export
-> Markdown` and `Export -> Copy as Markdown` (`copy-markdown`) to fail
inside `adapter.fromDoc(doc)`.

2.
**`packages/frontend/core/src/components/hooks/affine/use-export-page.ts`
&
`blocksuite/affine/widgets/linked-doc/src/transformers/{markdown,html}.ts`**:
- Propagate `Promise<boolean>` from `exportDoc`, `exportToHtml`,
`exportToMarkdown`, `HtmlTransformer.exportDoc`, and
`MarkdownTransformer.exportDoc` instead of hardcoding `return true` in
`exportHandler`.
- When `adapter.fromDoc(doc)` or `docToSnapshot(doc)` fails and returns
`undefined` (or produces empty output with no assets), `exportHandler`
now returns `false` so the user sees the error notification rather than
a false-positive `"Exported successfully / Please open the download
folder to check."` toast.
- In `copyAsMarkdown`, fall back to `new MarkdownAdapter(transformer,
doc.provider)` when `std` is not present (matching
`MarkdownTransformer.exportDoc`).

3. **`blocksuite/affine/widgets/linked-doc/src/transformers/utils.ts`**:
- Defer `element.remove()` and `URL.revokeObjectURL(fileURL)` in
`download()` via `setTimeout(..., 100)` (consistent with
`packages/frontend/admin/src/modules/accounts/utils/csv-utils.ts` and
`packages/frontend/core/src/blocksuite/database-block/properties/file/view.tsx`)
so the blob URL is not revoked synchronously before the download
initiates.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Table exports now handle missing or empty cell text consistently.
* HTML and Markdown export actions now report whether an export was
downloaded, and avoid reporting success when no export is available.
* Copying as Markdown works even when an editor standard scope is
unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 11:09:38 +08:00
Yifei YinandDarkSky e9b4be0897 fix(core): use permanent delete icon consistently (#13051)
- Update to DeletePermanentlyIcon in QuickDeletePermanently and
trash-page-footer
- A trivial refactor to use permanentlyDeletePage helper method

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Style**
* Updated permanent-delete buttons in quick actions and the trash page
to use a dedicated permanent-delete icon.
* **Bug Fixes**
* After confirming permanent deletion from the trash page, the app
returns to the All pages view and displays a confirmation once deletion
completes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-24 00:10:59 +08:00
Tines Valen cba28c36b1 feat: saves display preferences per collection (#15186)
fix #13433 

Saves the display preferences set on each collection view. So one
collection will open by default in Masonry view, while another will open
in List view. It works nearly identically to how the allDocs page saves
its display preferences, but makes a separate key-value pair for each
collection.

Works as intended right now, but with a bit of duplicate code from the
allDocs, i didn't want to touch that to avoid making too many
opinionated refactorings 😅

EDIT: added Playwright tests for the new functionality

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Collection pages remember list, grid, or masonry view modes and
display settings independently.
* Search results can include database rows linked to matching documents.
  * AFFiNE AI offers Haiku and updated Claude and Gemini model options.
  * Turkish translations have been updated and expanded.
  * Self-hosted deployments support updated license options.

* **Bug Fixes**
* Document links and actions resolve consistently when a document has a
separate storage ID.
  * Document deletion and sync are more reliable across devices.
  * LaTeX editors support the platform’s select-all shortcut.

* **Tests**
* Added coverage for collection preferences persisting when collections
are reopened.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 23:10:07 +08:00
JachinandDarkSky 872451073b fix(core): select all unused blobs across pages (#15591)
## Summary

- keep unused blob selection keyed across pagination
- make Select all include every unused blob, not only the current page
- delete selected blobs in bounded batches and retain failed items for
retry
- keep pagination valid after deletions and report partial failures

## Tests

- `yarn vitest run
packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.spec.tsx`
- `yarn oxfmt --check
packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.spec.tsx
packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.tsx
packages/frontend/i18n/src/i18n.gen.ts
packages/frontend/i18n/src/resources/en.json
packages/frontend/i18n/src/resources/zh-Hans.json
packages/frontend/i18n/src/resources/zh-Hant.json`
- `yarn oxlint --deny-warnings
packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.spec.tsx
packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/storage/blob-management.tsx
packages/frontend/i18n/src/i18n.gen.ts`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **New Features**
- Select unused blobs across pages, with selections retained for items
that remain available.
- Deletions refresh the blob list, skip items that are no longer unused,
and adjust pagination when the list shrinks.
- Failed deletions show a localized notification, and failed items
remain selected for retry.

- **Bug Fixes**
  - Prevented selection changes while deletion is in progress.

- **Tests**
- Added coverage for multi-page selection and deletion, failed
deletions, and pagination updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 23:03:34 +08:00
Raphael Fakhri d70977f0ef fix(core): index doc references inside table cells (#15713)
## Description

Closes #15468.

A doc linked with `@` inside a table block (`/table`, not a database
view) never appears in Bidirectional Links on either doc. The indexer's
`affine:table` branch in `@affine/reader` only collects cell text, so
the block document has no `refDocId`/`ref`, and the backlink query on
`refDocId` finds nothing. The `affine:database` branch already collects
inline references from rich-text cells.

This change reads the inline references from each `prop:cells.*.text`
value with the existing `getTextDeltasFromCellValue` and
`collectInlineReferences` helpers, and sets `refDocId` and `ref` on the
table block, the same way the database branch does.

Scope: this fixes the TypeScript crawler, which the web app (IndexedDB
storage) uses and which the desktop and mobile apps use as the fallback.
The native crawler in `affine_doc_loader` (`read/block.rs`,
`affine:table` branch) has the same gap, and this PR leaves it
unchanged.

Test: `should index references from table cells` in
`packages/common/reader/__tests__/reader.spec.ts` fails without the fix
(`expected undefined to deeply equal [ 'target-doc' ]`) and passes with
it.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **Bug Fixes**
- Table cell text is now included when reading document blocks, and
references within cells are captured for indexing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 23:02:27 +08:00
Leo CamusandDarkSky 0315c8cda0 fix(core): ignore cleared number values in collection rules (#15610)
## Description

I noticed that clearing a number property in the doc info panel doesn't
really make it empty as far as collection rules are concerned.
`NumberValue` saves the trimmed input on blur, so a cleared field is
stored as `''`, and the three number providers in `collection-rules` all
pass the raw value through `Number()`, which turns `''` into `0`. The
result is that a doc whose number was cleared:

- matches the `= 0`, `< n`, `≤ n` filters (and `≥ 0`), even though
`is-empty` correctly reports it as empty;
- is sorted as if it held `0` by the number order-by instead of being
skipped like a doc that never had a value;
- ends up in the `0` group of the number group-by.

A doc that never had the property (value `undefined`) already behaves
correctly, since `Number(undefined)` is `NaN` and all three providers
drop `NaN`. The fix makes an empty string follow that same path (`value
? Number(value) : NaN`) in `filters/number.ts`, `order-by/number.ts` and
`group-by/number.ts`. A stored `'0'` is a non-empty string, so a real
zero is unaffected.

I added `collection-rules/__tests__/number.spec.ts`, which feeds the
providers four docs (`'0'`, `'3'`, `''`, `undefined`). On `canary` three
of its four tests fail:

```
AssertionError: expected [ 'cleared', 'zero' ] to deeply equal [ 'zero' ]
AssertionError: expected [ 'zero', 'cleared', 'three' ] to deeply equal [ 'zero', 'three' ]
AssertionError: expected { '0': [ 'zero', 'cleared' ], …(1) } to deeply equal { '0': [ 'zero' ], '3': [ 'three' ] }
Tests  3 failed | 1 passed (4)
```

With the change all four pass, and `yarn vitest run
packages/frontend/core/src/modules/collection-rules
packages/frontend/core/src/modules/journal` is green (25 tests).
`oxlint` and `oxfmt --check` are clean on the touched files.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE) — required
before merge; the `license/cla` check must be green ([how it
works](https://github.com/toeverything/AFFiNE/blob/canary/docs/BUILDING.md#sign-the-cla-first))
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [ ] `yarn lint` and `yarn typecheck` pass locally
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.

Found by a defect-hunting pipeline I build and run
([Dev-next-gen](https://github.com/Dev-next-gen)), using Claude Code
with Anthropic's Claude Opus 5.

"Nothing this pipeline produces is submitted without human approval. The
entire pull request — the code change, the tests and this description —
was reviewed by a human before the pipeline was allowed to submit it."

(@Dev-next-gen)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **New Features**
- Search results can include database rows linked to matching documents,
with offset and cursor pagination.
- Linked-document references in database titles display resolved page
titles and remain searchable as titles change.
- AFFiNE AI adds Claude Haiku and updates available Claude and Gemini
models.
- Generated images can appear directly in AI responses when a shareable
link is unavailable.
- Select all in the LaTeX editor works with the platform’s standard
keyboard shortcut.

- **Bug Fixes**
- Cleared or unset numeric properties are no longer treated as `0` in
comparisons, sorting, or grouping.
- Linked document IDs resolve consistently across document actions and
views.

- **Tests**
- Added coverage for numeric filters, sorting, grouping, and emptiness
checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:59:22 +08:00
CommaBotandDarkSky 4c3593d926 fix(component): use the slant axis for Inter italic (#15913)
Inter ships as one variable font whose italics come from its `slnt` axis
(-10..0), but `fonts.css` only declared a face with the default
`font-style: normal`. For italic text Chromium up to at least 145 (and
so the current Electron 39 desktop builds) applied the slant axis and
then synthesized an oblique on top of it, which is why italics lean far
more than the font intends.

This declares an explicit italic face from the same file with
`font-variation-settings: 'slnt' -10`.

Rendered `font-style: italic` text, compared with upright text using
`font-variation-settings: 'slnt' -10`:

| | before | after |
|---|---|---|
| Chromium 145 / Electron 39 | slanted twice | matches slnt -10 |
| Chromium 150 (Electron 43) / Chrome 157 | matches slnt -10 | matches
slnt -10 |
| Firefox 160 | matches slnt -10 | matches slnt -10 |
| WebKit (macOS) | upright | upright |

Declaring the face as `font-style: oblique 0deg 10deg` instead fixes
WebKit but makes every Chromium version slant twice, so it is not used.
Without `font-variation-settings` on the italic face Firefox renders it
upright.

Adds a test that the italic face uses the font's own minimum `slnt`
value.

fix #14451

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:56:03 +08:00
keepClamDown 761bbd3bc6 fix(native): handle more hand-written markdown in disk sync (#15616)
## Description

Disk Markdown sync could not reliably sync Markdown files written
outside AFFiNE:

- A file containing a table failed to import (`invalid_projection`),
because the table is an opaque block that the merge only accepts as a
block marker. Unchanged opaque blocks are now matched through the
checkpointed file body and passed to the merge as markers. Edits to an
opaque block are still rejected.
- Changes the Markdown source cannot carry, such as the collapsed state
the editor sets on blocks, produced a review candidate for a
hand-written file. They now leave the checkpointed file as it is.
- Frontmatter: an empty block (`---` followed by `---`) and a closing
delimiter at the end of the file were read as body text, YAML escapes
such as `é` were kept literally, and keys AFFiNE does not sync (for
example `aliases:`) were dropped on export. Unknown lines are now kept
verbatim.
- File names for non-ASCII titles fell back to `doc`.
- The temporary file used while creating a Markdown file had a `.md`
extension, so a leftover one was imported as a document.

## Verification

- `cargo test -p affine_native --lib disk_sync`
- `cargo clippy -p affine_native --all-targets --all-features -- -D
warnings`
- `rustfmt +nightly --check` on the changed files
2026-11-23 22:55:03 +08:00
CommaBotandDarkSky bd338f8698 fix(electron): do not return the translation function over IPC (#15901)
The `i18n.changeLanguage` IPC handler returned the result of i18next's
`changeLanguage`, which is a translation function. A function cannot be
structured-cloned, so every call from the renderer rejected with
`DataCloneError` even though the language had changed in the main
process.

The handler now awaits the change and returns nothing. A unit test calls
the handler and checks the language changed and the result can be
cloned; on canary it fails with `DataCloneError: (...args) =>
this.t(...args) could not be cloned.`

Found by @keepClamDown in #15616.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Language changes continue to apply as requested, while the request no
longer returns an internal result.
* **Tests**
* Added coverage for changing the application language and restoring the
default language after testing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:54:13 +08:00
CommaBotandDarkSky aa64a2b2c4 fix(editor): open comments from peek view in the workbench (#15909)
In a doc shown in center peek, clicking a comment mark or adding a
comment opened the comment tab of the workbench sidebar behind the peek
modal, so nothing visible happened.

This change:
- adds `PeekViewEntity.openInWorkbench(docRef, options)` (open the doc
in the workbench, close the peek) and uses it for the peek controls'
open / new tab / split view actions
- passes `isInPeekView` (from the existing `useInsidePeekView()`
context, as the edgeless block header already does) to the comment view
extension
- in peek view, the comment provider opens the doc through
`openInWorkbench` with `mode` and `commentId` before showing the comment
panel; the editor's existing `commentId` selector handling scrolls to
and highlights the comment

fix #15607

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:51:23 +08:00
CommaBotandDarkSky d70213bb17 fix(electron): keep trashed local workspaces from coming back (#15914)
Trashing a local workspace copies its directory to `deleted-workspaces`
and then removes the original. On Windows that removal often fails
because the database file is still locked; the error was only logged.
The leftover stays hidden while its backup exists, but deleting the
backup from the archive removed only the backup, so the next scan of
local workspaces found the leftover and the workspace came back.

- Removing a workspace directory now retries (`fs.rm` with
`maxRetries`), which covers a lock released shortly after the connection
is closed.
- Deleting a backup first removes the leftover original, then the
backup. If the leftover still cannot be removed, the error is returned
and the backup is kept, so the workspace stays in the archive (and
hidden from the workspace list) and can be deleted again later instead
of coming back. No data is removed unless the user deleted it.

Adds tests for deleting a backup with a leftover original, both when it
can be removed and when it is locked.

fix #14731

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:44:58 +08:00
CommaBotandDarkSky 0e7fa49adc fix(editor): paint editor popups above the bi-directional links panel (#15919)
Editor popups are mounted inside `editor-host`, which forms its own
stacking context at the default level. The Show/Hide button in the
bi-directional links panel is positioned and rendered later, so it
painted over open database menus.

The editor container is a flex item, so it now sets `z-index: 1`. This
lifts the editor's stacking context above the following panels without
adding a positioned ancestor, so popup placement and click-outside areas
stay the same. The doc viewport uses `isolation: isolate` so the raised
layer stays below overlays outside the viewport, such as the outline
viewer in doc peek.

fix #14723

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Database view options menus now appear above overlapping controls,
making the menu easier to see and use.
  * Editor popups are displayed above panels that overlap the editor.

* **Tests**
* Added coverage to verify the database options menu is visible and on
top at an overlapping point.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 22:40:25 +08:00
CommaBotandDarkSky 6bf2a097df fix: test & lint (#15920)
## Summary

- Ignore `packages/backend/native/src/*.license.json` in
`.prettierignore` and `.oxlintrc.json` so signed license payloads stay
byte-stable.
- Format native Rust sources to `rustfmt.toml` and box
`VerifiedAnyLicense::V2` to keep enum size small.
- Set `claimed_attempt` on the claimed worker snapshot in
`snapshot_commit_is_atomic_and_transfer_moves_the_entitlement` to match
receipt generation fencing.
- Inject the `event` stub in `gateway-cluster.spec.ts` and add
table-driven checks for cross-channel `sync-027` invalidation
broadcasts.

## Production Lock-Release Race Fix

- `PaymentConnection::reacquire_with` previously dropped its
`close_on_drop()` connection and called `try_acquire` before Postgres
finished releasing session advisory locks.
- Under load, that race caused self-collision and spurious
`payment_busy` failures.
- `PaymentConnection::release` now runs `SELECT
pg_advisory_unlock_all()` and closes the connection before
`reacquire_with` or partial `try_acquire` failures return.
- `payment_session_locks_are_sorted_nonblocking_and_connection_bound`
now verifies 32 consecutive `reacquire_with` lock expansions without
collision.

## Verification

- `yarn lint:format` passed across 7504 files.
- `cargo +nightly fmt --all -- --check` passed.
- `cargo clippy --workspace --exclude affine_server_native --all-targets
--all-features -- -D warnings` passed.
- `cargo clippy -p affine_server_native --all-targets --all-features --
-D warnings` passed.
- `cargo test -p affine_server_native` passed for `license_v2`,
`receipt_attempt`,
`payment_session_locks_are_sorted_nonblocking_and_connection_bound`, and
`snapshot_commit_is_atomic_and_transfer_moves_the_entitlement` against
PostgreSQL 16 and Redis.
- `ava` passed both tests in
`packages/backend/server/src/__tests__/sync/gateway-cluster.spec.ts`.

Models: Gemini 4 Neon, Gemini 4 Carbon.
Test frameworks: Cargo test, Clippy, rustfmt, oxfmt, AVA.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved payment connection recovery so locks acquired before a failed
scope acquisition are released before retrying. Connections now release
their locks explicitly, and failures to unlock are reported as database
errors.
* Corrected gateway invalidation broadcasts so updates reach appropriate
remote channels without unnecessary broadcasts to local or unspecified
channels.
* **Tests**
* Expanded coverage for payment lock cleanup and gateway invalidation
routing, including cases with missing or local channel information.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: DarkSky <darksky2048@gmail.com>
2026-11-23 17:19:29 +08:00
Jason 8e549b05d2 fix(server): detect svg root behind xml declaration (#15889)
## Description

Refs #15871

`get_mime` asks `infer` first, and `infer` returns `text/xml` for
anything that starts with `<?xml`. An SVG exported from draw.io,
Inkscape or Illustrator usually carries that declaration, so it was
labelled `text/xml`, while the same file without the declaration came
out as `image/svg+xml`.

`get_mime` now looks at the root element before calling `infer`. It
walks the first 64 KiB with `xmlparser` (already in the lock file
through `instant-xml`, now a direct dependency), skipping BOM,
whitespace, comments, processing instructions and DOCTYPE with an
internal subset, and stops at the first element name. A root of `svg` or
`prefix:svg` gives `image/svg+xml`. No DTD is fetched and no entity is
expanded.

`file-format` matches `<svg` as a bare prefix or substring, so
`<svg-image/>` or `<svgFoo>` used to come out as SVG. When the scan
finds a root with a different name, the result is now `text/xml`. When
the scan is inconclusive (truncated root tag, root beyond 64 KiB,
invalid UTF-8), the old result is kept.

Scope, to be precise about what this changes on canary: the normal image
upload path (`setBlob`, presigned and multipart) stores the MIME type
the client sends and never sniffs, so a correctly typed upload does not
hit this. What does hit it is every path that relies on server-side
detection: object storage writes without a content type
(`complete_for_body`), comment attachments (`getMime`), and the
`sniffMime` callers (copilot attachments, workspace files, transcripts,
conversation inbox, avatars). Blobs already stored as `text/xml` are not
migrated.

Security: `applyAttachHeaders` already treats both `text/xml` and
`image/svg+xml` as dangerous inline types (forced `attachment`
disposition plus `nosniff`), so download handling does not change.
Avatars and inbox images still go through `processImage`, which rejects
SVG just as before.

Tests:

- `cargo test -p affine_server_native file_type::tests`: declaration,
BOM, comments, DOCTYPE with entities, `xml-stylesheet` PI, `svg:svg`, a
long Illustrator-style header; non-SVG roots, `<svg>` inside comments,
entities and children, `<SVG>`, `<svg-image>`; truncated and empty
input; the 64 KiB bound.
- `cargo test -p affine_server_native
runtime::object_storage::fs::tests`: put without a content type, then
HEAD/GET, for bare SVG, declaration SVG and plain XML; explicit
`image/svg+xml` and `text/xml` are kept as given.
- `cargo clippy -p affine_server_native --lib` is clean.

## Checklist

- [x] I have signed the [AFFiNE Contributor License
Agreement](https://cla-assistant.io/toeverything/AFFiNE)
- [x] The PR targets the `canary` branch and its title follows
[Conventional Commits](https://www.conventionalcommits.org/)
- [x] Tests are added or updated where it makes sense
- [x] `yarn lint` and `yarn typecheck` pass locally (Rust-only change;
`cargo clippy` and `cargo fmt --check` on the touched files)
- [x] If the PR code includes AI-generated edits, I have carefully
reviewed it to ensure that the scope of the PR is consistent with what
is claimed in the title and description, and that there are no redundant
or invalid implementations.
- [x] I agree that maintainers may close the PR without discussion if
they consider the code quality to be too low.
2026-11-23 12:01:46 +08:00
DarkSky 12df368ad6 fix(server): add forward compatibility for 0.27.5 cutover 2026-11-23 10:44:42 +08:00
DarkSky 577ae12b51 feat(mobile): bump xcode deps (#15885)
#### PR Dependency Tree


* **PR #15885** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved handling of app links and shared content when the iOS app
opens or returns to the foreground.
* iOS simulator tests now install and launch the app before running, and
verify that it stays open.
* **Chores**
* Updated the iOS build and release process to use Xcode 27 and require
an iOS SDK version of 27 or later.
* Adjusted release builds to preserve the required components for iOS
app packaging.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-22 22:30:44 +08:00
DarkSky 9e28d069bf fix(server): blob read guard (#15886)
fix #15867 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Workspace manifests now reference only the current avatar, including
when the workspace document is incomplete. Stale avatars and unrelated
image references are no longer treated as accessible through the
manifest.
* Generated images can be returned inline when a signed link is
unavailable, avoiding unnecessary failures in that case. Image results
and remotely fetched images are also stored consistently.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-22 22:17:24 +08:00