Merge pull request #108 from christianlouis/copilot/add-pull-now-option-mailbox

Add "Pull Now" button, provider logo banners, and Proton Mail support
This commit is contained in:
Christian Krakau-Louis
2026-03-28 20:24:34 +01:00
committed by GitHub
21 changed files with 604 additions and 83 deletions
@@ -17,6 +17,7 @@ from app.models.database_models import (
AccountStatus,
SubscriptionPlan,
)
from app.workers.tasks import process_mail_account as process_mail_account_task
from app.models.schemas import (
MailAccountCreate,
MailAccountResponse,
@@ -241,6 +242,36 @@ async def toggle_mail_account(
return account
@router.post("/{account_id}/pull-now", status_code=status.HTTP_202_ACCEPTED)
async def pull_now(
account_id: int,
current_user: User = Depends(get_current_active_user),
db: AsyncSession = Depends(get_db),
):
"""Immediately queue a pull for the given mail account"""
result = await db.execute(
select(MailAccount).where(
MailAccount.id == account_id, MailAccount.user_id == current_user.id
)
)
account = result.scalar_one_or_none()
if not account:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Mail account not found"
)
if not account.is_enabled:
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail="Account is disabled. Enable it before pulling.",
)
process_mail_account_task.delay(account_id)
return {"message": "Pull queued successfully"}
@router.post("/test", response_model=MailAccountTestResponse)
async def test_mail_connection(
test_request: MailAccountTestRequest,
@@ -155,6 +155,15 @@ PROVIDER_PRESETS: List[ProviderPreset] = [
pop3_ssl={"host": "pop.mail.de", "port": 995},
notes="Use your mail.de email credentials.",
),
ProviderPreset(
id="protonmail",
name="Proton Mail",
icon="protonmail",
domains=["proton.me", "protonmail.com", "protonmail.ch", "pm.me"],
imap_ssl={"host": "127.0.0.1", "port": 1143},
pop3_ssl={"host": "127.0.0.1", "port": 1144},
notes="Requires Proton Mail Bridge running locally. Use your Bridge password (not your Proton account password). Default Bridge ports: IMAP 127.0.0.1:1143, POP3 127.0.0.1:1144.",
),
ProviderPreset(
id="icloud",
name="iCloud Mail",
+20
View File
@@ -597,6 +597,26 @@ class MailServerAutoDetect:
"pop3_ssl": {"host": "pop.mail.de", "port": 995},
"imap_ssl": {"host": "imap.mail.de", "port": 993},
},
"proton.me": {
"name": "Proton Mail",
"imap_ssl": {"host": "127.0.0.1", "port": 1143},
"pop3_ssl": {"host": "127.0.0.1", "port": 1144},
},
"protonmail.com": {
"name": "Proton Mail",
"imap_ssl": {"host": "127.0.0.1", "port": 1143},
"pop3_ssl": {"host": "127.0.0.1", "port": 1144},
},
"protonmail.ch": {
"name": "Proton Mail",
"imap_ssl": {"host": "127.0.0.1", "port": 1143},
"pop3_ssl": {"host": "127.0.0.1", "port": 1144},
},
"pm.me": {
"name": "Proton Mail",
"imap_ssl": {"host": "127.0.0.1", "port": 1143},
"pop3_ssl": {"host": "127.0.0.1", "port": 1144},
},
}
@classmethod