Commit Graph

4218 Commits (b8029c70efcf9ff668244758520ea0e13abba2c0)
 

Author SHA1 Message Date
Steven b8029c70ef chore: fix OAuth callback double-run state error 4 months ago
Johnny d14cfa1c4f fix: auto-fix permission issues when upgrading from 0.25.3 to 0.26.0
Fixes #5551

The Docker image now runs as non-root (UID 10001) for security, but this
breaks upgrades from 0.25.3 where data files were owned by root.

Changes:
- Dockerfile: Keep USER as root, install su-exec
- entrypoint.sh: Fix ownership of /var/opt/memos, then drop to non-root
- Supports custom MEMOS_UID/MEMOS_GID env vars for flexibility

This allows seamless upgrades without manual chown on the host.
4 months ago
Johnny 1696c6c414 fix: add nil check for currentUser in DeleteUser
Defense-in-depth fix: Add missing nil check before accessing
currentUser.ID and currentUser.Role in DeleteUser function.

While the auth interceptor should block unauthenticated requests,
this check prevents potential nil pointer panic if fetchCurrentUser
returns (nil, nil).
4 months ago
Johnny c7b48b800f fix: add access control checks for attachments, comments, and reactions
Security fixes for multiple authorization bypass vulnerabilities:

- GetAttachment: Add visibility check via checkAttachmentAccess helper
- UpdateAttachment: Add ownership check (creator or admin only)
- Fileserver: Require creator/admin auth for unlinked attachments
- ListMemoAttachments: Add memo visibility check
- CreateMemoComment: Add memo visibility check for target memo
- ListMemoReactions: Add memo visibility check
- UpsertMemoReaction: Add memo visibility check

All checks follow the existing pattern used in GetMemo for consistency.
4 months ago
Johnny 86fab0cf4c fix(fileserver): use streaming for video/audio to prevent memory exhaustion
- Add serveMediaStream() to stream video/audio without loading into memory
- Use http.ServeFile for local files (zero-copy, handles range requests)
- Redirect to S3 presigned URLs for S3-stored media files
- Refactor for better maintainability:
  - Extract constants and pre-compile lookup maps
  - Consolidate duplicated S3 client creation logic
  - Split authentication into focused helper methods
  - Group code by responsibility with section comments
  - Add setSecurityHeaders() and setMediaHeaders() helpers
4 months ago
Ganesh M 27de96d440
fix(ui): math render (#5549) 4 months ago
Johnny 8cd9c591d4 chore: deprecate remove completed tasks action
- Remove menu item and dialog from MemoActionMenu
- Remove removeCompletedTasks() and hasCompletedTasks() utilities
- Remove translation keys from all 34 locale files
- Feature was not aligned with standard note-taking UX patterns
4 months ago
Johnny 5396c126b8 chore: extract task list class names to constants
- Add TASK_LIST_CLASS and TASK_LIST_ITEM_CLASS constants
- Replace hardcoded 'contains-task-list' and 'task-list-item' strings
- Improve maintainability and prevent typos
4 months ago
Johnny 97ba15450f chore: prevent unnecessary API calls when timestamp unchanged in MemoDetailSidebar
- Add same value check before updating createTime/updateTime
- Skip request if new timestamp equals current timestamp
- Simplify callback handlers and improve code readability
- Use .some() instead of .filter().length for cleaner code
4 months ago
Johnny f7a81296fb style: enhance ActivityCalendar components with improved styling and layout adjustments 4 months ago
Johnny fcb9e377c1 chore: streamline memo editor insert menu 4 months ago
Steven b32cba35c6 fix: add nil check for AnyResponse in WrapUnary method to prevent caching issues 4 months ago
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
4 months ago
Johnny 81022123a1 chore: simplify page loading logic 4 months ago
cui c5d9770fd1
typo: lenght to length (#5539) 4 months ago
Johnny 6731eccded feat: add EditableTimestamp component for inline date editing in MemoDetailSidebar 4 months ago
Johnny a7b0d71f6e feat: implement EXIF metadata stripping for image uploads 4 months ago
Brent Bilis 2f7c8dcea7
fix(ui): correct calendar header month parsing (#5532)
Co-authored-by: Local Admin <root@localhost>
4 months ago
Johnny e1888153f8 chore: polish dark styles 4 months ago
Johnny 98eaff1277 style: adjust spacing and background colors for improved UI consistency across components 4 months ago
Johnny 72c7965c8f chore: enable binary format for transport 4 months ago
Salman Chishti a8dbc1fd5e
chore: upgrade GitHub Actions for Node 24 compatibility (#5527)
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
4 months ago
itzmk21 f22b3dad25
chore(i18n): update British English spelling (#5529) 4 months ago
Salman Chishti 1e82723e88
chore: upgrade GitHub Actions to latest versions (#5528)
Signed-off-by: Salman Muin Kayser Chishti <13schishti@gmail.com>
4 months ago
XIN_____ 45945a1df7
chore: update Chinese translation (#5519) 4 months ago
Pádraic Slattery 7fbf3bed85
chore: update outdated GitHub Actions versions (#5522) 4 months ago
Johnny ad327a4a8d fix: adjust compact mode styling for MemoContent component 4 months ago
Johnny 7154ce0228 feat: implement markdown components for enhanced rendering 4 months ago
Steven c0d6224155 chore: enable compact mode for list view 4 months ago
Steven 6c9ea31de0 chore: add translation for saving status in EditorToolbar 4 months ago
Steven 501e8f1eae chore: implement read-write lock for owner cache 4 months ago
Steven edcddf3c95 chore: fix tests 4 months ago
Steven fd29a98c90 chore: fix linter 4 months ago
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.
4 months ago
Steven c240b70591 feat: add enabled option to useInfiniteMemos and PagedMemoList for conditional fetching 4 months ago
Steven 956ae0ebc5 fix: prevent browser caching of API responses in MetadataInterceptor 4 months ago
Steven 9cc970a3ea chore: fix data directory handling 4 months ago
Steven 4180613fc0 fix: update demo mode handling 4 months ago
Johnny 324f795965 fix: improve default data directory handling 4 months ago
Johnny d3ed069ddb refactor: remove environment variable binding for instance URL 4 months ago
Johnny 0f3c9a467d refactor: migrate HOST roles to ADMIN
- Updated the isSuperUser function to only check for ADMIN role.
- Added SQL migration scripts for MySQL, PostgreSQL, and SQLite to change user roles from HOST to ADMIN.
- Created a new SQLite migration to alter the user table structure and ensure data integrity during the migration process.
4 months ago
Johnny 47ebb04dc3 refactor: remove mode flag and introduce explicit demo flag 4 months ago
Johnny 05f31e457e fix: add mmap size setting to database connection to prevent OOM errors 4 months ago
Johnny 552318209b
fix: resolve flaky migration tests and add stable upgrade test (#5514) 4 months ago
Steven 00f21b86e2 chore: remove redundant tests 4 months ago
Steven d8b5bd61ab chore: tweak sponsor assets 4 months ago
Johnny 7089db06c2 test: enhance memo filter tests with COALESCE for JSON extraction and add migration data persistence tests 4 months ago
Johnny af2a2588bf chore(test): add edge case tests for user settings shortcuts and JSON fields 4 months ago
Johnny dc7ec8a8ad feat: allow setting custom timestamps when creating memos and comments
Allow API users to set custom create_time, update_time, and display_time
when creating memos and comments. This enables importing historical data
with accurate timestamps.

Changes:
- Update proto definitions: change create_time and update_time from
  OUTPUT_ONLY to OPTIONAL to allow setting on creation
- Modify CreateMemo service to handle custom timestamps from request
- Update database drivers (SQLite, MySQL, PostgreSQL) to support
  inserting custom timestamps when provided
- Add comprehensive test coverage for custom timestamp functionality
- Maintain backward compatibility: auto-generated timestamps still
  work when custom values are not provided
- Fix golangci-lint issues in plugin/filter (godot and revive)

Fixes #5483
4 months ago
Johnny cbf46a2988 feat(filter): add CEL list comprehension support for tag filtering
Add support for CEL exists() comprehension with startsWith, endsWith, and
contains predicates to enable powerful tag filtering patterns.

Features:
- tags.exists(t, t.startsWith("prefix")) - Match tags by prefix
- tags.exists(t, t.endsWith("suffix")) - Match tags by suffix
- tags.exists(t, t.contains("substring")) - Match tags by substring
- Negation: !tags.exists(...) to exclude matching tags
- Works with all operators (AND, OR, NOT) and other filters

Implementation:
- Added ListComprehensionCondition IR type for comprehension expressions
- Parser detects exists() macro and extracts predicates
- Renderer generates optimized SQL for SQLite, MySQL, PostgreSQL
- Proper NULL/empty array handling across all database dialects
- Helper functions reduce code duplication

Design decisions:
- Only exists() supported (all() rejected at parse time with clear error)
- Only simple predicates (matches() excluded to avoid regex complexity)
- Fail-fast validation with helpful error messages

Tests:
- Comprehensive test suite covering all predicates and edge cases
- Tests for NULL/empty arrays, combined filters, negation
- Real-world use case test for Issue #5480 (archive workflow)
- All tests pass on SQLite, MySQL, PostgreSQL

Closes #5480
4 months ago