mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-03-30 00:51:04 +00:00
feat(frontend): pass locale to iframe embedded pages via lang parameter
Embedded pages (purchase subscription, custom pages) now receive the current user locale through a `lang` URL parameter, allowing iframe content to match the user's language preference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -99,16 +99,17 @@ curl -X POST "${BASE}/api/v1/admin/users/123/balance" \
|
||||
}'
|
||||
```
|
||||
|
||||
### 4) 购买页 URL Query 透传(iframe / 新窗口一致)
|
||||
当 Sub2API 打开 `purchase_subscription_url` 时,会统一追加:
|
||||
### 4) 购买页 / 自定义页面 URL Query 透传(iframe / 新窗口一致)
|
||||
当 Sub2API 打开 `purchase_subscription_url` 或用户侧自定义页面 iframe URL 时,会统一追加:
|
||||
- `user_id`
|
||||
- `token`
|
||||
- `theme`(`light` / `dark`)
|
||||
- `lang`(例如 `zh` / `en`,用于向嵌入页传递当前界面语言)
|
||||
- `ui_mode`(固定 `embedded`)
|
||||
|
||||
示例:
|
||||
```text
|
||||
https://pay.example.com/pay?user_id=123&token=<jwt>&theme=light&ui_mode=embedded
|
||||
https://pay.example.com/pay?user_id=123&token=<jwt>&theme=light&lang=zh&ui_mode=embedded
|
||||
```
|
||||
|
||||
### 5) 失败处理建议
|
||||
@@ -218,16 +219,17 @@ curl -X POST "${BASE}/api/v1/admin/users/123/balance" \
|
||||
}'
|
||||
```
|
||||
|
||||
### 4) Purchase URL query forwarding (iframe and new tab)
|
||||
When Sub2API opens `purchase_subscription_url`, it appends:
|
||||
### 4) Purchase / Custom Page URL query forwarding (iframe and new tab)
|
||||
When Sub2API opens `purchase_subscription_url` or a user-facing custom page iframe URL, it appends:
|
||||
- `user_id`
|
||||
- `token`
|
||||
- `theme` (`light` / `dark`)
|
||||
- `lang` (for example `zh` / `en`, used to pass the current UI language to the embedded page)
|
||||
- `ui_mode` (fixed: `embedded`)
|
||||
|
||||
Example:
|
||||
```text
|
||||
https://pay.example.com/pay?user_id=123&token=<jwt>&theme=light&ui_mode=embedded
|
||||
https://pay.example.com/pay?user_id=123&token=<jwt>&theme=light&lang=zh&ui_mode=embedded
|
||||
```
|
||||
|
||||
### 5) Failure handling recommendations
|
||||
|
||||
Reference in New Issue
Block a user