Conversation
- Remove blanket preventDefault() that blocked all paste operations - Allow normal paste for non-URL content and invalid URLs - Maintain auto-detection features for valid stream URLs - Add missing extractStreamInfo dependency
- Update URL validation to accept rtsp:// and rtsps:// protocols - Add RTSP stream type detection in detectStreamType() - Fix error messages to properly handle RTSP URLs - Update onChange handler to process RTSP URLs correctly Fixes issue where RTSP URLs were incorrectly marked as invalid in the Add Stream dialog.
- Add fitMode property to Stream interface ('contain' | 'cover')
- Add toggle button in StreamCard to switch between fit modes
- Implement scaling using CSS transforms for iframes and container scaling
- Button appears next to Stop button when stream is playing
- Persist fit mode preference per stream across sessions
- Include fit mode in import/export functionality
- Update ESLint config to disable prop-types for TypeScript
- Bump version to 1.2.3
Contributor
Reviewer's GuideIntroduces a per-stream fitMode state and toggle in StreamCard—hooking into the store to persist ‘contain’/‘cover’ modes and applying corresponding object-fit and scaling styles—while extending types and preload APIs for RTSP, adjusting CSP headers in main and renderer to support blob/media sources, refactoring AddStreamDialog’s paste handler for cleaner URL handling, updating documentation and package metadata for RTSP support, and refining build and lint configurations for code splitting and rule overrides. Sequence diagram for toggling video scaling mode in StreamCardsequenceDiagram
actor User
participant StreamCard
participant Store
User->>StreamCard: Clicks fit/fill toggle button
StreamCard->>Store: updateStream(stream.id, { fitMode })
Store-->>StreamCard: Updates stream state
StreamCard-->>User: Rerenders video with new scaling mode
Class diagram for updated Stream type and StreamCard componentclassDiagram
class Stream {
+id: string
+name: string
+streamUrl: string
+logoUrl: string
+chatId?: string
+isLivestream?: boolean
+fitMode?: "contain" | "cover"
}
class StreamCard {
+handleToggleFitMode()
+currentFitMode
+updateStream()
+render()
}
StreamCard --> Stream: uses
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/renderer/src/components/AddStreamDialog.tsx:204` </location>
<code_context>
+ const target = e.target as HTMLInputElement
+ const targetId = target.id
+
+ // For logo URL field
+ if (targetId === 'logo-url') {
+ // Don't prevent default - let the paste happen normally
+ // Then check if it's a valid image URL after a short delay
+ setTimeout(() => {
+ if (isValidImageUrl(pastedText)) {
+ trySetLogoPreview(pastedText)
+ }
+ }, 0)
+ }
+ // For stream URL field
</code_context>
<issue_to_address>
Using setTimeout for logo URL validation may introduce race conditions.
Using setTimeout here may not reliably validate the pasted value if the input changes quickly or other async events interfere. Consider validating on the input event or another method that ensures the correct value is checked.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
// For logo URL field
if (targetId === 'logo-url') {
// Don't prevent default - let the paste happen normally
// Then check if it's a valid image URL after a short delay
setTimeout(() => {
if (isValidImageUrl(pastedText)) {
trySetLogoPreview(pastedText)
}
}, 0)
}
=======
// For logo URL field
if (targetId === 'logo-url') {
// Don't prevent default - let the paste happen normally
// Validate the pasted value on the next input event
const handleLogoUrlInput = (event: Event) => {
const input = event.target as HTMLInputElement;
const value = input.value;
if (isValidImageUrl(value)) {
trySetLogoPreview(value);
}
input.removeEventListener('input', handleLogoUrlInput);
};
target.addEventListener('input', handleLogoUrlInput);
}
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
…on completes - Validating the actual input field value instead of relying on clipboard text - Automatically removing the event listener after use to prevent memory leaks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new feature to StreamGrid that allows users to toggle between different video scaling modes for each stream individually.
New Features
Stream Video Scaling Toggle
Technical Changes
Type Updates
fitMode?: 'contain' | 'cover'property to the Stream interfaceComponent Updates
StreamCard.tsx
handleToggleFitModefunction to switch between modesStyling
User Experience
Testing
Tested with various stream types and aspect ratios:
Version
Summary by Sourcery
Add per-stream video scaling toggle and RTSP streaming support, improve stream paste UX, update security policy and build configuration.
New Features:
Enhancements:
Build:
Documentation:
Chores: