Commit Graph
40 Commits
Author SHA1 Message Date
BordedDev c53e2062fa refactor: replace chained boolean condition with all() for readability in PushView
Refactor the subscription body validation in `src/snek/view/push.py` to use `all()` with a list comprehension instead of a multi-line `and` chain, improving code clarity. Also normalize string quotes from single to double for `body["endpoint"]` and reformat the `requests.post` call to span multiple lines for consistency with project style.
2025-04-19 19:33:31 +00:00
BordedDev a15c44b1b1 refactor: rename create_encrypted_payload to create_notification_info_with_payload in notification and push modules 2025-04-13 21:20:30 +00:00
BordedDev 69dabea653 feat: refactor push notification encryption to return headers and data dict
Refactor `create_encrypted_payload` to accept endpoint parameter and return a dictionary containing pre-built HTTP headers and encrypted payload data, eliminating manual header construction in the PushView caller. Remove unused `public_key_base64` certificate retrieval and inline header generation logic.
2025-04-13 21:14:01 +00:00
BordedDev 697935c9de feat: refactor push notification service worker and key management with async registration
Replace commented-out push handler with a full async `registerServiceWorker` function that fetches the VAPID public key, subscribes the push manager, and POSTs the subscription object to `/push.json`. Remove unused helper functions (`arrayBufferToBase64`, `requestNotificationPermission`, `subscribeUser`) and top-level fetch calls. Convert notification key file paths from string constants to `pathlib.Path` objects, replacing `os.path.isfile` checks with `.exists()` and `open`/`write` calls with `.read_bytes()`/`.write_bytes()`. Update the notification test payload to use relative icon and URL paths. Fix the app.html onclick handler to call the renamed `registerNotificationsServiceWorker()` function.
2025-04-13 01:19:28 +00:00
BordedDev 3595e40851 feat: add notification body and icon support to push subscription handling
- Extend service-worker push event to parse and display notification body, icon, and title from push data payload
- Add AESGCM and HKDF imports to notification module for future encryption support
- Refactor notification key file path constants to use double quotes for consistency
- Update push view to include notification body in subscription response and validate request fields
2025-04-12 12:25:57 +00:00
BordedDev 46b4630c9a feat: add notification button and fix push subscription encoding for chrome
- Export registerServiceWorker function in push.js and add debug logging for key data
- Add notificationclose event listener and fetch cache-first strategy in service-worker.js
- Add notification button to app.html template calling registerServiceWorker
- Fix public key encoding from base64 to urlsafe_b64encode in push.py for chrome compatibility
2025-04-06 22:36:49 +00:00
BordedDev 95643d717e feat: add push notification infrastructure with VAPID key generation and service worker registration
Introduce initial push notification support by adding a new `notification.py` module for VAPID key pair generation (EC P-256), a `PushView` endpoint serving the public key, and a `push.js` client that fetches the key and subscribes the service worker with `userVisibleOnly` flag. The service worker push listener is refactored to check notification permission and handle click events. The `app.html` template now includes the push script as a module, and the application startup calls `get_notifications()` to ensure keys exist. Note: FCM-based push on Chrome/Opera remains non-functional due to unresolved compatibility issues.
2025-03-17 02:16:39 +00:00
BordedDev 3ed67d3dfe chore: remove unused asyncio and aiohttp imports from template.py
Clean up the import block in src/snek/system/template.py by removing
the unused `asyncio` and `aiohttp` modules, and reordering remaining
imports to follow standard grouping conventions (stdlib, third-party,
local).
2025-05-30 00:14:45 +00:00
BordedDev 8e3956af9f feat: add URL embedding with metadata extraction and responsive CSS styling 2025-05-30 00:13:36 +00:00
BordedDev 5d22454230 feat: restructure layout to CSS grid with named areas and add interactive-widget viewport meta
Replace flexbox body layout with a CSS grid using named template areas (header, sidebar, chat-area) to improve mobile responsiveness and sidebar positioning. Update viewport meta tag to include `interactive-widget=resizes-content` for better mobile keyboard handling. Add `html { height: 100% }` and `.chat-messages { display: flex; flex-direction: column }` to support proper vertical sizing. Move `<main>` element after sidebar block in app.html template to match new grid structure. Change umami analytics script from `defer` to `async defer` in base.html.
2025-05-26 22:23:41 +00:00
BordedDev 0df2d595e5 fix: inline replaceMentionsWithAuthors call in updateMessageText handler 2025-05-25 00:46:49 +00:00
BordedDev fd859ac552 fix: prevent duplicate message send on live typing submit by clearing input before send
The fix reorders operations in the submit handler to clear the input field value before calling `sendMessage`, and moves the `messageUid` assignment into the live-typing path only, eliminating the double-send that occurred when both the submit handler and the live-typing timer triggered message transmission.
2025-05-25 00:23:52 +00:00
BordedDev f96a179861 fix: replace last-child selector with :not(:has(+ .message)) for accurate last message time display 2025-05-24 16:41:12 +00:00
BordedDev bbaa458a62 fix: correct string slicing to strip trailing 's' from each start time element instead of the entire list 2025-05-22 06:10:39 +00:00
BordedDev 530f9ab27c feat: show reply time indicator when message gap exceeds 20 minutes
Add logic to detect time gaps between consecutive messages from the same user. When the difference between two messages' timestamps exceeds 20 minutes, the later message receives a `long-time` CSS class, causing its timestamp to be displayed persistently alongside the existing `switch-user` rule. The CSS selector `.message:has(+ .message.long-time)` ensures the preceding message's time remains visible when followed by a long-delayed reply.
2025-05-21 22:19:39 +00:00
BordedDev bf32ab8d47 fix: set opacity to 1 for last message's time display in chat CSS 2025-05-21 22:00:51 +00:00
BordedDev 3279f3f861 feat: hide avatar via max-height and fade time on non-hover messages
Add max-height:0 with overflow:hidden to .avatar in collapsed state, and set
max-height:unset on hover to prevent layout shift. Replace .time display:none
with conditional opacity:0 when message is not hovered, focused, or active,
keeping .author display:none unchanged.
2025-05-21 20:30:15 +00:00
BordedDev c9b9a1d7ea fix: preserve gif quality and animation frames in channel attachment resizing 2025-05-18 12:51:38 +00:00
BordedDev c0c9b942a0 fix: restore webp fallback in picture template and add file existence check in attachment view 2025-05-17 11:55:46 +00:00
BordedDev e450716508 fix: re-add webp format parameter to image src for fallback support
- Append `&format=webp` to the image source URL in `enrich_image_rendering` function
- Restore webp format query parameter that was previously removed, enabling browser fallback to webp when supported
2025-05-17 11:29:25 +00:00
BordedDev db776b4a6a fix: rewrite YouTube embed parsing with urlparse and handle missing channel attachments
- Replace fragile string splitting with urlparse/parse_qs for robust YouTube URL parsing
- Support youtu.be, youtube-nocookie.com, and /embed paths alongside /watch
- Properly extract start time (t=) parameter and append to embed src
- Add early 404 return in ChannelAttachmentView when channel_attachment is None
- Set Content-Type header from original format in attachment download response
2025-05-17 11:23:32 +00:00
BordedDev 414cce6c71 feat: add image conversion and resizing via query params in channel attachment view 2025-05-11 23:47:54 +00:00
BordedDev 4164fbd877 feat: add paste and file drop support to web input handler
Implement clipboard paste event listener in initInputField that reads image files from clipboard and triggers upload via the upload-button component. Add drag-and-drop file drop support to the textarea input field for improved user experience.
2025-05-06 21:14:52 +00:00
BordedDev 5293d483c4 fix: replace manifest icon paths with correctly sized 192 and 512 png assets
The manifest.json previously referenced a single icon file (snek1.png) for both 192x192 and 512x512 sizes, causing browser instability warnings due to mismatched dimensions. This commit adds properly sized snek192.png and snek512.png images and updates the manifest to point each icon entry to its corresponding size-specific asset, resolving the Firefox Android manifest validation issue.
2025-04-06 21:47:18 +00:00
BordedDev 3188b180df fix: revert multi-line formatting of umami script tag in base.html 2025-03-17 21:06:52 +00:00
BordedDev bf8ca3c69b feat: add Promise.withResolvers polyfill and include it in app and base templates
The polyfill provides a static method on Promise that returns an object with resolve and reject functions exposed, enabling external resolution of a promise. It is loaded as a module script in both app.html and base.html to ensure compatibility before app.js runs.
2025-03-17 21:05:46 +00:00
BordedDev 24ce2ceb83 style: normalize import spacing and object literal formatting in app.js 2025-03-16 04:03:05 +00:00
BordedDev 4e9c8c55bb refactor: extract EventHandler and Socket classes into separate modules from app.js 2025-03-16 03:55:01 +00:00
BordedDev e12d3b7c5d feat: convert JavaScript classes to ES modules with export/import across app and templates
Convert all JavaScript classes in app.js and schedule.js from implicit globals to ES module exports, add import statements in template scripts for the app instance, and mark all script tags with type="module" to enable module scoping. Also fix a potential null reference in web.html by using optional chaining on lastMessage.scrollIntoView and hoist the lastMessage variable to outer scope for proper closure behavior.
2025-03-15 18:10:52 +00:00
BordedDev 22d13d4385 feat: extract shared input focus styles into shared.css and import on all pages
Create a new shared.css file containing consistent focus ring and placeholder opacity transition rules for input and textarea elements. Import shared.css into both base.css and style.css to apply the updated input styling across all pages, replacing previously scattered or missing focus indicators.
2025-03-15 14:53:24 +00:00
BordedDev 7f9273d9dc fix: add missing semicolon to loadForm call in GenericForm URL handler 2025-03-08 20:18:20 +00:00
BordedDev ef8ee90276 feat: preload form structure into login and register templates and autofocus first input
Add `preloaded-structure` attribute to `<generic-form>` elements in both login and register templates, passing the serialized form JSON from the server. This enables instant form rendering without an additional fetch. Also implement autofocus logic in `generic-form.js` to focus the first input field on page load, improving UX for authentication flows.
2025-03-08 20:04:32 +00:00
BordedDev a504af4c6f style: revert indentation from 4-space to 2-space in base.css across all selectors 2025-03-08 18:35:22 +00:00
BordedDev f36b94e46b feat: wrap back button and form in grid container with new back-form.css stylesheet
Add a new CSS file `back-form.css` defining a two-column grid layout for the back button and generic form, with the button positioned at (1,1) with 30px margins and z-index 1. Update both `login.html` and `register.html` to include the stylesheet in the head block and wrap the existing `fancy-button` and `generic-form` elements in a `div.back-form` container, replacing the previous standalone button placement.
2025-03-08 18:07:09 +00:00
BordedDev 852d949d7f feat: add head block placeholder to base template for child template injection
Insert an empty Jinja2 block named 'head' inside the <head> element of base.html, enabling child templates to inject custom meta tags, styles, or scripts before the closing head tag.
2025-03-08 17:59:00 +00:00
BordedDev ba39d16635 style: add focus outline and placeholder opacity transition to form input fields 2025-03-08 17:56:55 +00:00
BordedDev 8855e40d6d feat: add theme-color, application-name, and author meta tags to base.html head
Add six new meta elements to the HTML head in base.html: theme-color set to black,
application-name and description both set to "Snek chat by Molodetz", author set to
"Molodetz", keywords including "snek, chat, molodetz", and color-scheme set to dark.
Also insert a blank line after the title block for improved readability.
2025-03-08 17:25:15 +00:00
BordedDev 64fe00b161 fix: dispatch change event on blur to sync autocomplete with form state 2025-03-08 17:09:14 +00:00
BordedDev 9c844d9f30 feat: add default page title and specific titles for login and register templates
Set a default "Snek chat by Molodetz" title in base.html and override it with
"Login - Snek chat by Molodetz" and "Register - Snek chat by Molodetz" in their
respective templates, improving user-facing page identification.
2025-03-08 17:04:53 +00:00
BordedDev 4b59f8b780 fix: correct border-radius on follow-up messages to prevent sharp corners 2025-03-08 16:25:56 +00:00