fix: 支持 Server酱3 AppKey 通知发送 - #18
Open
zzo01 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Server酱³ (ServerChan3) notification URL construction by ensuring AppKey/SendKey hyphens (-) are preserved in the URL path segment, preventing 10003 sendkey not found errors caused by over-encoding. It also updates the frontend label to clarify the expected input without breaking existing send_key configuration compatibility.
Changes:
- Preserve
-when building the Server酱³ send URL (avoid%2Din AppKey). - Update Server酱³ frontend field label to
SendKey / AppKey. - Adjust backend unit test expectation for the updated URL output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/pages/notifications/NotificationChannelsTab.tsx | Updates Server酱³ input label to clarify SendKey/AppKey usage. |
| backend/src/notification.rs | Fixes Server酱³ URL path encoding to keep hyphens and updates related test expectation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
2413
to
2416
| "https://{}.push.ft07.com/send/{}.send", | ||
| uid, | ||
| encode_path_segment(send_key) | ||
| encode_path_segment(send_key).replace("%2D", "-") | ||
| )) |
Comment on lines
3744
to
3748
| }; | ||
| assert_eq!( | ||
| serverchan3_url(&manual_uid).unwrap(), | ||
| "https://user-1.push.ft07.com/send/manual%2Dsecret.send" | ||
| "https://user-1.push.ft07.com/send/manual-secret.send" | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
%2D后返回10003 sendkey not found的问题SendKey / AppKeysend_key配置字段不变,兼容已有配置问题原因
Server酱³ 的 AppKey 格式类似:
其中包含连字符 -
SimAdmin 原来使用 NON_ALPHANUMERIC 对整个 Key 进行 URL 路径编码。该编码规则会把所有非字母数字字符编码,因此 AppKey 中的 - 会被转换为 %2D
验证