[PR #794] [MERGED] feat: add address source tracking (source_meta field) #768

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

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794
Author: @dreamhunter2333
Created: 12/27/2025
Status: Merged
Merged: 12/28/2025
Merged by: @dreamhunter2333

Base: mainHead: feature/email


📝 Commits (1)

  • 9971a9c feat: add address source tracking (source_meta field)

📊 Changes

11 files changed (+99 additions, -16 deletions)

View changed files

📝 CHANGELOG.md (+7 -0)
📝 CHANGELOG_EN.md (+7 -0)
db/2025-12-27-source-meta.sql (+8 -0)
📝 db/schema.sql (+3 -0)
📝 frontend/src/views/admin/Account.vue (+6 -0)
📝 worker/src/admin_api/db_api.ts (+38 -7)
📝 worker/src/admin_api/index.ts (+1 -0)
📝 worker/src/common.ts (+19 -6)
📝 worker/src/constants.ts (+1 -1)
📝 worker/src/mails_api/index.ts (+7 -1)
📝 worker/src/telegram_api/common.ts (+2 -1)

📄 Description

User description

Summary

  • Add source_meta field to address table for tracking address creation source
  • Web: records client IP address (with fallback to web:unknown)
  • Telegram: records tg:{userId}
  • Admin: records admin
  • Database migration with field existence check for safety
  • Frontend display in admin Account page
  • Backward compatible design

Breaking Changes

  • Database schema change: need to execute db/2025-12-27-source-meta.sql or click database update button on admin maintenance page

Test plan

  • Create address from web, verify IP is recorded
  • Create address from Telegram, verify tg:{userId} is recorded
  • Create address from Admin, verify admin is recorded
  • Verify admin Account page shows source_meta column
  • Test database migration from older versions

🤖 Generated with Claude Code


PR Type

Enhancement, Documentation, Tests


Description

  • Added source_meta field to address table for tracking address creation sources.

    • Tracks source as IP for web, user ID for Telegram, and "admin" for admin panel.
    • Includes database migration script and backward compatibility checks.
  • Updated frontend to display source_meta in the admin Account page.

  • Enhanced backend APIs to handle and store source_meta for new address creation.

  • Updated documentation and changelogs to reflect the new source_meta feature.


Changes walkthrough 📝

Relevant files
Enhancement
6 files
Account.vue
Added `source_meta` column to admin Account page                 
+6/-0     
db_api.ts
Added `source_meta` column and migration logic for database
+38/-7   
index.ts
Set `source_meta` to "admin" for new addresses created via admin API
+1/-0     
common.ts
Enhanced `newAddress` function to handle `source_meta`     
+19/-6   
index.ts
Added client IP tracking for source_meta in new address creation API
+7/-1     
common.ts
Added Telegram user ID tracking for source_meta in new address
creation
+2/-1     
Configuration changes
3 files
constants.ts
Updated database version to v0.0.5                                             
+1/-1     
2025-12-27-source-meta.sql
Added SQL migration script for `source_meta` column           
+8/-0     
schema.sql
Updated database schema to include `source_meta` column and index
+3/-0     
Documentation
2 files
CHANGELOG.md
Updated changelog with `source_meta` feature details         
+7/-0     
CHANGELOG_EN.md
Updated English changelog with `source_meta` feature details
+7/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.

  • 🔄 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/794 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 12/27/2025 **Status:** ✅ Merged **Merged:** 12/28/2025 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/email` --- ### 📝 Commits (1) - [`9971a9c`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/9971a9cb7896034ca05cb6e68d7135b2e88f919b) feat: add address source tracking (source_meta field) ### 📊 Changes **11 files changed** (+99 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+7 -0) 📝 `CHANGELOG_EN.md` (+7 -0) ➕ `db/2025-12-27-source-meta.sql` (+8 -0) 📝 `db/schema.sql` (+3 -0) 📝 `frontend/src/views/admin/Account.vue` (+6 -0) 📝 `worker/src/admin_api/db_api.ts` (+38 -7) 📝 `worker/src/admin_api/index.ts` (+1 -0) 📝 `worker/src/common.ts` (+19 -6) 📝 `worker/src/constants.ts` (+1 -1) 📝 `worker/src/mails_api/index.ts` (+7 -1) 📝 `worker/src/telegram_api/common.ts` (+2 -1) </details> ### 📄 Description ### **User description** ## Summary - Add `source_meta` field to address table for tracking address creation source - Web: records client IP address (with fallback to `web:unknown`) - Telegram: records `tg:{userId}` - Admin: records `admin` - Database migration with field existence check for safety - Frontend display in admin Account page - Backward compatible design ## Breaking Changes - Database schema change: need to execute `db/2025-12-27-source-meta.sql` or click database update button on admin maintenance page ## Test plan - [ ] Create address from web, verify IP is recorded - [ ] Create address from Telegram, verify `tg:{userId}` is recorded - [ ] Create address from Admin, verify `admin` is recorded - [ ] Verify admin Account page shows source_meta column - [ ] Test database migration from older versions 🤖 Generated with [Claude Code](https://claude.ai/code) ___ ### **PR Type** Enhancement, Documentation, Tests ___ ### **Description** - Added `source_meta` field to `address` table for tracking address creation sources. - Tracks source as IP for web, user ID for Telegram, and "admin" for admin panel. - Includes database migration script and backward compatibility checks. - Updated frontend to display `source_meta` in the admin Account page. - Enhanced backend APIs to handle and store `source_meta` for new address creation. - Updated documentation and changelogs to reflect the new `source_meta` feature. ___ ### **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><strong>Account.vue</strong><dd><code>Added `source_meta` column to admin Account page</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-1ac8a75932c8a510449efbe046700149bce141b9a325b770922eeaa3486a3d66">+6/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>db_api.ts</strong><dd><code>Added `source_meta` column and migration logic for database</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-b2b74d448d9a04d5b6118262d99440206d6b342cb4955730aa50ed9f35923e4c">+38/-7</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Set `source_meta` to "admin" for new addresses created via admin API</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-b470c4c47ce4a700cd8aac644d07d8a747d439bb6d69e9392a198b3a931fe2e7">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>common.ts</strong><dd><code>Enhanced `newAddress` function to handle `source_meta`</code>&nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-fcc08fd5aa3c190d0d45c7e3dd208e5ee831d360b272fdd5869607cf472c5eb1">+19/-6</a>&nbsp; &nbsp; </td> </tr> <tr> <td><strong>index.ts</strong><dd><code>Added client IP tracking for <code>source_meta</code> in new address creation API</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-83710df6a60b2b512e134f32ad9890ab9a255040f6019f0d5603f72f4561cea4">+7/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>common.ts</strong><dd><code>Added Telegram user ID tracking for <code>source_meta</code> in new address <br>creation</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-962b7426663cb9f82119a7691d62d1401a72e3c85654a12b7b21e014d1414eab">+2/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>3 files</summary><table> <tr> <td><strong>constants.ts</strong><dd><code>Updated database version to v0.0.5</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-cab08ba19c1499ed426fc4918a5613e22eb95c3427c7467ce330f5ee0d69d01e">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>2025-12-27-source-meta.sql</strong><dd><code>Added SQL migration script for `source_meta` column</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-454d49e1c362e58d74eb95ee0cf37175ad3bf48b5f3a9e8756691e945010e8fe">+8/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>schema.sql</strong><dd><code>Updated database schema to include `source_meta` column and index</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-948c089a4de6325dd9a8f187fb0116272dedf46306023dce6d70b548e9f7539c">+3/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>CHANGELOG.md</strong><dd><code>Updated changelog with `source_meta` feature details</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed">+7/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td><strong>CHANGELOG_EN.md</strong><dd><code>Updated English changelog with `source_meta` feature details</code></dd></td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/794/files#diff-77d2276dbbf8eb648363b81ea97049986b18e2cf1e90bd20fb5133ed5ff4fcae">+7/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></details></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
    kerem 2026-02-26 21:32:52 +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#768
    No description provided.