Commit Graph
100 Commits
Author SHA1 Message Date
retoor 304ddc021d chore: bump version to 1.35.0 and auto-assign admin role to first registered user
Update pyproject.toml version from 1.34.0 to 1.35.0 and add logic in UserService.create to set is_admin flag when no users exist yet, ensuring the first registered user gains administrative privileges automatically.
2026-01-31 16:06:30 +00:00
retoor 73a49acd5a feat: add comprehensive admin panel with user, channel, message, and system management views
Implement full admin interface including dashboard stats, user management (edit/ban), channel management (edit/clear/delete members), message/forum/thread/post browsing, file and drive management, notification creation, system KV store, and push notification views. Add AdminService with permission checks and dashboard statistics aggregation. Include admin.css with dark theme styling and extend base.css for profile page layout fixes. Register all admin routes and service in application bootstrap.
2026-01-31 15:54:47 +00:00
retoor fbf67f2b60 refactor: split monolithic rpc.py into modular action handler classes for auth, channels, containers, databases, mentions, messages, and misc 2026-01-24 08:10:46 +00:00
retoor 95193dfe35 feat: add mention functionality with backend models, services, and frontend navigation components 2026-01-24 07:32:30 +00:00
retoor 662b7d30f1 perf: reduce channel message processing max workers from 30 to 1
Lower the ThreadPoolExecutor max_workers parameter in ChannelMessageService from 30 to 1 to limit concurrency and improve performance under resource-constrained conditions. Bump project version from 1.30.0 to 1.31.0 and update CHANGELOG.md to document the change.
2026-01-24 06:24:42 +00:00
retoor e5ea9b626d perf: increase channel message worker pool max_workers from 10 to 30 in ChannelMessageService
Bump project version from 1.29.0 to 1.30.0 and update CHANGELOG to document the performance improvement. The change modifies the `_max_workers` attribute in `src/snek/service/channel_message.py` to allow up to 30 concurrent workers for processing channel messages, improving throughput under high load.
2026-01-17 20:32:02 +00:00
retoor f726ef652a chore: bump version to 1.29.0 and add full site.css with dark sidebar layout and button restyling in index.html 2026-01-17 20:25:19 +00:00
retoor ad58daa412 feat: add architecture, design, api, bots, and contribute doc pages with nav updates and worker increase
Add five new documentation hub pages (architecture, design, api, bots, contribute) with dedicated views and routes in the application router. Increase channel message service max workers from 1 to 10 for improved throughput. Update navigation links in about and index templates to include the new doc pages and the docs hub. Bump project version to 1.28.0.
2026-01-17 20:13:52 +00:00
retoor 5a4b0ed8e0 chore: bump project version to 1.27.0 and reduce starfield particle count from 300 to 200 in sandbox template 2026-01-16 04:24:38 +00:00
retoor bef9ecbe4e chore: bump version to 1.26.0 and double starfield particle count in sandbox template 2026-01-16 04:19:33 +00:00
retoor af415410f9 chore: bump project version to 1.25.0 and increase sandbox starfield count from 50 to 150
- Update pyproject.toml version from 1.24.0 to 1.25.0
- Modify sandbox.html StarField instantiation to use 150 stars instead of 50
- Add changelog entry for version 1.25.0 documenting the HTML file update
2026-01-16 04:06:46 +00:00
retoor fc39777663 chore: bump version to 1.24.0 and refactor mobile header CSS with !important overrides 2026-01-03 17:03:13 +00:00
retoor 257271f184 chore: rename RPC methods to snake_case and bump version to 1.23.0
Rename createChannel, inviteUser, leaveChannel, updateChannel to snake_case equivalents in src/snek/view/rpc.py; update pyproject.toml version from 1.22.0 to 1.23.0; add changelog entry for version 1.23.0
2026-01-03 14:06:47 +00:00
retoor 9ab215f977 chore: bump version to 1.22.0 and update dm channel name resolution in rpc view 2026-01-03 13:49:54 +00:00
retoor ce0e466f0f chore: bump version to 1.21.0 and fix channel name field in RPC subscription
- Update pyproject.toml version from 1.20.0 to 1.21.0
- Change channel name source from subscription["label"] to subscription["description"] in src/snek/view/rpc.py RPCView class
2026-01-03 13:32:36 +00:00
retoor 1635eca7d3 chore: bump version to 1.20.0 and fix header/channel-menu CSS layout for mobile 2026-01-03 13:28:43 +00:00
retoor beb0f6c8ad chore: bump version to 1.19.0 and add responsive channel-menu component with CSS/JS 2026-01-03 13:24:57 +00:00
retoor d6173a01fe chore: replace inline nav links with custom nav-menu web component in app.html 2026-01-03 13:13:55 +00:00
retoor 586aac5eac chore: bump version to 1.17.0 and remove debug prints from channel upload handler 2026-01-03 13:04:12 +00:00
retoor ac645ced24 chore: bump version to 1.16.0 and reposition file upload grid with absolute positioning 2026-01-03 12:56:16 +00:00
retoor fb2470d154 chore: bump version to 1.15.0 and refactor file-upload-grid from fixed grid to flexbox layout
- Update pyproject.toml version from 1.14.0 to 1.15.0
- Add changelog entry for version 1.15.0
- Convert .fug-grid from CSS grid with 6-column fixed layout to flexbox with wrap
- Remove fixed background color on .fug-root and set max-width to 100%
- Adjust tile width to 120px with flex-shrink: 0 and reduce padding/spacing values
2026-01-03 12:52:36 +00:00
retoor 774944e957 feat: add ToolbarMenu web component with STT/TTS/upload controls and status indicators 2026-01-03 12:42:23 +00:00
retoor c520e27b70 feat: refactor chat input toolbar to use toolbar-menu component
Replace direct appending of stt, tts, and upload buttons with a centralized toolbar-menu component. This change moves button management into the new toolbar-menu element, which handles button registration via addButton calls and controls visibility during file upload states. The toolbar-menu is now shown/hidden instead of individual buttons, simplifying the chat input's DOM structure and preparing for future toolbar extensions.
2026-01-03 12:42:07 +00:00
retoor 753da13a44 feat: add _sendKeepListening method to reset transcripts on Enter without stopping recognition
When the user presses Enter while listening, the previous behavior stopped recognition entirely via _stopAndSend(). The new _sendKeepListening() method clears both final and interim transcripts while keeping the recognition session active, allowing continuous dictation across multiple Enter presses without restarting the speech-to-text engine.
2025-12-31 09:57:51 +00:00
retoor ee120c327d fix: prevent empty dots and spaces from being sent as final transcript in STTButton 2025-12-31 09:37:15 +00:00
retoor e01321b631 fix: hardcode speech recognition and TTS voice selection to English only 2025-12-31 09:32:49 +00:00
retoor 817b1d2b66 feat: replace snek-speaker with tts-button and fix multiline string bugs in editor and push
- Remove snek-speaker element from chat-input.js and replace with tts-button
- Rewrite tts.js from a simple SnekSpeaker class to a full TTSButton custom element with voice selection, styling, and speech synthesis integration
- Fix goToLine in editor.js to use literal \n instead of broken template literal split
- Fix push.js alert string to include proper newline separator instead of broken concatenation
- Update web.html template to remove snek-speaker speak logic and always play message sound
2025-12-31 09:31:07 +00:00
retoor 0a39f07cc2 fix: replace broken TTS button with working STT button in chat input
The previous implementation incorrectly wired a TTS button to trigger speech synthesis instead of speech-to-text. This commit removes the misconfigured `ttsButton` and `snekSpeaker` elements, replacing them with a proper `sttButton` that creates an `STTButton` custom element. The `stt.js` module is fully rewritten to implement a functional Web Speech API-based speech recognition component, including start/stop listening, interim and final transcript handling, and keyboard event simulation for inserting recognized text into the chat input field.
2025-12-31 08:59:24 +00:00
retoor f1e60eee61 feat: add asyncio lock to socket connection handling and implement proper cleanup in MessageList
Add an asyncio.Lock to SocketService to synchronize concurrent access to the users and sockets sets during connection and disconnection, preventing race conditions when multiple websocket connections are established or torn down simultaneously. In the frontend MessageList component, replace anonymous inline event listeners with named handler references stored as instance properties, and implement a disconnectedCallback lifecycle method that removes those event listeners and disconnects the MutationObserver, ensuring proper cleanup when the element is removed from the DOM.
2025-12-29 00:25:28 +00:00
retoor 19b50f3bce feat: add channel management dialogs for create, settings, delete, invite, and leave operations
Implement five new dialog interfaces (create, settings, delete, invite, leave) with corresponding CSS styling, JavaScript classes, and RPC integration. Add sidebar add-button styling, update help dialog with new slash commands, and bump version to 1.14.0.
2025-12-26 01:05:06 +00:00
retoor ae2102f081 chore: bump version to 1.13.0 and update pytest config with asyncio_mode 2025-12-24 17:03:21 +00:00
retoor 2048be900e chore: bump version to 1.12.0 and move socket lock checks inside async context managers 2025-12-20 23:25:08 +00:00
retoor eecc4ce1e8 feat: add configurable registration openness via SNEK_REGISTRATION_OPEN env var
Introduce a new Config class in snek/system/config.py that reads environment variables, including SNEK_REGISTRATION_OPEN, to control whether user registration is allowed. The Application now loads this config and passes it to templates and views. The register.html template conditionally shows either the registration form or an invitation-only message based on config.registration_open. The RegisterView returns a 403 JSON error when registration is closed. Version bumped to 1.11.0 and CHANGELOG updated accordingly.
2025-12-19 11:53:58 +00:00
retoor 71329c1262 feat: disable open registration and replace form with invitation-only message on register page 2025-12-19 11:34:02 +00:00
retoor 2308fa20ad chore: add author headers to 148 source files and bump version to 1.9.0 2025-12-18 22:48:50 +00:00
retoor d1520f1b21 chore: bump version to 1.8.0 and add changelog entry for socket robustness improvements 2025-12-18 21:04:01 +00:00
retoor b6476f3bf0 fix: ensure socket cleanup in websocket handler by wrapping async iteration in try/finally block 2025-12-17 21:54:25 +00:00
retoor df8986715d refactor: remove presence debounce and simplify websocket error handling in rpc view 2025-12-17 21:47:21 +00:00
retoor 3dce95e38c chore: remove umami analytics script tag from app.html template 2025-12-17 21:18:42 +00:00
retoor 2534b7572e chore: bump version to 1.4.0 and simplify user dict access in socket service 2025-12-17 21:09:54 +00:00
retoor c712bc58c1 feat: add debounced user presence join/depart notifications with 3-second delay in socket service 2025-12-17 20:54:07 +00:00
retoor cf6e9eec7a chore: remove umami analytics script and csp connect-src from middleware and template 2025-12-17 17:34:32 +00:00
retoor d0eb7fad17 fix: replace safe dict access with direct access and add null check for starField in message-list.js 2025-12-17 17:24:08 +00:00
retoor 4b388e890d fix: replace hardcoded channel_uid with dynamic variable in broadcast and fix db_query signature 2025-12-14 23:10:50 +00:00
retoor 155c914c34 fix: correct UserPropertyModel field name and add missing db commit in service
- Fix UserPropertyModel value field name from "path" to "value" in user_property.py
- Add self.mapper.db.commit() call after upsert in UserPropertyService to persist changes
- Refactor CSS across base.css, buttons.css, inputs.css, generic-form.css, and fancy-button.js to unify dark theme with monospace font, consistent border-radius (4px), and transition effects
- Introduce new buttons.css and inputs.css stylesheets with reusable .btn, .input, .textarea, .select classes and variants (primary, secondary, danger, success, sizes)
- Update sidebar navigation styling with active state indicator and hover border-left highlight
- Revise dialog button styles to match new design system with border, background, and hover states
- Adjust generic-form and generic-field components to use new font, colors, and focus ring (box-shadow) instead of outline
2025-12-05 18:17:09 +00:00
retoor e52c7c4f76 docs: remove obsolete GIT_INTEGRATION.md guide from snek templates
The entire GIT_INTEGRATION.md file was deleted from src/snek/templates/,
removing the outdated Git integration documentation that covered repository
creation, cloning workflows, and web interface features. This file is no
longer needed as the integration details have been superseded by newer
documentation or the feature set has changed.
2025-12-05 17:16:04 +00:00
retoor b93f618d21 feat: add profile page management, default forum creation, and bcrypt dependency
Add ProfilePageMapper, ProfilePageModel, and ProfilePageService to support user profile pages with slug-based routing, ordering, and publish state. Register profile page views in the application router. Implement automatic creation of a default "General Discussion" forum on startup if no active forums exist. Add bcrypt to core dependencies and pytest with asyncio support as optional test dependencies. Refactor forum event dispatch to use inspect for robust async/sync listener handling. Extend RepositoryModel with optional description field. Update SQL schema to include IP geolocation fields on user table and history_start on channel table.
2025-12-05 17:15:36 +00:00
retoor 18cf101080 fix: remove vulnerable code and fix syntax errors in WebSocket and Dataset classes 2025-11-06 03:13:36 +00:00
retoor 4d5a7c0500 docs: expand project quality review with full codebase analysis covering all Python modules in src/snek recursively
The review now includes detailed analysis of every Python file in the project, covering Docker integration, Git support, system modules, and additional architectural patterns discovered during the comprehensive codebase examination.
2025-11-06 03:12:06 +00:00
retoor 490f820f5f docs: add comprehensive project quality review document for Snek codebase
This commit introduces a new review.md file that provides a detailed quality assessment of the Snek project, covering its modular architecture, asynchronous design, feature set, and identified weaknesses including syntax errors in serpentarium.py and sync.py, incomplete code summaries, potential security concerns with WebSocket authentication and raw SQL queries, and code quality issues.
2025-11-06 03:05:42 +00:00
retoor e737dcddb2 feat: add last_read_at tracking and jump-to-first-unread button in chat UI
Add `last_read_at` column to `channel_member` table and set it in `mark_as_read` service method. Implement `get_first_unread_message_uid` RPC endpoint that queries the first message after the member's last read timestamp. Introduce a "Jump to First Unread" button in the web template with `checkForUnreadMessages` and `jumpToUnread` JavaScript functions to show/hide the button and scroll to the unread message element.
2025-11-03 17:08:13 +00:00
retoor 71f94db41f chore: remove aiohttp_debugtoolbar import and commented setup, restyle sidebar typography and link spacing
- Remove unused `aiohttp_debugtoolbar` import and its commented-out setup call in `app.py`
- Increase sidebar top padding from 10px to 20px for better vertical rhythm
- Reduce heading font-size to 0.75em, add uppercase transform, letter-spacing, and margin-top
- Add `:first-child` rule to reset top margin on first sidebar heading
- Tighten list item spacing from 15px to 4px, reduce link font-size to 0.9em
- Add block display, padding, border-radius, and hover background transition to sidebar links
2025-10-28 19:50:53 +00:00
retoor 57d86e2620 feat: cache generated avatars in app storage to avoid redundant multiavatar calls 2025-10-02 14:28:38 +00:00
retoor bbe8022eb1 fix: enable cache by default and remove async lock from get/set methods 2025-09-30 17:54:39 +00:00
retoor c6c8ea1c30 fix: disable cache by default and remove version comment in Cache class
The cache is now disabled by default (self.enabled = False) to prevent stale data serving until explicitly enabled. Additionally, the inline comment documenting the version calculation was removed to clean up the code.
2025-09-30 17:47:17 +00:00
retoor d139731720 fix: enable cache by default and add async lock for thread safety in Cache class 2025-09-30 17:35:56 +00:00
retoor a35415f549 chore: remove obsolete prototype SSH server scripts from src/snekssh directory 2025-09-30 17:28:59 +00:00
retoor 2234147845 fix: replace dict with OrderedDict for O(1) LRU operations and disable cache by default 2025-09-30 17:27:07 +00:00
retoor 34adf19bbe feat: refactor cache to use OrderedDict with async lock for thread-safe LRU eviction
Replace the plain dict cache with an OrderedDict-based implementation that
provides O(1) LRU eviction by re-inserting accessed items at the end.
Introduce an asyncio.Lock to ensure thread-safe concurrent access during
get/set operations. Enable caching by default (self.enabled = True) and
add import for asyncio and OrderedDict.
2025-09-30 17:14:16 +00:00
retoor 497cc0b9f7 fix: wrap synchronous _execute call in asyncio.to_thread for non-blocking mapper execution 2025-09-30 15:36:22 +00:00
retoor 0a05da7067 refactor: remove unused prepare_stats startup hook and stats structure from Application class 2025-09-30 15:20:02 +00:00
retoor 05272b9a72 fix: remove deprecated stats.html route from router setup 2025-09-30 15:18:48 +00:00
retoor cd39881fd4 feat: remove deprecated stats module and its middleware from application stack
Remove the entire `snek.system.stats` module including its middleware, statistics structure creation, and websocket stats tracking. This eliminates the `stats_middleware` from the application middleware chain, removes the `update_websocket_stats` calls from the RPC view handler, and deletes the 129-line stats module with its time-series SVG generation and granularity-based counter logic.
2025-09-30 15:17:06 +00:00
retoor 98b21c1bf5 feat: add logging configuration with basicConfig at INFO level in __main__.py 2025-09-22 12:15:53 +00:00
retoor 837010302c feat: add render_template timing instrumentation and disable cache in system modules
- Add performance timing with time.perf_counter() to render_template method in Application class, printing elapsed seconds to stdout
- Disable cache by setting self.enabled = False in Cache.__init__ to bypass caching behavior
- Add early return in ChannelMessageService.maintenance() to skip message iteration loop
- Remove default_limit class attribute assignment in BaseMapper.__init__ and add time import
- Refactor run_in_executor to execute synchronously with _execute() call and wrap semaphore around a second _execute() call instead of using thread pool executor
2025-09-22 12:14:30 +00:00
retoor 6e75d38979 chore: comment out debug console logs in Chat and ChatInputComponent 2025-09-22 11:30:53 +00:00
retoor 37dccf9da2 fix: remove trailing semicolons and fix whitespace inconsistencies in chat-input.js
- Removed trailing semicolons from arrow function bodies in hiddenCompletions object
- Fixed inconsistent indentation for _leetSpeak toggle and textarea classList assignment
- Replaced spread operator with Object.assign for allAutoCompletions getter
- Truncated extractMentions regex pattern at diff boundary
2025-09-17 20:55:31 +00:00
retoor 538d92b538 fix: guard mention replacement against null closestAuthor in chat input 2025-09-17 14:30:20 +00:00
retoor e980265aeb fix: fix whitespace formatting and trailing commas in chat-input.js 2025-09-17 14:27:04 +00:00
retoor 2f74ae9e74 fix: set closestAuthor to 0 when minDistance drops below 5 in chat input mention detection 2025-09-17 14:20:59 +00:00
retoor a16ccd82fe feat: add new chat view with WebSocket-based messaging component
Introduce a new `NewView` class in `src/snek/view/new.py` that renders the `new.html` template, requiring authentication. The template includes a custom `ChatWindow` web component that establishes a WebSocket connection via the `Socket` class, handles channel-based messaging with real-time updates, and supports sending messages on Enter key press while allowing Shift+Enter for multi-line input.
2025-09-17 14:12:05 +00:00
retoor dc1b36e68e feat: add NewView route and fix leet check and push notification handling
- Register NewView at /new.html endpoint in Application router
- Fix textToLeetAdvanced to require s.length > 1 for valid leet match
- Comment out event.waitUntil(reg) in service-worker push handler to prevent potential hang
2025-09-17 14:09:48 +00:00
retoor 4a51c2d386 fix: add console.info logging and increase reconnect delay to 4 seconds in socket.js
- Added console.info call to log event name and data payload in the data handler
- Changed reconnect timeout from 0ms to 4000ms to introduce deliberate delay before reconnection attempt
2025-09-16 02:46:44 +00:00
retoor 51ed3b2fd2 fix: reduce default ProcessPoolExecutor max_workers from 3 to 1 in ChannelMessageService init 2025-09-15 03:00:11 +00:00
retoor 301c55cfdd fix: add debug logging for closest author and min distance in chat input component 2025-09-15 00:22:03 +00:00
retoor 0104f5ef85 fix: increase default max_workers to 3 and use instance variable for executor pool size 2025-09-15 00:12:52 +00:00
retoor fe57aab360 fix: increase ProcessPoolExecutor max_workers from 1 to 10 in channel message service 2025-09-15 00:09:04 +00:00
retoor c5ea835dff fix: reduce default ProcessPoolExecutor workers to 1 and add debug logging
The change reduces the default `max_workers` for `ProcessPoolExecutor` from 5 to 1 in the `get_or_executor` method of `ChannelMessageService`, and adds a debug print statement to log the number of available executors.
2025-09-14 22:58:29 +00:00
retoor b6ada2c753 chore: add duplicate defer attribute to umami analytics script tag in app.html 2025-09-14 20:53:05 +00:00
retoor 5cd88ccb9b fix: prevent premature removal of non-final messages in upsertMessage
The change modifies the conditional logic in `MessageList.upsertMessage()` to only remove and nullify an existing message when `data.message` is falsy, instead of doing so when `data.is_final` is true or `data.message` is falsy. This ensures that non-final messages with content are not incorrectly removed from the DOM before being updated or re-inserted.
2025-09-09 21:40:33 +00:00
retoor 8b15e08014 feat: replace ThreadPoolExecutor with ProcessPoolExecutor and add Jinja2 template rendering for channel messages 2025-09-08 04:08:12 +00:00
retoor 7a0f58451a fix: reduce per-user executor pool max_workers from 5 to 1 in ChannelMessageService
The change limits concurrent thread execution per user to a single worker,
preventing resource exhaustion from unbounded thread creation in the
get_or_create_executor method.
2025-09-07 23:09:22 +00:00
retoor 088dbbf3da feat: replace global thread pool with per-user executor pools in ChannelMessageService
Remove the module-level `executor` variable and introduce instance-level `_executor_pools` dict with `get_or_create_executor` method that creates a `ThreadPoolExecutor(max_workers=5)` per user UID. Update all `run_in_executor` calls in `render_message` and `render_message_edit` to use the per-user executor instead of the shared global one, improving isolation and resource control across concurrent user requests.
2025-09-07 22:59:11 +00:00
retoor 8d4511a2bf fix: prevent avatar anchor from being overwritten by later matches in message-list.js
The loop iterating over avatar elements now only assigns the first matching anchor to `lastElement`, ensuring the scroll target remains the earliest occurrence instead of being overwritten by subsequent matches.
2025-09-07 00:42:47 +00:00
retoor 77d7186c86 fix: add debug print before socket deletion in RPCView error handlers
Add a debug print statement in the `send` method's exception handler to log the exception message before deleting the socket, and update the existing debug print in the message processing loop to include a distinctive prefix for easier log filtering.
2025-08-31 01:41:41 +00:00
retoor 86b0ae6db4 fix: correct indentation of user_availability_service method in socket.py
The method definition was incorrectly placed at module level instead of being properly indented as a member of the SocketService class. This fix moves the async def user_availability_service declaration one level deeper to align with the class body, restoring correct Python scoping and preventing AttributeError or runtime import failures when the service attempts to register or invoke this method.
2025-08-31 01:27:47 +00:00
retoor 7984feeb6d chore: add debug logging to user availability service loop
Add detailed debug-level log statements throughout the
user_availability_service method to trace execution flow, including
entry into the main loop, socket iteration, connection status checks,
user update decisions, database save operations, and sleep intervals.
2025-08-31 01:25:26 +00:00
retoor 50e800e5f2 fix: offload Jinja2 template rendering and sanitization to thread pool executor to avoid blocking async event loop 2025-08-31 01:22:00 +00:00
retoor f8670d8a38 feat: implement modal editor with vim-like modes and command-line interface
Replace the basic contenteditable editor with a full modal editor supporting insert, normal, and visual modes. Add a command-line interface at the bottom for executing commands like :w, :q, and :wq. Introduce mode-specific cursor styling, selection highlighting, and keyboard-driven navigation. The editor now tracks mode state, handles mode transitions via Escape and i/v keys, and displays the current mode in a status bar.
2025-08-06 13:33:13 +00:00
retoor c9673b7744 fix: copy user socket list before iteration to avoid mutation during send 2025-08-06 12:18:01 +00:00
retoor 791ef0bc13 feat: add sentry-sdk dependency and initialize sentry in main function
- Added sentry-sdk to project dependencies in pyproject.toml
- Imported and initialized sentry_sdk with DSN in main() function
- Added graceful fallback with print message if sentry_sdk import fails
2025-08-06 09:51:58 +00:00
retoor 448034e03e feat: disable login requirement for ChannelAttachmentView to allow public access to attachments 2025-08-03 01:31:08 +00:00
retoor 01a14370c9 fix: remove random sleep before rpc call in websocket message handler 2025-08-01 00:06:20 +00:00
retoor dbc34cebb1 fix: reduce randomized sleep range in websocket RPC handler from 0.1-0.4s to 0.01-0.1s 2025-07-31 23:59:23 +00:00
retoor b760fdd22b fix: add random sleep before RPC message processing in websocket handler
- Imported `random` module to support randomized delay
- Inserted `await asyncio.sleep(random.uniform(0.1, 0.4))` before `await rpc(msg.json())` in the websocket message loop
- This introduces a jitter of 100-400ms to desynchronize concurrent RPC processing from multiple clients
2025-07-31 23:57:18 +00:00
retoor 2cc616c8aa fix: move endOfMessages.after call before scroll check in MessageList
The `endOfMessages.after(message)` call was placed after the `isScrolledToBottom()` check, causing the scroll position to be evaluated before the new message was inserted into the DOM. This resulted in incorrect scroll behavior when messages were added, as the scroll check would not account for the newly inserted element. Moving the insertion before the scroll check ensures the scroll position is evaluated after the DOM has been updated with the new message.
2025-07-30 12:49:16 +00:00
retoor 32ed12f3db fix: correct missing closing parenthesis in upsertMessage condition check 2025-07-30 12:46:10 +00:00
retoor 1f89849c9a fix: correct conditional grouping in upsertMessage to remove stale messages
The diff shows a fix in the `upsertMessage` method of the `MessageList` class in `src/snek/static/message-list.js`. The original condition `(message && data.is_final) || !data.message` was incorrectly grouping the logical OR, causing messages to be removed only when `data.is_final` was true alongside a message, or when `data.message` was falsy regardless of message existence. The fix wraps the entire condition in parentheses: `(message && (data.is_final || !data.message))`, ensuring that a message is removed only if it exists AND either `data.is_final` is true or `data.message` is falsy. A comment `// TO force insert` was added to clarify the intent of nullifying the message reference after removal.
2025-07-30 12:44:25 +00:00
retoor 77802883fe fix: skip upsert for empty messages and clear stale entries in MessageList 2025-07-30 12:41:23 +00:00
retoor aa3d00243f fix: remove stale message from DOM only when is_final flag is set
Previously, the upsertMessage method removed any existing message element from the DOM whenever a message with the same uid was received, regardless of whether the update represented a final version. This caused premature removal of messages that were still being streamed or updated incrementally. Now the removal is gated on the `data.is_final` property, ensuring that only completed messages are replaced in the DOM while in-progress messages remain visible until their final state arrives.
2025-07-30 12:36:56 +00:00