Commit Graph

83 Commits

Author SHA1 Message Date
Steven c3061002f3 fix(web): persist auth token in localStorage for cross-tab sessions
Switch from sessionStorage to localStorage so the auth token survives
across tabs and browser restarts, matching standard platform behavior.
Also guard the signup redirect in App.tsx behind profileLoaded to avoid
a false redirect when the instance profile fetch fails.
2026-02-22 13:55:46 +08:00
Steven b0558824c4 feat: update instance profile to use admin user instead of initialized flag
- Changed InstanceProfile to include admin user field
- Updated GetInstanceProfile method to retrieve admin user
- Modified related tests to reflect changes in admin user retrieval
- Removed owner cache logic and tests, introducing new admin cache tests
2026-01-28 23:27:53 +08:00
Steven ba099b72ed feat: update InstanceProfile to include initialization status
- Removed the owner field from InstanceProfile as it is no longer needed.
- Added an initialized field to InstanceProfile to indicate if the instance has completed first-time setup.
- Updated GetInstanceProfile method to set initialized based on the existence of an admin user.
- Modified tests to reflect changes in InstanceProfile and ensure correct behavior regarding instance initialization.
- Adjusted frontend logic to redirect users based on the initialized status instead of the owner field.
2026-01-22 20:59:40 +08:00
Johnny f87f728b0f
feat: react query migration (#5379) 2025-12-24 22:59:18 +08:00
Steven 3dc740c752 refactor(web): improve locale/theme preference initialization
- Extract preference logic into dedicated hooks (useUserLocale, useUserTheme)
- Add applyLocaleEarly() for consistent early application
- Remove applyUserPreferences() from user store (now redundant)
- Simplify App.tsx by moving effects to custom hooks
- Make locale/theme handling consistent and reactive
- Clean up manual preference calls from sign-in flows

Fixes locale not overriding localStorage on user login.
Improves maintainability with better separation of concerns.
2025-12-11 07:59:52 +08:00
Steven 81da20c905 refactor: simplify theme/locale to user preferences and improve initialization
Remove theme and locale from instance settings to eliminate duplication and
simplify the codebase. These are user-specific preferences and should only
exist in user settings, not instance-wide settings.

Backend changes:
- Remove theme from InstanceGeneralSetting proto
- Remove locale from InstanceCustomProfile proto
- Update instance service converters to remove theme/locale handling
- Simplify RSS feed to use static locale

Frontend changes:
- Remove theme/locale from instanceStore state
- Create unified initialization flow with clear fallback priority:
  * Theme: user setting → localStorage → system preference
  * Locale: user setting → browser language
- Add applyUserPreferences() to centralize theme/locale application
- Simplify App.tsx by removing redundant state synchronization
- Update all components to use new helper functions:
  * getThemeWithFallback() for theme resolution
  * getLocaleWithFallback() for locale resolution
- Remove theme/locale selectors from instance profile dialog

Theme utilities refactor:
- Organize code into clear sections with JSDoc comments
- Extract localStorage operations into getStoredTheme/setStoredTheme helpers
- Split DOM manipulation into focused functions
- Improve type safety with Theme and ResolvedTheme types
- Reduce code duplication and improve maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:08:46 +08:00
Steven 156908c77f chore(web): migrate from ESLint+Prettier to Biome
- Install @biomejs/biome@2.3.5 as unified linter and formatter
- Remove ESLint, Prettier and all related plugins (221 packages removed)
- Migrate linting rules from ESLint to Biome configuration
- Migrate formatting rules from Prettier to Biome configuration
- Exclude auto-generated proto files from linting (src/types/proto/**)
- Exclude CSS files from Biome (Tailwind syntax not yet supported)
- Update package.json scripts:
  - lint: tsc + biome check
  - lint:fix: biome check --write
  - format: biome format --write
- Auto-fix import organization across 60+ files
- Fix duplicate key in Russian locale (ru.json)
- Update CLAUDE.md documentation to reflect Biome usage

Benefits:
- 10-100x faster linting performance
- Simplified toolchain with single configuration file
- 221 fewer npm dependencies
- Unified linting, formatting, and import organization
2025-11-14 23:58:07 +08:00
boojack 7d4d1e8517
feat(web): standardize theme system with auto sync option (#5231)
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-08 00:41:21 +08:00
Steven 4c1d1c70d1 refactor: rename workspace to instance throughout codebase
Remove work-related terminology by renaming "workspace" to "instance"
across the entire application. This change better reflects that Memos
is a self-hosted tool suitable for personal and non-work use cases.

Breaking Changes:
- API endpoints: /api/v1/workspace/* → /api/v1/instance/*
- gRPC service: WorkspaceService → InstanceService
- Proto types: WorkspaceSetting → InstanceSetting
- Frontend translation keys: workspace-section → instance-section

Backend Changes:
- Renamed proto definitions and regenerated code
- Updated all store layer methods and database drivers
- Renamed service implementations and API handlers
- Updated cache from workspaceSettingCache to instanceSettingCache

Frontend Changes:
- Renamed service client: workspaceServiceClient → instanceServiceClient
- Updated all React components and state management
- Refactored stores: workspace.ts → instance.ts
- Updated all 32 locale translation files

All tests pass and both backend and frontend build successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 23:35:35 +08:00
Claude dc9470f71c feat: implement OAuth state management with CSRF protection and cleanup functionality 2025-11-02 23:23:44 +08:00
Johnny e93f3cbb8b refactor: unify theme and apperance 2025-08-17 11:27:59 +08:00
johnnyjoy c5d497a1f0 chore: update user settings 2025-07-27 23:12:42 +08:00
Steven 533591af2b chore: theme in user setting 2025-07-08 19:50:04 +08:00
Johnny f907619752 chore: move frontend store 2025-07-07 22:44:08 +08:00
Johnny 1b3083b216
feat: themes (#4824) 2025-07-07 20:13:22 +08:00
Johnny 493832aeb4 refactor: unify components 2025-07-01 19:29:48 +08:00
Steven 72babbb393 fix: dark mode of highlight.js 2025-05-20 23:58:22 +08:00
Johnny 11b9c240e9 refactor: workspace setting store 2025-02-11 21:23:46 +08:00
Johnny 9027430646 fix: store reactive 2025-02-10 22:20:07 +08:00
Johnny 5a2f18da69 refactor(frontend): retire redux 2025-02-09 11:43:55 +08:00
johnnyjoy 732a7d0bbf chore: add fa locale 2025-02-05 19:26:34 +08:00
RoccoSmit 35cf975e76
fix: apply system theme dynamically (#4010)
Remove appearance comparison
2024-10-11 21:05:52 +08:00
Steven b8763905ba chore: tweak naming 2024-05-13 20:03:04 +08:00
Steven 144269fbbc chore: fix router 2024-05-01 12:44:18 +08:00
Steven ff175bbb7e refactor: update resource binary request handler 2024-05-01 10:23:56 +08:00
Steven 4338234641 chore: retire storage related functions 2024-04-28 21:50:09 +08:00
Steven 755d5b83c6 chore: retire legacy setting api 2024-04-12 08:32:54 +08:00
Steven 18d16abdb5 chore: update workspace service 2024-03-21 21:39:34 +08:00
Steven dfe29ec766 chore: tweak route layout 2024-02-24 10:18:53 +08:00
Steven e602aeecc1 fix: update workspace general setting 2024-02-23 09:08:49 +08:00
Kristián 03d67d5a00
feat: add mermaid support in codeblock (#2971) 2024-02-19 15:10:58 +08:00
Steven e3afad74ce fix: update initial wasm 2024-02-01 19:27:54 +08:00
Steven 554f93eccc fix: move initial wasm into app 2024-02-01 19:06:44 +08:00
Steven 1857362d03 fix: locale and appearance setting 2024-01-17 22:16:12 +08:00
Steven 9ffd827028 fix: appearance and locale initial value 2024-01-16 22:53:45 +08:00
Hanqin Guan 15e6542f0d
fix: server overrides user's locale/appearance (#2771) 2024-01-16 18:21:08 +08:00
Lincoln Nogueira 089e04bcfd
chore: use webp compression on logo (#2756)
- Logo size reduced from 310 KB to 36 KB.
- Point metadata image URL to local logo instead of remote
2024-01-14 22:21:03 +08:00
Steven df5aeb6d88 chore: remove v1 prefix in store name 2023-12-23 08:48:11 +08:00
Steven 919f75af1a chore: update suspense loading 2023-12-22 19:27:09 +08:00
Steven d6656db20d feat: implement part of full-screen layout 2023-12-18 22:10:36 +08:00
Athurg Gooth aff1b47072
chore: remove debug log (#2582)
Remove debug log
2023-12-06 10:57:55 +08:00
Steven e83d483454 refactor(frontend): use auth service 2023-12-01 09:15:02 +08:00
Steven d95a6ce898 chore: add ar locale item 2023-10-14 00:25:01 +08:00
Steven 771fe394fd chore: fix initial guide 2023-10-05 15:50:16 +08:00
Steven 16dad8b00d chore: update logo 2023-10-05 08:40:25 +08:00
Steven 936fe5ac9d chore: update state initial loader 2023-09-15 08:31:19 +08:00
Steven 416e07cb1f fix: inject additional style and scripts 2023-09-12 23:43:32 +08:00
Steven b6d1ded668 chore: adjust initial states 2023-09-10 23:44:06 +08:00
boojack d114b630d2
feat: add prettier sort import plugin (#2058) 2023-07-31 22:26:45 +08:00
boojack e3496ac1a2
refactor: memo editor components (#1625) 2023-05-03 19:13:37 +08:00