chore(deploy): document webhook URL via NPM proxy
Gitea hook #28 now delivers to http://forwarder-hook.bitreport.pt/ (NPM CT 102 → 10.10.50.43:9090) instead of direct VLAN IP, as Gitea VLAN 1010 cannot route to VLAN 1050 directly. Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
commit
41ba0befe6
2 files changed
+49
No files matched your search
@@ -63,3 +63,4 @@ log "Building API + worker ($GIT_SHA)"
|
||||
$COMPOSE build deploy-hook
|
||||
nohup $COMPOSE up -d --force-recreate deploy-hook &
|
||||
} >> "$LOG_FILE" 2>&1
|
||||
# webhook: http://forwarder-hook.bitreport.pt/ (NPM proxy, commit 2026-07-01T01:13:13Z)
|
||||
@@ -1,8 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Query, status
|
||||
|
||||
from forwarder.api.deps import CurrentUser, DbSession
|
||||
from forwarder.api.routes.connection import ConnectionTestResult
|
||||
from forwarder.api.schemas import (
|
||||
AccountCreate,
|
||||
AccountResponse,
|
||||
@@ -11,6 +14,9 @@ from forwarder.api.schemas import (
|
||||
InlineConnectionConfig,
|
||||
SyncRunResponse,
|
||||
)
|
||||
from forwarder.crypto import decrypt_password
|
||||
from forwarder.email.imap_client import ImapConfig, test_imap_connection
|
||||
from forwarder.email.smtp_client import SmtpConfig, test_smtp_connection
|
||||
from forwarder.services import account_service
|
||||
from forwarder.services.sync_service import sync_account
|
||||
|
||||
@@ -122,6 +128,48 @@ def _inline_dict(inline: InlineConnectionConfig | None) -> dict | None:
|
||||
return data
|
||||
|
||||
|
||||
@router.post("/{account_id}/test", response_model=ConnectionTestResult)
|
||||
def test_account(
|
||||
account_id: int,
|
||||
db: DbSession,
|
||||
_user: CurrentUser,
|
||||
) -> ConnectionTestResult:
|
||||
"""Run IMAP + SMTP tests for a saved account (combined result for the UI)."""
|
||||
try:
|
||||
account = account_service.get_account(db, account_id)
|
||||
except account_service.AccountNotFoundError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
imap_cfg = ImapConfig(
|
||||
host=account.imap_host,
|
||||
port=account.imap_port,
|
||||
user=account.imap_user,
|
||||
password=decrypt_password(account.imap_password_encrypted),
|
||||
)
|
||||
smtp_cfg = SmtpConfig(
|
||||
host=account.smtp_host,
|
||||
port=account.smtp_port,
|
||||
user=account.smtp_user,
|
||||
password=decrypt_password(account.smtp_password_encrypted),
|
||||
use_tls=account.smtp_use_tls,
|
||||
)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=2) as executor:
|
||||
imap_future = executor.submit(test_imap_connection, imap_cfg)
|
||||
smtp_future = executor.submit(test_smtp_connection, smtp_cfg)
|
||||
imap_ok, imap_msg = imap_future.result()
|
||||
smtp_ok, smtp_msg = smtp_future.result()
|
||||
|
||||
return ConnectionTestResult(
|
||||
imap_ok=imap_ok,
|
||||
imap_error=None if imap_ok else imap_msg,
|
||||
smtp_ok=smtp_ok,
|
||||
smtp_error=None if smtp_ok else smtp_msg,
|
||||
bizdocs_ok=True,
|
||||
bizdocs_error=None,
|
||||
)
|
||||
|
||||
|
||||
@router.post("/{account_id}/test/imap", response_model=ConnectionTestResponse)
|
||||
def test_imap(
|
||||
account_id: int,
|
||||
|
||||
Reference in new issue
Block a user