feat: configurable VPS URL, 163 mail support, mail provider selector

- VPS URL: now an input field in Side Panel, no longer hardcoded
  - Dynamic script injection via chrome.scripting.executeScript
  - host_permissions changed to <all_urls> for flexibility
- 163 Mail: new content script (mail-163.js) with actual selectors
  - Mail items: div[sign="letter"], sender: .nui-user, subject: span.da0
  - Supports aria-label fallback for matching
- Mail provider selector: dropdown to switch between QQ Mail and 163 Mail
  - Background routes steps 4/7 to correct mail content script
- Settings persist in chrome.storage.session
This commit is contained in:
unknown
2026-04-05 09:56:48 +08:00
parent 5d6b2789b1
commit c6f1070ace
9 changed files with 3063 additions and 35 deletions
+23 -1
View File
@@ -19,6 +19,8 @@ const btnAutoRun = document.getElementById('btn-auto-run');
const btnAutoContinue = document.getElementById('btn-auto-continue');
const autoContinueBar = document.getElementById('auto-continue-bar');
const btnClearLog = document.getElementById('btn-clear-log');
const inputVpsUrl = document.getElementById('input-vps-url');
const selectMailProvider = document.getElementById('select-mail-provider');
// ============================================================
// State Restore on load
@@ -39,6 +41,12 @@ async function restoreState() {
if (state.email) {
inputEmail.value = state.email;
}
if (state.vpsUrl) {
inputVpsUrl.value = state.vpsUrl;
}
if (state.mailProvider) {
selectMailProvider.value = state.mailProvider;
}
if (state.stepStatuses) {
for (const [step, status] of Object.entries(state.stepStatuses)) {
@@ -238,7 +246,7 @@ btnClearLog.addEventListener('click', () => {
logArea.innerHTML = '';
});
// Save email on change
// Save settings on change
inputEmail.addEventListener('change', async () => {
const email = inputEmail.value.trim();
if (email) {
@@ -246,6 +254,20 @@ inputEmail.addEventListener('change', async () => {
}
});
inputVpsUrl.addEventListener('change', async () => {
const vpsUrl = inputVpsUrl.value.trim();
if (vpsUrl) {
await chrome.runtime.sendMessage({ type: 'SAVE_SETTING', source: 'sidepanel', payload: { vpsUrl } });
}
});
selectMailProvider.addEventListener('change', async () => {
await chrome.runtime.sendMessage({
type: 'SAVE_SETTING', source: 'sidepanel',
payload: { mailProvider: selectMailProvider.value },
});
});
// ============================================================
// Listen for Background broadcasts
// ============================================================