[PR #373] [MERGED] feat: add NO_LIMIT_SEND_ROLE #551

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

📋 Pull Request Information

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

Base: mainHead: feature/dev


📝 Commits (1)

  • 7cb2a83 feat: add NO_LIMIT_SEND_ROLE

📊 Changes

10 files changed (+54 additions, -18 deletions)

View changed files

📝 CHANGELOG.md (+2 -1)
📝 frontend/src/store/index.js (+1 -1)
📝 vitepress-docs/docs/en/cli.md (+2 -1)
📝 vitepress-docs/docs/zh/guide/cli/worker.md (+2 -1)
📝 worker/src/commom_api.ts (+1 -1)
📝 worker/src/mails_api/index.ts (+4 -2)
📝 worker/src/mails_api/send_mail_api.ts (+12 -8)
📝 worker/src/types.d.ts (+4 -2)
📝 worker/src/worker.ts (+25 -0)
📝 worker/wrangler.toml.template (+1 -1)

📄 Description

User description

#369


PR Type

Enhancement, Documentation


Description

  • Added NO_LIMIT_SEND_ROLE environment variable to allow specific roles to send emails without balance limits.
  • Changed showGithub logic to use DISABLE_SHOW_GITHUB environment variable.
  • Updated middleware to check user role from token for specific API routes.
  • Updated type definitions to include new environment variables and user role.
  • Updated frontend store to set default GitHub visibility to true.
  • Documented new environment variables in both English and Chinese documentation.
  • Updated changelog to reflect these changes.

Changes walkthrough 📝

Relevant files
Enhancement
6 files
commom_api.ts
Modify GitHub visibility logic                                                     

worker/src/commom_api.ts

  • Changed showGithub logic to use DISABLE_SHOW_GITHUB environment
    variable.
  • +1/-1     
    index.ts
    Add role-based unlimited send mail feature                             

    worker/src/mails_api/index.ts

  • Added user_role retrieval from context.
  • Implemented logic to check for NO_LIMIT_SEND_ROLE and set balance
    accordingly.
  • +4/-2     
    send_mail_api.ts
    Implement role-based balance check bypass                               

    worker/src/mails_api/send_mail_api.ts

  • Added user_role retrieval from context.
  • Implemented logic to bypass balance check for NO_LIMIT_SEND_ROLE.
  • +12/-8   
    types.d.ts
    Update type definitions for new environment variables and user role

    worker/src/types.d.ts

  • Added NO_LIMIT_SEND_ROLE and DISABLE_SHOW_GITHUB to Bindings.
  • Added userRolePayload to Variables.
  • +4/-2     
    worker.ts
    Add middleware to check user role from token                         

    worker/src/worker.ts

  • Added checkoutUserRolePayload function to retrieve user role from
    token.
  • Integrated checkoutUserRolePayload into middleware for specific API
    routes.
  • +25/-0   
    index.js
    Set default GitHub visibility to true                                       

    frontend/src/store/index.js

    • Changed default value of showGithub to true.
    +1/-1     
    Documentation
    4 files
    CHANGELOG.md
    Update changelog for new environment variables                     

    CHANGELOG.md

  • Updated changelog to reflect new environment variables
    DISABLE_SHOW_GITHUB and NO_LIMIT_SEND_ROLE.
  • +2/-1     
    cli.md
    Document new environment variables in CLI documentation   

    vitepress-docs/docs/en/cli.md

  • Documented DISABLE_SHOW_GITHUB and NO_LIMIT_SEND_ROLE environment
    variables.
  • +2/-1     
    worker.md
    Document new environment variables in Chinese CLI guide   

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

  • Documented DISABLE_SHOW_GITHUB and NO_LIMIT_SEND_ROLE environment
    variables in Chinese guide.
  • +2/-1     
    wrangler.toml.template
    Update wrangler template with new environment variables   

    worker/wrangler.toml.template

  • Added DISABLE_SHOW_GITHUB and NO_LIMIT_SEND_ROLE environment variables
    to template.
  • +1/-1     

    💡 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/373 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 8/4/2024 **Status:** ✅ Merged **Merged:** 8/4/2024 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/dev` --- ### 📝 Commits (1) - [`7cb2a83`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/7cb2a83f005d5c751ebc7a95e70fa544620e23fc) feat: add NO_LIMIT_SEND_ROLE ### 📊 Changes **10 files changed** (+54 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -1) 📝 `frontend/src/store/index.js` (+1 -1) 📝 `vitepress-docs/docs/en/cli.md` (+2 -1) 📝 `vitepress-docs/docs/zh/guide/cli/worker.md` (+2 -1) 📝 `worker/src/commom_api.ts` (+1 -1) 📝 `worker/src/mails_api/index.ts` (+4 -2) 📝 `worker/src/mails_api/send_mail_api.ts` (+12 -8) 📝 `worker/src/types.d.ts` (+4 -2) 📝 `worker/src/worker.ts` (+25 -0) 📝 `worker/wrangler.toml.template` (+1 -1) </details> ### 📄 Description ### **User description** #369 ___ ### **PR Type** Enhancement, Documentation ___ ### **Description** - Added `NO_LIMIT_SEND_ROLE` environment variable to allow specific roles to send emails without balance limits. - Changed `showGithub` logic to use `DISABLE_SHOW_GITHUB` environment variable. - Updated middleware to check user role from token for specific API routes. - Updated type definitions to include new environment variables and user role. - Updated frontend store to set default GitHub visibility to true. - Documented new environment variables in both English and Chinese documentation. - Updated changelog to reflect these changes. ___ ### **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>6 files</summary><table> <tr> <td> <details> <summary><strong>commom_api.ts</strong><dd><code>Modify GitHub visibility logic</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> worker/src/commom_api.ts <li>Changed <code>showGithub</code> logic to use <code>DISABLE_SHOW_GITHUB</code> environment <br>variable.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-fe2dec25bee7d722fe8aa25b616c21bd12b8123e26469f5cac11c9164be783c3">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Add role-based unlimited send mail feature</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/mails_api/index.ts <li>Added <code>user_role</code> retrieval from context.<br> <li> Implemented logic to check for <code>NO_LIMIT_SEND_ROLE</code> and set balance <br>accordingly.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-83710df6a60b2b512e134f32ad9890ab9a255040f6019f0d5603f72f4561cea4">+4/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>send_mail_api.ts</strong><dd><code>Implement role-based balance check bypass</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/mails_api/send_mail_api.ts <li>Added <code>user_role</code> retrieval from context.<br> <li> Implemented logic to bypass balance check for <code>NO_LIMIT_SEND_ROLE</code>.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-92070e9d7b3228209a2024053eb4429a76907de17f9566b97b22d0d12e4e0934">+12/-8</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>types.d.ts</strong><dd><code>Update type definitions for new environment variables and user role</code></dd></summary> <hr> worker/src/types.d.ts <li>Added <code>NO_LIMIT_SEND_ROLE</code> and <code>DISABLE_SHOW_GITHUB</code> to <code>Bindings</code>.<br> <li> Added <code>userRolePayload</code> to <code>Variables</code>.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-583fb024d5c9d1efac71bbea788d8379e5e8fc2f0bb1696a9863c6f6cac54bee">+4/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>worker.ts</strong><dd><code>Add middleware to check user role from token</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/worker.ts <li>Added <code>checkoutUserRolePayload</code> function to retrieve user role from <br>token.<br> <li> Integrated <code>checkoutUserRolePayload</code> into middleware for specific API <br>routes.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-c007030a206d7e4e2a4879ba673551e7633ad914b67cfac204096edced3f80a2">+25/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.js</strong><dd><code>Set default GitHub visibility to true</code>&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/store/index.js - Changed default value of `showGithub` to `true`. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-0c36ce15651c51795b411359e8caaf5af7960c82674b4f2015b8dd5f480fde2c">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>4 files</summary><table> <tr> <td> <details> <summary><strong>CHANGELOG.md</strong><dd><code>Update changelog for new environment variables</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> CHANGELOG.md <li>Updated changelog to reflect new environment variables <br><code>DISABLE_SHOW_GITHUB</code> and <code>NO_LIMIT_SEND_ROLE</code>.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>cli.md</strong><dd><code>Document new environment variables in CLI documentation</code>&nbsp; &nbsp; </dd></summary> <hr> vitepress-docs/docs/en/cli.md <li>Documented <code>DISABLE_SHOW_GITHUB</code> and <code>NO_LIMIT_SEND_ROLE</code> environment <br>variables.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-3f8f72a691fa19c8581621e91cf67ad28855af7a57e58513f6563cf4c8886e5f">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>worker.md</strong><dd><code>Document new environment variables in Chinese CLI guide</code>&nbsp; &nbsp; </dd></summary> <hr> vitepress-docs/docs/zh/guide/cli/worker.md <li>Documented <code>DISABLE_SHOW_GITHUB</code> and <code>NO_LIMIT_SEND_ROLE</code> environment <br>variables in Chinese guide.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-f760a2ec5dad4b6bda0bd4a9325274567778add8cb984e73650dbaaf680c9178">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>wrangler.toml.template</strong><dd><code>Update wrangler template with new environment variables</code>&nbsp; &nbsp; </dd></summary> <hr> worker/wrangler.toml.template <li>Added <code>DISABLE_SHOW_GITHUB</code> and <code>NO_LIMIT_SEND_ROLE</code> environment variables <br>to template.<br> </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/373/files#diff-743273da72481b71fbeb1dddfd294be9249554eef65691dfc9bcfa9f0fd971fb">+1/-1</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:46 +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#551
    No description provided.