[PR #407] [MERGED] feat: update webhook to support global webhook #564

Closed
opened 2026-02-26 21:31:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407
Author: @dreamhunter2333
Created: 8/14/2024
Status: Merged
Merged: 8/14/2024
Merged by: @dreamhunter2333

Base: mainHead: feature/dev


📝 Commits (1)

  • b4909f4 feat: update webhook to support global webhook

📊 Changes

17 files changed (+416 additions, -216 deletions)

View changed files

📝 frontend/src/components/MailBox.vue (+7 -7)
📝 frontend/src/components/SendBox.vue (+3 -3)
frontend/src/components/WebhookComponent.vue (+179 -0)
📝 frontend/src/views/Admin.vue (+9 -3)
📝 frontend/src/views/Index.vue (+3 -1)
frontend/src/views/admin/MailWebhook.vue (+30 -0)
📝 frontend/src/views/common/Login.vue (+2 -2)
📝 frontend/src/views/index/SendMail.vue (+5 -8)
📝 frontend/src/views/index/Webhook.vue (+13 -114)
📝 vitepress-docs/docs/zh/guide/ui/worker.md (+2 -0)
📝 worker/src/admin_api/index.ts (+11 -0)
worker/src/admin_api/mail_webhook_settings.ts (+55 -0)
📝 worker/src/common.ts (+75 -0)
📝 worker/src/constants.ts (+1 -0)
📝 worker/src/email/index.ts (+2 -2)
📝 worker/src/mails_api/webhook_settings.ts (+2 -76)
📝 worker/src/models/index.ts (+17 -0)

📄 Description

User description

#383


PR Type

Enhancement, Tests, Documentation


Description

  • Added a new Vue component WebhookComponent for managing webhook settings, including fetching, saving, and testing functionalities.
  • Introduced a new view MailWebhook for managing mail webhook settings using the WebhookComponent.
  • Updated the Admin.vue and Index.vue views to include new tabs and localization keys for webhook settings.
  • Refactored the existing Webhook.vue view to use the new WebhookComponent.
  • Added new API endpoints and handlers for mail webhook settings in the backend.
  • Implemented functions to send and trigger webhooks, integrating both admin and user mail webhook settings.
  • Fixed a typo in the function call for triggering webhooks in the email processing module.
  • Updated the documentation to include the new format for the USER_ROLES variable.

Changes walkthrough 📝

Relevant files
Enhancement
12 files
WebhookComponent.vue
New Webhook Component with Fetch, Save, and Test Functionalities

frontend/src/components/WebhookComponent.vue

  • Added a new Vue component for webhook settings.
  • Implemented methods for fetching, saving, and testing webhook
    settings.
  • Added localization support for English and Chinese.
  • +179/-0 
    Admin.vue
    Add Mail Webhook Tab and Update Localization                         

    frontend/src/views/Admin.vue

  • Added a new tab for Mail Webhook settings.
  • Updated localization keys for webhook settings.
  • +9/-3     
    Index.vue
    Update Localization and Tab Name for Webhook Settings       

    frontend/src/views/Index.vue

  • Updated localization keys for webhook settings.
  • Updated tab name for webhook settings.
  • +3/-1     
    MailWebhook.vue
    Add Mail Webhook Settings View                                                     

    frontend/src/views/admin/MailWebhook.vue

  • Added a new view for Mail Webhook settings.
  • Integrated the new WebhookComponent for Mail Webhook settings.
  • +30/-0   
    SendMail.vue
    Update Alert and Button Layout in SendMail View                   

    frontend/src/views/index/SendMail.vue

    • Updated alert and button layout.
    • Removed redundant CSS classes.
    +5/-8     
    Webhook.vue
    Refactor Webhook View to Use New WebhookComponent               

    frontend/src/views/index/Webhook.vue

  • Refactored to use the new WebhookComponent.
  • Removed redundant code for webhook settings.
  • +13/-114
    index.ts
    Add API Endpoints for Mail Webhook Settings                           

    worker/src/admin_api/index.ts

  • Added API endpoints for Mail Webhook settings.
  • Integrated new mail webhook settings handlers.
  • +11/-0   
    mail_webhook_settings.ts
    Implement Mail Webhook Settings Handlers                                 

    worker/src/admin_api/mail_webhook_settings.ts

  • Added functions to get, save, and test Mail Webhook settings.
  • Implemented webhook testing with a random email.
  • +55/-0   
    common.ts
    Add Functions to Send and Trigger Webhooks                             

    worker/src/common.ts

  • Added functions to send and trigger webhooks.
  • Integrated admin and user mail webhook settings.
  • +75/-0   
    constants.ts
    Add Constant for Admin Mail Webhook Settings Key                 

    worker/src/constants.ts

    • Added a constant for admin mail webhook settings key.
    +1/-0     
    webhook_settings.ts
    Refactor Webhook Settings to Use Common Functions               

    worker/src/mails_api/webhook_settings.ts

  • Removed redundant webhook settings and functions.
  • Refactored to use common webhook functions.
  • +2/-76   
    index.ts
    Add WebhookSettings Class                                                               

    worker/src/models/index.ts

    • Added a new class for WebhookSettings.
    +17/-0   
    Bug fix
    1 files
    index.ts
    Fix Typo in Trigger Webhook Function Call                               

    worker/src/email/index.ts

    • Fixed typo in the function call for triggering webhooks.
    +2/-2     
    Documentation
    1 files
    worker.md
    Update Documentation for USER_ROLES Variable Format           

    vitepress-docs/docs/zh/guide/ui/worker.md

  • Updated documentation to include new format for USER_ROLES variable.
  • +2/-0     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions


    🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

    ## 📋 Pull Request Information **Original PR:** https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 8/14/2024 **Status:** ✅ Merged **Merged:** 8/14/2024 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/dev` --- ### 📝 Commits (1) - [`b4909f4`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/b4909f4c38f86ce3b4c61746f178b99dedd7d2e7) feat: update webhook to support global webhook ### 📊 Changes **17 files changed** (+416 additions, -216 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/MailBox.vue` (+7 -7) 📝 `frontend/src/components/SendBox.vue` (+3 -3) ➕ `frontend/src/components/WebhookComponent.vue` (+179 -0) 📝 `frontend/src/views/Admin.vue` (+9 -3) 📝 `frontend/src/views/Index.vue` (+3 -1) ➕ `frontend/src/views/admin/MailWebhook.vue` (+30 -0) 📝 `frontend/src/views/common/Login.vue` (+2 -2) 📝 `frontend/src/views/index/SendMail.vue` (+5 -8) 📝 `frontend/src/views/index/Webhook.vue` (+13 -114) 📝 `vitepress-docs/docs/zh/guide/ui/worker.md` (+2 -0) 📝 `worker/src/admin_api/index.ts` (+11 -0) ➕ `worker/src/admin_api/mail_webhook_settings.ts` (+55 -0) 📝 `worker/src/common.ts` (+75 -0) 📝 `worker/src/constants.ts` (+1 -0) 📝 `worker/src/email/index.ts` (+2 -2) 📝 `worker/src/mails_api/webhook_settings.ts` (+2 -76) 📝 `worker/src/models/index.ts` (+17 -0) </details> ### 📄 Description ### **User description** #383 ___ ### **PR Type** Enhancement, Tests, Documentation ___ ### **Description** - Added a new Vue component `WebhookComponent` for managing webhook settings, including fetching, saving, and testing functionalities. - Introduced a new view `MailWebhook` for managing mail webhook settings using the `WebhookComponent`. - Updated the `Admin.vue` and `Index.vue` views to include new tabs and localization keys for webhook settings. - Refactored the existing `Webhook.vue` view to use the new `WebhookComponent`. - Added new API endpoints and handlers for mail webhook settings in the backend. - Implemented functions to send and trigger webhooks, integrating both admin and user mail webhook settings. - Fixed a typo in the function call for triggering webhooks in the email processing module. - Updated the documentation to include the new format for the `USER_ROLES` variable. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>12 files</summary><table> <tr> <td> <details> <summary><strong>WebhookComponent.vue</strong><dd><code>New Webhook Component with Fetch, Save, and Test Functionalities</code></dd></summary> <hr> frontend/src/components/WebhookComponent.vue <li>Added a new Vue component for webhook settings.<br> <li> Implemented methods for fetching, saving, and testing webhook <br>settings.<br> <li> Added localization support for English and Chinese.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-8eaf310c585275c92fcfb1671a870d4615f8aa0b4750ab32bf865a32430db673">+179/-0</a>&nbsp; </td> </tr> <tr> <td> <details> <summary><strong>Admin.vue</strong><dd><code>Add Mail Webhook Tab and Update Localization</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/Admin.vue <li>Added a new tab for Mail Webhook settings.<br> <li> Updated localization keys for webhook settings.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-78137b072a7fa52c6d503efb9a3d32c07da5073dd5ca32ac48b1402ac2481a55">+9/-3</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>Index.vue</strong><dd><code>Update Localization and Tab Name for Webhook Settings</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/Index.vue <li>Updated localization keys for webhook settings.<br> <li> Updated tab name for webhook settings.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-9816bb6131d16919d3ca2c71fb0911d2cb73cc9a49d75394c6206ff15f1aa4d8">+3/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>MailWebhook.vue</strong><dd><code>Add Mail Webhook Settings View</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/admin/MailWebhook.vue <li>Added a new view for Mail Webhook settings.<br> <li> Integrated the new WebhookComponent for Mail Webhook settings.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-a5c0feb5949cfeb7040aa92c3fae1b811387e9cd74f6e70f913be6af5047e5b4">+30/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>SendMail.vue</strong><dd><code>Update Alert and Button Layout in SendMail View</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/index/SendMail.vue - Updated alert and button layout. - Removed redundant CSS classes. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-005668289e156e6ef43ee2b7d75f8592c1db57e9ecfc1dd7656e5ab19526a380">+5/-8</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>Webhook.vue</strong><dd><code>Refactor Webhook View to Use New WebhookComponent</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/index/Webhook.vue <li>Refactored to use the new WebhookComponent.<br> <li> Removed redundant code for webhook settings.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-b5e73cc6995da57095cbf889ec452a6f59903911c8e059a6a2ec02d8ab2b2d76">+13/-114</a></td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Add API Endpoints for Mail Webhook Settings</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/admin_api/index.ts <li>Added API endpoints for Mail Webhook settings.<br> <li> Integrated new mail webhook settings handlers.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-b470c4c47ce4a700cd8aac644d07d8a747d439bb6d69e9392a198b3a931fe2e7">+11/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>mail_webhook_settings.ts</strong><dd><code>Implement Mail Webhook Settings Handlers</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/admin_api/mail_webhook_settings.ts <li>Added functions to get, save, and test Mail Webhook settings.<br> <li> Implemented webhook testing with a random email.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-a8888cea638671df084f06f14c82a84294903585f3a218161847b0a96d044821">+55/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>common.ts</strong><dd><code>Add Functions to Send and Trigger Webhooks</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/common.ts <li>Added functions to send and trigger webhooks.<br> <li> Integrated admin and user mail webhook settings.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-fcc08fd5aa3c190d0d45c7e3dd208e5ee831d360b272fdd5869607cf472c5eb1">+75/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>constants.ts</strong><dd><code>Add Constant for Admin Mail Webhook Settings Key</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/constants.ts - Added a constant for admin mail webhook settings key. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-cab08ba19c1499ed426fc4918a5613e22eb95c3427c7467ce330f5ee0d69d01e">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>webhook_settings.ts</strong><dd><code>Refactor Webhook Settings to Use Common Functions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/mails_api/webhook_settings.ts <li>Removed redundant webhook settings and functions.<br> <li> Refactored to use common webhook functions.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-0c4fdb3ef2a70f77455a6458c649932abb800e668143eb85d12c95ef911bfb37">+2/-76</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Add WebhookSettings Class</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/models/index.ts - Added a new class for WebhookSettings. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-430bcc4ffa98738e7419c774a53ba2ce8b5127a36b3741e89bf36b95a56f02bc">+17/-0</a>&nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Bug fix</strong></td><td><details><summary>1 files</summary><table> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Fix Typo in Trigger Webhook Function Call</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/email/index.ts - Fixed typo in the function call for triggering webhooks. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-da1768152a73f37b0a0780d578569f84c3d4bb946294e3a81fb0271302e6d816">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>1 files</summary><table> <tr> <td> <details> <summary><strong>worker.md</strong><dd><code>Update Documentation for USER_ROLES Variable Format</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> vitepress-docs/docs/zh/guide/ui/worker.md <li>Updated documentation to include new format for USER_ROLES variable.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/407/files#diff-ed132f8c7a4d0a1bd98a708c0577a087c30833499ef59c1f30f1b819a351290d">+2/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
    kerem 2026-02-26 21:31:48 +03:00
    Sign in to join this conversation.
    No milestone
    No project
    No assignees
    1 participant
    Notifications
    Due date
    The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

    No due date set.

    Dependencies

    No dependencies set.

    Reference
    starred/cloudflare_temp_email#564
    No description provided.