Sweep: add webhook when uploading cookie #69
Description
This pull request introduces the functionality to send a webhook notification when a cookie is successfully uploaded. This feature allows for external systems to be notified and react to the event of a cookie upload, enhancing the extension's integration capabilities.
Summary
- Added support for configuring a
webhook_urlin the extension settings. - Implemented a POST request to the configured
webhook_urlwith the cookie and local storage data as the payload when a cookie upload is marked as done. - Updated the popup settings UI to include a field for entering the
webhook_url. - Ensured error handling and logging for the webhook request to aid in debugging and monitoring.
- Modified files:
extension/function.jsfor the webhook implementation andextension/popup.tsxfor UI changes.
Fixes #69.
💡 To get Sweep to edit this pull request, you can:
- Comment below, and Sweep can edit the entire PR
- Comment on a file, Sweep will only modify the commented file
- Edit the original issue to get Sweep to recreate the PR from scratch
This is an automated message generated by Sweep AI.
Rollback Files For Sweep
- [ ] Rollback changes to extension/popup.tsx
- [ ] Rollback changes to extension/function.js
This is an automated message generated by Sweep AI.
Sweep: PR Review
extension/function.js
The changes add a new feature to send a POST request to a webhook URL with cookie and local storage data if the upload is successful and the webhook URL is provided.
Sweep Found These Issues
- The new code logs the webhook response directly to the console, which might expose sensitive data in production environments.
https://github.com/easychen/CookieCloud/blob/9062b22754771cd202ba5c90ecf0afa80bc2b412/extension%2Ffunction.js#L217 View Diff
extension/popup.tsx
Added a new "webhook_url" field to the state and form, and integrated it into the existing state management and form handling logic.
Sweep Found These Issues
- The
webhook_urlfield is not included in the validation checks within thetestandsavefunctions, which could lead to incomplete or incorrect data being processed.
https://github.com/easychen/CookieCloud/blob/9062b22754771cd202ba5c90ecf0afa80bc2b412/extension%2Fpopup.tsx#L16-L19 View Diff