feat: add support for Inbucket mailbox configuration and dynamic host input

This commit is contained in:
Jimmy
2026-04-06 13:21:58 +08:00
parent 77cfdc1dd9
commit f79166b96d
7 changed files with 449 additions and 42 deletions
+5 -1
View File
@@ -53,9 +53,13 @@
<select id="select-mail-provider" class="data-select">
<option value="163">163 Mail (mail.163.com)</option>
<option value="qq">QQ Mail (wx.mail.qq.com)</option>
<option value="inbucket">Inbucket (inbucket.j2to.de/m/&lt;mailbox&gt;/)</option>
<option value="inbucket">Inbucket (custom host)</option>
</select>
</div>
<div class="data-row" id="row-inbucket-host" style="display:none;">
<span class="data-label">Inbucket</span>
<input type="text" id="input-inbucket-host" class="data-input" placeholder="your-inbucket-host or https://your-inbucket-host" />
</div>
<div class="data-row" id="row-inbucket-mailbox" style="display:none;">
<span class="data-label">Mailbox</span>
<input type="text" id="input-inbucket-mailbox" class="data-input" placeholder="e.g. zju2001" />
+14
View File
@@ -26,6 +26,8 @@ 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');
const rowInbucketHost = document.getElementById('row-inbucket-host');
const inputInbucketHost = document.getElementById('input-inbucket-host');
const rowInbucketMailbox = document.getElementById('row-inbucket-mailbox');
const inputInbucketMailbox = document.getElementById('input-inbucket-mailbox');
const inputRunCount = document.getElementById('input-run-count');
@@ -88,6 +90,9 @@ async function restoreState() {
if (state.mailProvider) {
selectMailProvider.value = state.mailProvider;
}
if (state.inbucketHost) {
inputInbucketHost.value = state.inbucketHost;
}
if (state.inbucketMailbox) {
inputInbucketMailbox.value = state.inbucketMailbox;
}
@@ -118,6 +123,7 @@ function syncPasswordField(state) {
function updateMailProviderUI() {
const useInbucket = selectMailProvider.value === 'inbucket';
rowInbucketHost.style.display = useInbucket ? '' : 'none';
rowInbucketMailbox.style.display = useInbucket ? '' : 'none';
}
@@ -406,6 +412,14 @@ inputInbucketMailbox.addEventListener('change', async () => {
});
});
inputInbucketHost.addEventListener('change', async () => {
await chrome.runtime.sendMessage({
type: 'SAVE_SETTING',
source: 'sidepanel',
payload: { inbucketHost: inputInbucketHost.value.trim() },
});
});
// ============================================================
// Listen for Background broadcasts
// ============================================================