mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-16 12:10:28 +03:00
- Enable sliding sync in config.json with matrix.org proxy - Update font from InterVariable to SF Pro Display - Add sliding sync state management with Jotai atoms - Create bridge between sliding sync and existing room list atoms - Add sliding sync settings UI in General settings - Implement purple theme with gradient enhancements - Add synchronization status display for sliding sync - Update client initialization to support sliding sync 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
4.9 KiB
4.9 KiB
Sliding Sync Implementation
This document describes the sliding sync integration added to Cinny.
Overview
Cinny now supports Matrix's sliding sync protocol as an alternative to the traditional /sync endpoint. Sliding sync provides more efficient synchronization, better performance for large accounts, and fine-grained control over data loading.
Configuration
To enable sliding sync, update your config.json:
{
"slidingSync": {
"enabled": true,
"proxyUrl": "https://your-sliding-sync-proxy.example.com",
"defaultLists": {
"allRooms": {
"ranges": [[0, 49]],
"sort": ["by_recency", "by_name"],
"timeline_limit": 1,
"required_state": [
["m.room.name", ""],
["m.room.avatar", ""],
["m.room.canonical_alias", ""],
["m.room.topic", ""],
["m.room.encryption", ""],
["m.room.member", "$ME"]
]
},
"directMessages": {
"ranges": [[0, 49]],
"sort": ["by_recency"],
"timeline_limit": 1,
"filters": {
"is_dm": true
},
"required_state": [
["m.room.name", ""],
["m.room.avatar", ""],
["m.room.member", "$ME"]
]
}
}
}
}
Configuration Options
enabled: Boolean to enable/disable sliding syncproxyUrl: URL of your sliding sync proxy serverdefaultLists: Configuration for different room listsranges: Array of [start, end] ranges for room paginationsort: Array of sort methods (by_recency,by_name)timeline_limit: Number of timeline events to fetch per roomrequired_state: State events to include in room datafilters: Filters to apply to the list (e.g.,is_dmfor direct messages)
Technical Implementation
Architecture
SlidingSync → Event Handlers → Jotai Atoms → Bridge → Existing Room List Atoms → UI Components
Key Components
-
Client Initialization (
src/client/initMatrix.ts)- Conditionally creates SlidingSync instance based on config
- Falls back to traditional sync if sliding sync is disabled
-
State Management (
src/app/state/sliding-sync/)slidingSync.ts: Core atoms for sliding sync stateuseSlidingSync.ts: Hooks for binding sliding sync events to atomsroomListBridge.ts: Bridge between sliding sync data and existing room list atoms
-
Integration (
src/app/state/hooks/useBindAtoms.ts)- Conditionally binds either sliding sync or traditional sync atoms
- Maintains compatibility with existing UI components
State Atoms
slidingSyncAtom: Stores the SlidingSync instanceslidingSyncStateAtom: Current sync state (PREPARED, SYNCING, STOPPED, ERROR)slidingSyncEnabledAtom: Boolean indicating if sliding sync is activeslidingSyncRoomListAtom: Room lists from sliding syncslidingSyncRoomDataAtom: Room metadata from sliding syncslidingSyncErrorAtom: Error state
Usage
Enabling Sliding Sync
- Configuration: Edit
config.jsonto enable sliding sync and set proxy URL - Restart: Restart the Cinny application for changes to take effect
- Verification: Check the settings UI to verify sliding sync is active
Settings Interface
Cinny provides a comprehensive settings interface for sliding sync:
- General Settings: View sliding sync status in Settings → General → Synchronization
- Dedicated Page: Access detailed configuration in Settings → Sliding Sync
- Status Indicator: Real-time sync status displayed in the top bar
- URL Validation: Built-in validation for proxy URLs with helpful error messages
Settings Features
- Status Monitoring: Real-time status display (Active, Syncing, Error, etc.)
- Configuration View: Display current proxy URL and enabled status
- URL Examples: Pre-configured examples of common sliding sync proxies
- Error Reporting: Detailed error messages when sliding sync fails
- Validation: URL format validation with security requirements (HTTPS)
When sliding sync is enabled:
- The client will use sliding sync instead of traditional
/sync - Room lists are populated via sliding sync events
- Existing UI components continue to work via the bridge layer
- Fallback to traditional sync occurs if sliding sync fails or is disabled
- Status indicators show real-time sync state
Requirements
- Matrix JS SDK v37.5.0+
- Sliding sync proxy server
- Compatible homeserver (Matrix 1.4+)
Benefits
- Performance: Faster sync for large accounts
- Efficiency: Only loads visible rooms and timelines
- Scalability: Better handling of large room lists
- Flexibility: Fine-grained control over data loading
Backward Compatibility
The implementation maintains full backward compatibility:
- Traditional sync works when sliding sync is disabled
- All existing UI components function without changes
- Progressive enhancement approach