-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clipboard): fix copy to clipboard functionality #878
Merged
Conversation
This file contains 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
Added a `copyTextToClipboard` function to handle text copying across different browsers and fallback scenarios. This function utilizes the Clipboard API when available, providing an asynchronous method to copy text securely. For browsers where the Clipboard API is not available or the page is not served over a secure context, a fallback method using a temporary textarea element and `document.execCommand` is employed. Replaced direct use of `navigator.clipboard.writeText` with this function in the 'shareget' click event listener to enhance cross-browser support and error handling.
reason? |
What browsers has problems with one line clipboard function? |
Safari on non-https pages and Firefox In fact, in an unsafe environment, only Chrome allows this feature 🗑️ |
AlexxIT
approved these changes
Apr 29, 2024
Thanks! |
AlexxIT
added a commit
to dadav/go2rtc
that referenced
this pull request
Apr 29, 2024
dnjooiopa
added a commit
to HYBIOT/go2rtc
that referenced
this pull request
Apr 30, 2024
* Adds automatic extention of nest stream before it expires. * Updated README with more accurate information regarding nest integration. * Added support to stream backchannel to a command (outputbc) * Code Cleanup, rename outputbc to execbc, using buffered Writer * execbc-source: Merged the dial function to the Client creation * execbc: increased Buffer Size for IO Operation * execbc: Removed Buffered IO since it caused delay in the audio output * fix(log-display): reverse log order to display newest first The The applyLogStyling function in log.html has been updated to reverse the array of log lines. After parsing the JSON data, reversing the array ensures that the most recent logs appear at the top of the list. This change enhances the readability for users by displaying the logs in a descending chronological order. * fix(clipboard): fix copy to clipboard functionality Added a `copyTextToClipboard` function to handle text copying across different browsers and fallback scenarios. This function utilizes the Clipboard API when available, providing an asynchronous method to copy text securely. For browsers where the Clipboard API is not available or the page is not served over a secure context, a fallback method using a temporary textarea element and `document.execCommand` is employed. Replaced direct use of `navigator.clipboard.writeText` with this function in the 'shareget' click event listener to enhance cross-browser support and error handling. * feat: Add signal related params to exec * Update build.yml * Added FreeBSD Binaries (#2) Co-authored-by: Rob van Oostenrijk <[email protected]> * Updated FreeBSD ffmpeg integrations * Initial commit * fix grammar Co-authored-by: Felipe Santos <[email protected]> * pkg/hap/camera/accessory.go * Fix crash with tapo cameras not returning 201 * feat(app): support daemon mode on non-Windows platforms Added a new command-line flag `-daemon` to run the application in the background as a daemon. This option is only available for non-Windows operating systems due to platform-specific process handling. When enabled, the application restarts itself with the same arguments except for the `-daemon` flag, prints the PID of the background process, and then exits the current process. * fix(daemon-mode): handle '-daemon' argument correctly for background execution This commit fixes the issue where the '-daemon' argument was not being properly handled when re-executing the program in daemon mode. The loop removes the '-daemon' flag from the arguments slice before the program is re-run in the background, ensuring that subsequent executions do not attempt to enter daemon mode again. The change will prevent potential errors or unexpected behavior due to the presence of the '-daemon' argument in recursive calls, making the daemon mode feature more robust and reliable. * ci: upgrade GitHub Actions to newer versions Updated various GitHub Actions used in the CI workflows (build.yml, gh-pages.yml, test.yml) to their latest major versions. This includes actions for checking out code, setting up Go, uploading artifacts, configuring Docker, and deploying to GitHub Pages. The update is part of routine maintenance to ensure compatibility with the latest features and improvements provided by these actions. * Modified func Close in pkg/isapi/client.go to call '/ISAPI/System/TwoWayAudio/channels/<channel id>/close' instead of '/ISAPI/System/TwoWayAudio/channels/<channel id/close/open' Modified pkg/isapi/client.go to call 'close' before 'open' to prevent channel left open from prior connection blocking with 401 or 403 errors. * Modified func Close in pkg/isapi/client.go to call '/ISAPI/System/TwoWayAudio/channels/<channel id>/close' instead of '/ISAPI/System/TwoWayAudio/channels/<channel id/close/open' Modified pkg/isapi/client.go to call 'close' before 'open' to prevent channel left open from prior connection blocking with 401 or 403 errors. * fix(streams): handle non-string elements in slice source for NewStream * Update README.md fix: Typo in url * feat(log): introduce toggle for reversing log order Added a button to the log page allowing users to toggle the order in which logs are displayed (normal or reversed). This feature enhances user experience by providing flexibility in viewing logs. The implementation involves a boolean flag `reverseOrder` to track the current state of log order and dynamically updates the button text to reflect the current mode. Additionally, the log fetching function now conditionally reverses the log array based on this flag, ensuring that the display order matches the user's preference. This change could significantly improve usability for users needing to analyze recent events without scrolling through the entire log history. * some fixes * feat(dark-mode): implement dark mode and centralize CSS Implemented a dark mode feature for the website, including a toggle button in the navigation bar that allows users to switch between light and dark themes. To support this feature, centralized common CSS styles (such as body, table, and button stylings) into main.js to ensure consistent application across all HTML pages. This change improves user experience by providing a visually comfortable alternative for low-light environments and centralizes styling rules for easier maintenance. - Added dark mode styles for body, table, buttons, and navigation elements in main.js. - Introduced a toggle mechanism in the navigation bar to switch between light and dark modes. - Utilized JavaScript to detect system theme preference (`prefers-color-scheme`) and persist user's theme choice using localStorage. - Removed duplicate and scattered CSS rules from individual HTML files (add.html, index.html, links.html, log.html) and centralized them in main.js to reduce redundancy and facilitate easier updates in the future. This update enhances accessibility and user preference compliance by allowing users to select their desired theme while simplifying CSS management across the website. * feat(dark-mode): improve contrast and visited link styles * Add support for H200 hub and child devices (for example battery powered doorbell D230S1) * feat(editor-theme): dynamically set editor theme based on dark mode preference * fix(styles): implement flex layout for body element * feat(docker): optimize hardware.Dockerfile by cleaning up apt cache This commit optimizes the Docker image size for the hardware setup by including commands to clean up the APT cache after package installation. This change reduces the overall image size by removing unnecessary files and directories that are not needed in the final image, leading to faster download and deployment times. * feat(dark-mode): enhance form elements and hr visibility This commit improves the visibility and aesthetics of form elements (input, select, textarea) and horizontal rules (hr) in dark mode by adjusting their styles. Specifically, it sets a darker background color, lighter text color, and modifies border colors to ensure these elements are both visually appealing and easily distinguishable against the dark background. Additionally, placeholder text color has been adjusted to maintain readability without being overly prominent. The removal of a fixed width on the navigation bar (`nav`) style is aimed at enhancing responsiveness and flexibility in various screen sizes, promoting a better user experience across devices. These changes contribute to a more cohesive and accessible dark mode theme, aligning with modern web design practices that prioritize user comfort and interface adaptability. * fix ivideon source * feat(logging): more usable exec log * fix(api): fix potential Slowloris Attack * feat(index.html): implement auto-reload functionality every 5 seconds * feat(index.html): optimize stream list update and preserve checkbox states * feat(autoreload): change interval from 5 seconds to 1 second * docs(readme): update link for latest binary download method * add milestione http request api uri * add milestone implementation webrtc * fix patch with stream creation * add insecure Tls param, skip wrong tls vms * Add Arch dist to readme * Rename constant back to old name * feat(editor): upgrade Ace editor version to 1.33.0 * Code refactoring after AlexxIT#855 * Protect Nest API from fail on stop * Update README.md Basic spelling fix in README * chore(gitignore): ignore .DS_Store files * feat(web-ui): add confirmation dialog before deleting streams * Code refactoring after AlexxIT#1063 * Add project logo * Code refactoring for Milestone client * Fixed possible nil pointer * Add link to logo creator * Code refactoring after AlexxIT#1029 * Code refactoring after AlexxIT#967 * Code refactoring after AlexxIT#963 * Code fix after AlexxIT#963 * Simplify restart func * Code refactoring after AlexxIT#878 * Revert changes in readme file * feat(logging): enhance log visualization with level-specific colors - Add CSS classes for log levels (info, debug, error, trace, warn) in main.js to color-code log messages based on their severity. - Modify log.html to include the log level as a class in each log entry's table row for applying the corresponding color styles. * Code refactoring after AlexxIT#878 * Code refactoring after AlexxIT#859 * Update readme about exec two way audio * Code refactoring after AlexxIT#1069 * Fix code style for HTML/JS files * Fix WebRTC WriteRTP panic AlexxIT#994 * Fix panic on write to WebRTC source AlexxIT#935 * Fix configuration loss when handling concurrent requests (#1) * [build] custom docker image for private registry (#3) * [cicd][SRE-415]: build custom image * [cicd][SRE-415]: change docker image name * [cicd][SRE-415]: select main and tags for build only * Add option for skipping RTP header size insufficient for extension error (#4) Add option for skipping RTSP insufficient header error * Add bitrate to webrtc/mse/mp4 consumer info (#5) --------- Co-authored-by: René Simonsen <[email protected]> Co-authored-by: Michael Reif <[email protected]> Co-authored-by: Sergey Krashevich <[email protected]> Co-authored-by: dadav <[email protected]> Co-authored-by: Rob van Oostenrijk <[email protected]> Co-authored-by: Rob van Oostenrijk <[email protected]> Co-authored-by: Felipe Santos <[email protected]> Co-authored-by: civita <[email protected]> Co-authored-by: Josip Janzic <[email protected]> Co-authored-by: f1d094 <[email protected]> Co-authored-by: pabst2k <[email protected]> Co-authored-by: April MacDonald <[email protected]> Co-authored-by: Евгений <[email protected]> Co-authored-by: Alex X <[email protected]> Co-authored-by: Gennaro Gallo <[email protected]> Co-authored-by: Alex X <[email protected]> Co-authored-by: Jono Gould <[email protected]> Co-authored-by: Pattarapon Theanthong <[email protected]>
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.
Added a
copyTextToClipboard
function to handle text copying across different browsers and fallback scenarios. This function utilizes the Clipboard API when available, providing an asynchronous method to copy text securely. For browsers where the Clipboard API is not available or the page is not served over a secure context, a fallback method using a temporary textarea element anddocument.execCommand
is employed. Replaced direct use ofnavigator.clipboard.writeText
with this function in the 'shareget' click event listener to enhance cross-browser support and error handling.