Claude detection respects payment filter, add project skill

- Backend check-claude-payment accepts optional emails list
- Frontend sends filtered emails when filter is active
- Button label updates to show current filter scope
- Add project skill for development guidance

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-06 14:10:06 +08:00
parent 4091bcc8ad
commit 18ae09af12
3 changed files with 217 additions and 4 deletions

View File

@@ -110,6 +110,7 @@ class MailManager {
this.paymentFilter = e.target.value;
this.page = 1;
this.loadAccounts();
this.updateClaudeBtnLabel();
});
// 刷新
@@ -1144,15 +1145,49 @@ class MailManager {
}
}
updateClaudeBtnLabel() {
const btn = document.getElementById('claudePaymentBtn');
if (!btn || btn.disabled) return;
const filterSelect = document.getElementById('paymentFilter');
const filterText = filterSelect.options[filterSelect.selectedIndex].text;
if (this.paymentFilter) {
btn.innerHTML = `<i class="bi bi-credit-card"></i><span>检测(${filterText})</span>`;
} else {
btn.innerHTML = '<i class="bi bi-credit-card"></i><span>Claude检测</span>';
}
}
async startClaudePaymentCheck() {
const btn = document.getElementById('claudePaymentBtn');
if (!btn) return;
// 根据筛选条件决定检测范围
let targetEmails = [];
if (this.paymentFilter && this._allAccounts) {
targetEmails = this._allAccounts
.filter(acc => this._matchPaymentFilter(acc.email))
.map(acc => acc.email);
}
const label = this.paymentFilter
? `检测 ${targetEmails.length}`
: '全部检测';
if (targetEmails.length === 0 && this.paymentFilter) {
this.showToast('当前筛选条件下没有账号', 'warning');
return;
}
btn.disabled = true;
const origHtml = btn.innerHTML;
btn.innerHTML = '<i class="bi bi-hourglass-split"></i><span>检测中...</span>';
try {
const response = await fetch('/api/tools/check-claude-payment', { method: 'POST' });
const response = await fetch('/api/tools/check-claude-payment', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ emails: targetEmails })
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';