Skip to content

添加表单数据恢复功能和 GitHub Token 验证 - #2

Open
StevenLi-phoenix wants to merge 5 commits into
afoim:mainfrom
StevenLi-phoenix:main
Open

添加表单数据恢复功能和 GitHub Token 验证#2
StevenLi-phoenix wants to merge 5 commits into
afoim:mainfrom
StevenLi-phoenix:main

Conversation

@StevenLi-phoenix

Copy link
Copy Markdown

#1

Copilot AI review requested due to automatic review settings January 15, 2026 23:09
@StevenLi-phoenix

Copy link
Copy Markdown
Author

不对,这AI写的啥,我还得手动改

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds form data persistence and GitHub token validation to handle Cloudflare bot protection challenges. When a 403 response is received (interpreted as a CF block), the implementation is designed to save form data to LocalStorage and refresh the page to pass bot detection.

Changes:

  • Added GitHub token validation before API calls in the worker
  • Added LocalStorage-based form data persistence and recovery in the HTML form
  • Added CF block detection to trigger page refresh on 403 responses

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
worker.js Added GitHub token validation (lines 227-254) and CF block detection logic (lines 269-282) that return 403 with nonsense data
_url.html Added LocalStorage form data persistence (lines 143-168), cleanup on success (lines 230-232), and CF block detection (lines 285-292)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _url.html Outdated
Comment thread _url.html Outdated
Comment thread _url.html Outdated
Comment thread worker.js Outdated
Comment thread worker.js Outdated
Comment thread worker.js Outdated
Comment thread _url.html Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

_url.html:341

  • When form submission fails (either with an error response or network error), the retry state should be cleared from localStorage. Otherwise, if a user refreshes the page after a failed submission, the form will auto-submit again, potentially creating an unwanted retry loop. Add clearRetryState() calls in the error handling paths.
                } else {
                    showError(result.error || '提交失败');
                }
            } catch (err) {
                console.error(err);
                showError(err.message || '网络错误或请求失败');

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _url.html
Comment thread _url.html
Comment thread _url.html
Comment thread _url.html Outdated
Comment thread _url.html
Comment thread README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants