87 Commits
Author SHA1 Message Date
Whitewater b22bc17bd0 fix(server): align native JWT session TTL with auth session TTL (#15210)
## Summary

This is a backend-only workaround for native/mobile sessions expiring
much earlier than the normal AFFiNE auth session.

Native JWT-backed sessions now use the existing `auth.session.ttl`
instead of the hard-coded 15-minute TTL.

No database migration, no new config, and no mobile client changes are
required.

## Background / Investigation

PR #15060 introduced native session exchange and JWT-backed native
sessions for mobile/desktop clients.

Relevant code introduced there:

- `packages/backend/server/src/core/auth/session-issuer.ts`
  - Native clients no longer receive normal auth cookies.
- `SessionIssuer` clears cookies for native clients and returns a native
session exchange code instead.

- `packages/backend/server/src/core/auth/native-exchange.ts`
- Native clients exchange the one-time code for a JWT-backed session
token.

- `packages/backend/server/src/core/auth/jwt-session.ts`
  - The JWT session implementation was introduced with:
    - `const JWT_SESSION_TTL = 15 * 60`
    - `expiresIn: JWT_SESSION_TTL`
    - normal `jwt.verify(...)` expiration enforcement

That means a native/mobile client that does not reconnect and
exchange/sign in again within 15 minutes can lose backend auth even
though the DB-backed AFFiNE user session is still valid for the normal
app session TTL, currently 15 days by default.

Web does not hit this path because web keeps using the normal
cookie-backed session issued by `AuthService`, whose expiration is based
on `auth.session.ttl`.

## Related Issues / PRs Checked

- Source PR: #15060
- Introduced native session exchange, JWT-backed sessions, native token
storage, and websocket JWT support.
- This PR appears to be the source of the hard-coded 15-minute native
JWT TTL behavior.

I did not find a public issue that directly reports "native JWT expires
after 15 minutes".

## What Changed

- Removed the hard-coded 15-minute native JWT TTL.
- Updated `JwtSessionService.sign()` to issue native JWTs with
`auth.session.ttl`.
- Kept `JwtSessionService.verify()` on normal JWT expiration
verification, so existing JWTs that already expired under the previous
15-minute `exp` need to be refreshed by signing in again.
- Kept the existing DB-backed session lookup:
- sign-out still revokes the native JWT by deleting the backing session
  - expired/deleted DB sessions still reject the JWT

## Why This Is A Workaround

A more complete long-term design would add a true refresh-token flow for
native clients, likely with persisted refresh tokens,
rotation/revocation semantics, and database changes.

This PR intentionally avoids that larger design. It restores the
expected mobile login lifetime for newly issued native JWTs by aligning
native JWT lifetime with the existing app session lifetime, while
preserving the current native exchange model, Keychain/Keystore storage,
and revoke-by-session behavior.

## Compatibility

- Backend only
- No DB schema change
- No mobile app change
- No new config
- Existing native JWTs that already expired under the old 15-minute
`exp` will still require signing in again.
- Newly issued native JWTs use `auth.session.ttl`.

## Verification

Latest verification after removing the extra native JWT TTL config:

- JWT session tests: 4 passed
- `yarn typecheck`: passed
- `lint-staged`: passed via `corepack yarn`
- `lint:ox`: passed via `corepack yarn`

Earlier broader checks on this branch also passed selected auth tests
and the websocket JWT auth subset.

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

## Summary by CodeRabbit

* **New Features**
* Session login tokens now follow the configured session lifetime, so
expiration behavior can be adjusted through app settings.

* **Bug Fixes**
* Improved consistency between token expiration and session expiry
checks.
* Added coverage for cases where a session is missing, expired, or the
session lifetime changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-11 06:40:58 +08:00
Whitewater 694158eea3 feat(playground): export Y.Doc from debug menu (#14893)
## Summary
- add an Export Y.Doc debug menu item
- encode the active store spaceDoc with Y.encodeStateAsUpdate
- download the update as a binary ydoc-update file

## Test
- yarn workspace @blocksuite/playground build

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

## Summary by CodeRabbit

* **New Features**
* Added Y.Doc export functionality to the debug menu, enabling users to
download the current space document state as a binary update file
through the "Test Operations" → "Export" menu.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-03 23:33:41 +08:00
Whitewater 3428ac478e chore: split i18n and bs-docs dirty checks in typecheck workflow (#14849)
## Summary

Split generated-file validation in the `typecheck` workflow so i18n
outputs and BS docs outputs are checked separately.

This fixes a misleading CI failure message: previously, CI could fail
due to i18n-generated changes like
`packages/frontend/i18n/src/i18n.gen.ts`, but only suggested running
`yarn typecheck && yarn affine bs-docs build`, which does not regenerate
those files.

## Changes

- validate i18n-generated changes immediately after `yarn affine
@affine/i18n build`
- keep ignoring `packages/frontend/i18n/src/i18n-completenesses.json` in
CI as before
- leave `yarn typecheck` as a separate step
- make the BS docs step only check for changes introduced by `yarn
affine bs-docs build`

## Result

CI now gives the correct remediation command depending on which
generated files are out of date:
- i18n issues: `yarn affine @affine/i18n build`
- docs/typecheck issues: `yarn typecheck && yarn affine bs-docs build`

## Testing

- verified the updated workflow YAML parses successfully


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

## Summary by CodeRabbit

* **Chores**
* Enhanced build validation for internationalization code generation to
ensure generated changes are properly committed before proceeding. The
validation now occurs immediately after code generation runs, providing
faster feedback during the build process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-19 02:12:00 +08:00
Whitewater 2ca4973167 fix(editor): make repeated "Cancel line number" clicks work in code blocks (#14804)
Fixes #13555


https://github.com/user-attachments/assets/12e55c21-080c-4c69-9780-893ccad25b45

## Summary
- make the code block More popup reactive to `wrap` and `lineNumber`
prop updates
- read the latest toggle state at click time so same-menu double toggles
do not reuse stale closures
- add e2e coverage for wrap and line number toggling twice without
closing the More menu

## Bug Reason
- the code block More popup was rendered as a static portal, so it
stayed open without re-rendering after the first toggle
- the `Cancel line number` and `Wrap` menu actions captured render-time
state in their click handlers
- after the first click updated the model, a second click in the same
open menu reused stale state and wrote the same value again, so nothing
changed visually

## Testing
- yarn workspace @affine-test/blocksuite test e2e/code/crud.spec.ts

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

* **Bug Fixes**
* Menu toggles now read and update the current wrap and line-number
states reliably.

* **Refactor**
* Replaced inline popup rendering with a dedicated more-menu component
for the code toolbar.

* **Style**
* Prevented text selection on menu action elements for smoother
interaction.

* **Tests**
  * Added e2e tests for wrap and line-number toggle flows.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-06 19:18:15 +00:00
Whitewater f5394b7450 fix: refine handling for non-standard keyboards to avoid incorrect keyCode fallback (#14206)
Fix https://github.com/toeverything/AFFiNE/issues/14059

With the help of Claude Opus 4.5

Improve handling of keyCode fallback for non-standard keyboards by only
applying it when modifier keys are pressed. This change prevents
incorrect fallback behavior for non-ASCII characters, ensuring users can
type intended characters without triggering shortcuts.

After


https://github.com/user-attachments/assets/00ab4fb2-4bc2-4ca7-a284-9782686d298c

Event dump for Cyrillic x

```json

{
 "key": "х",
 "keyCode": 219,
 "which": 219,
 "code": "BracketLeft",
 "location": 0,
 "altKey": false,
 "ctrlKey": false,
 "metaKey": false,
 "shiftKey": false,
 "repeat": false
}
```

blocksuite commit
https://github.com/toeverything/blocksuite/commit/4c0d39890fb65e8de974169fa1c96b038f6d4a83#diff-68c46455e0eece88312235df85f8ce27ae254efccde6fb987f2505180730bd8c

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

## Summary by CodeRabbit

* **Bug Fixes**
* Refined keyboard input handling to properly support non-ASCII
characters (e.g., Cyrillic, Greek) by ensuring user-typed characters are
preserved instead of inadvertently triggering keyboard shortcuts. The
fix maintains keyboard shortcut functionality while improving
compatibility with international keyboards and input methods.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-04 09:18:03 +00:00
Whitewater 1196101226 fix(editor): use onBlur for input handling in property menu (#14049)
Eliminate mobile-specific input handling from the property menu to
streamline functionality across devices.


Before


https://github.com/user-attachments/assets/563857c9-6d2f-4c38-9359-7e3e74dfb531


After


https://github.com/user-attachments/assets/0126b966-cdc2-40b7-b416-3a0e8be4aedf


Maybe related to
https://github.com/toeverything/blocksuite/pull/7524/files#diff-25406bbadb23338f3120c8d0c5e1e8485173750a57f1ba3d7a51be1c9f548696
https://github.com/toeverything/blocksuite/pull/8787/files#diff-36fb3de4c5129393febe0286eb10e9ebb791296500dc4229c9d609b9ed5e138c

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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved input field responsiveness by enhancing event handling for
blur interactions.
  
* **Improvements**
* Unified input component behavior across all platforms for more
consistent user experience.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-12-05 14:37:15 +08:00
WhitewaterandEYHN 9692a120a0 chore: filter out edgeless content from page preview (#5607)
Co-authored-by: EYHN <cneyhn@gmail.com>
2024-02-23 08:16:26 +00:00
WhitewaterandEYHN 228b0d789d feat: add shared page filter to all pages (#5540)
Co-authored-by: EYHN <cneyhn@gmail.com>
2024-02-23 16:07:13 +08:00
Whitewater 1ceaf87a86 chore: skip sync when offline (#5786) 2024-02-19 10:22:22 +08:00
WhitewaterandPeng Xiao eded501123 fix: get page preview based on block order (#4888)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
2023-11-12 15:09:57 +00:00
Whitewater 56e653140b fix: sort plugin list in test (#4289) 2023-09-08 22:36:48 +00:00
Whitewater 189e91e6ca fix(core): sort tags by count (#4122) 2023-09-01 19:13:33 +00:00
WhitewaterandAlex Yang e70f8e74ec chore: allow custom editor spec presets (#3362)
Co-authored-by: Alex Yang <himself65@outlook.com>
2023-07-25 18:57:42 +00:00
Whitewater 79227a1e7c chore: update block card styles (#3290) 2023-07-18 11:45:03 +00:00
Whitewater bf41b25988 feat: new import page component (#3277) 2023-07-18 05:36:14 +00:00
Whitewater ec99a0ce05 feat: update desc for empty page (#2710) 2023-06-08 20:28:37 +08:00
Whitewater 3b4cfc642f fix: overflow in radio button group (#2687) 2023-06-05 10:18:53 +00:00
WhitewaterandHimself65 efae4cccd6 feat: sticky table head in page list (#2668)
Co-authored-by: Himself65 <himself65@outlook.com>
2023-06-05 07:43:24 +00:00
Whitewater 23126e1ff6 fix: show table head when no item in page list (#2642) 2023-06-01 16:31:51 +08:00
Whitewater 53d1991211 chore: update page group naming (#2628) 2023-05-31 16:41:25 +00:00
Whitewater 90e70ed986 fix: drag delay (#2621) 2023-05-31 16:21:50 +08:00
Whitewater 20f1d487c8 feat: add page preview (#2620) 2023-05-31 08:18:48 +00:00
Whitewater 855fd8a73a feat: page list supports preview (#2606) 2023-05-31 04:24:55 +00:00
Whitewaterandhimself65 0bb6e362bf feat: add page mode filter (#2601)
Co-authored-by: himself65 <himself65@outlook.com>
2023-05-31 11:15:23 +08:00
Whitewater 31d552ab7e fix: update breakpoint in all page (#2602) 2023-05-30 18:27:42 +08:00
Whitewater 88eaaf9ce4 feat: add radio group (#2572) 2023-05-29 23:15:22 +08:00
Whitewater 7969b73979 chore: tweak all page styles (#2540) 2023-05-26 15:13:50 +08:00
WhitewaterandHimself65 36534f1915 feat: add storybook i18n decorator (#2538)
Co-authored-by: Himself65 <himself65@outlook.com>
2023-05-26 14:28:11 +08:00
WhitewaterandHimself65 7dcbe64d4e feat: group all page by date (#2532)
Co-authored-by: Himself65 <himself65@outlook.com>
2023-05-26 05:23:51 +00:00
Whitewater 3b8f2c1ac3 refactor: use date obj in all pages (#2523) 2023-05-25 18:22:57 +08:00
Whitewater be065e2de3 fix: sort in desc based update date by default (#2510) 2023-05-25 15:33:02 +08:00
Whitewater 281a068cfb chore(i18n): remove unused dependencies (#2485) 2023-05-22 17:03:55 +08:00
Whitewater fe5be0cb47 fix: flatten i18n keys (#2483) 2023-05-22 08:08:43 +00:00
Whitewater d68b421a4b feat: add responvise page view (#2453) 2023-05-22 07:25:25 +08:00
Whitewater 530dd5ff7f feat: add new page button (#2417) 2023-05-18 13:07:05 -07:00
Whitewater 1498ee405b feat: add dropdown button (#2407) 2023-05-17 16:32:37 +08:00
Whitewater 017b9c8615 feat: add block card component (#2398) 2023-05-16 18:19:28 +08:00
Whitewater 9ce3a96862 fix: unexpected undefined class in popup (#2394) 2023-05-16 10:01:27 +00:00
Whitewater a8b8986d89 chore: disable confused storybook backgrounds addon (#2395) 2023-05-16 17:46:35 +08:00
Whitewater 9ff7dbffb7 feat: supports sort all page (#2356) 2023-05-15 08:50:43 -07:00
Whitewater dbd3249ae5 chore: clean all page list (#2245) 2023-05-05 14:46:58 -05:00
Whitewaterandhimself65 84b36c1d35 refactor: clean all pages component (#2176)
Co-authored-by: himself65 <himself65@outlook.com>
2023-05-04 22:59:16 -05:00
Whitewater f9b012cac9 feat: add breakpoints (#2191) 2023-04-28 05:21:14 -05:00
Whitewaterandhimself65 2b05a1254b chore: hide pinboard (#2149)
Co-authored-by: himself65 <himself65@outlook.com>
2023-04-26 19:31:01 -05:00
Whitewater ba2295c426 fix: remove duplicated link css (#1631) 2023-03-22 01:02:57 -05:00
Whitewaterandhimself65 bc32b07bf0 fix: quick search tips follow when resize (#1580)
Co-authored-by: himself65 <himself65@outlook.com>
2023-03-15 16:27:38 +00:00
Whitewater c096fa156b chore: add timed update workflow (#1214) 2023-03-01 12:23:54 +08:00
Whitewater b6cb52f702 refactor: search input (#1205) 2023-02-27 18:08:06 +08:00
Whitewater 497e8570db chore: remove workaround margin (#1124) 2023-02-19 17:16:12 +08:00
Whitewater 944c455c3d feat: enable slash menu by default (#939) 2023-02-10 12:03:37 +08:00
Whitewater 9b427efb88 chore: remove custom vscode settings 2023-02-09 23:41:09 +08:00
Whitewater 7c6a474929 chore: bump blocksuite (#506) 2022-10-26 17:48:25 +08:00
Whitewater a942b8b9f1 Feat/bump (#55)
* chore: update dependencies

* fix: update block suite api

* chore: use strict mode

* chore: clean code
2022-10-26 11:52:46 +08:00
Whitewater 23661b42b7 chore: simplify ci (#54) 2022-10-25 22:28:42 +08:00
Whitewater cf99129205 fix: minify incorrect (#23)
* fix: minify incorrect

* chore: format
2022-10-14 19:29:36 +08:00
Whitewater 12c5e80dba chore: update contributors (#478) 2022-10-01 17:25:25 +08:00
Whitewater 3d27b42f09 Merge pull request #462 from toeverything/fix/font
Fix/windows font
2022-09-27 15:38:04 +08:00
Whitewater e4a76ed058 Fix/ci (#3)
* fix: ci

* chore: test ci

* fix: ci

* feat: add nginx conf

* chore: remove debug
2022-09-23 17:31:26 +08:00
Whitewater 1158bc9304 Fix: window.client.inspect not found (#452)
fix: window.client.inspect not found
2022-09-22 14:25:17 +08:00
Whitewater 47bbf187a5 fix(i18n): default language select (#450)
* fix: default language

* feat: mobile support multiple languages
2022-09-21 21:29:04 +08:00
Whitewater f81459d4c0 Feat/left menu i18n (#407)
* feat(i18n): add left menu i18n

* chore(i18n): add missing ComingSoon

* chore(i18n): update docs

* fix: lint
2022-09-12 19:17:59 +08:00
Whitewater b48d2c1393 Fix/issue 271 (#371)
* fix: issue #271

* chore: clean
2022-09-06 16:01:26 +08:00
Whitewater 9b54ffdb64 chore: update contributor 2022-09-02 07:39:23 +00:00
Whitewater 1e68c9c090 chore: prettier 2022-09-02 14:34:07 +08:00
Whitewater e186957e55 chore: lint 2022-09-02 14:22:38 +08:00
Whitewater f9bd53aaca fix(keyboard): hotkey unbind incorrect (#353) 2022-09-01 17:34:19 +08:00
Whitewater 3c79d66946 fix: disable ref page selection (#343) 2022-08-29 10:23:33 +00:00
Whitewater 2f11620221 fix: kanban tree view (#342) 2022-08-29 16:25:30 +08:00
Whitewater 15055bc7c6 Merge pull request #318 from toeverything/feat/block-render
Feat/block render
2022-08-24 10:32:06 +08:00
Whitewater 01339fc77d docs: update contributors (#300) 2022-08-19 18:44:26 +08:00
Whitewater ad0738083a Merge pull request #106 from toeverything/feat/editable-kanban-card
Feat/editable kanban card
2022-08-19 11:02:42 +08:00
Whitewater 59d4cda1cc fix: workaround weird type error 2022-08-17 04:30:04 -08:00
Whitewater 137f48c338 chore: remove unused file 2022-08-17 11:01:41 +08:00
Whitewater 94e8903d16 Docs/update-contributors (#260)
* refactor: update badge template

* docs: update contributors
2022-08-16 01:07:49 +08:00
Whitewater 57b8263acd Merge pull request #207 from toeverything/chore/page-tree-styles
Chore/page tree styles
2022-08-12 16:51:54 +08:00
Whitewater 9be0735207 chore: align tree line (#211) 2022-08-12 07:17:51 +00:00
Whitewater 94dbd89d8f fix: console error (#180) 2022-08-11 11:18:44 +08:00
Whitewater 4c9f04bc1c Merge pull request #173 from toeverything/fix/drag-kanban-active-selection
fix: cancel kanban mouse down event
2022-08-10 15:42:56 +08:00
Whitewater 22f325fbff Merge pull request #166 from toeverything/refactor/page-tree-styles
Refactor/page tree styles
2022-08-10 10:38:17 +08:00
Whitewater 73d7d4e1a8 Merge pull request #157 from toeverything/fix/page-plugin
fix page title tranform
2022-08-09 18:02:31 +08:00
Whitewater 81867d85e3 chore: prefer const 2022-08-09 12:33:56 +08:00
Whitewater cf6491fb0c Merge pull request #42 from toeverything/feat/sub-page
Feat/sub page
2022-08-05 17:44:34 +08:00
Whitewater d683f7ce05 Merge pull request #61 from toeverything/fix/template-error
fix: check error
2022-08-03 17:01:18 +08:00
Whitewater 4c70c8ea4a Merge pull request #55 from toeverything/chore/readme
chore: update badge
2022-08-03 01:09:35 +08:00
Whitewater 873ded9147 Merge pull request #7 from toeverything/chore/kanban-card-styles
Chore/kanban card styles
2022-08-01 16:54:39 +08:00
Whitewater 01c8b8959f Merge branch 'master' into chore/kanban-card-styles 2022-08-01 16:43:59 +08:00
Whitewater 358f9031ff Merge pull request #3 from toeverything/feat/emotion-babel-plugin
feat: add @emotion/babel-plugin
2022-08-01 16:43:23 +08:00