diff --git a/crates/admin/src/meta.rs b/crates/admin/src/meta.rs index e23edb6..dfd9118 100644 --- a/crates/admin/src/meta.rs +++ b/crates/admin/src/meta.rs @@ -255,7 +255,6 @@ impl From for AccountModel { created_at: value.created_at, updated_at: value.updated_at, created_by: value.created_by, - use_proxy: value.use_proxy, use_dangerous: value.use_dangerous, pgp_key: value.pgp_key, imap_quota_window: None, diff --git a/crates/core/src/account/migration.rs b/crates/core/src/account/migration.rs index cb3ea52..ed0bcfa 100644 --- a/crates/core/src/account/migration.rs +++ b/crates/core/src/account/migration.rs @@ -300,7 +300,6 @@ pub struct Account { pub created_at: i64, pub updated_at: i64, pub created_by: u64, //user id - pub use_proxy: Option, pub use_dangerous: bool, pub pgp_key: Option, pub imap_quota_bytes: Option, @@ -345,7 +344,6 @@ impl Account { download_interval_min: request.download_interval_min, created_at: utc_now!(), updated_at: utc_now!(), - use_proxy: request.use_proxy, use_dangerous: request.use_dangerous, pgp_key: request.pgp_key, created_by: user_id, @@ -657,10 +655,6 @@ impl Account { if let Some(max_email_size_bytes) = request.max_email_size_bytes { new.max_email_size_bytes = Some(max_email_size_bytes); } - - if let Some(use_proxy) = request.use_proxy { - new.use_proxy = Some(use_proxy); - } } if matches!(old.account_type, AccountType::NoSync) { diff --git a/crates/core/src/account/payload.rs b/crates/core/src/account/payload.rs index b2c55f7..9494abc 100644 --- a/crates/core/src/account/payload.rs +++ b/crates/core/src/account/payload.rs @@ -51,7 +51,6 @@ pub struct AccountCreateRequest { )] pub download_batch_size: Option, pub max_email_size_bytes: Option, - pub use_proxy: Option, pub use_dangerous: bool, pub pgp_key: Option, pub imap_quota_bytes: Option, @@ -188,11 +187,6 @@ pub struct AccountUpdateRequest { )] pub download_batch_size: Option, pub max_email_size_bytes: Option, - /// Optional proxy ID for establishing the connection to external APIs (e.g., Gmail, Outlook). - /// - If `None` or not provided, the client will connect directly to the API server. - /// - If `Some(proxy_id)`, the client will use the pre-configured proxy with the given ID for API requests. - pub use_proxy: Option, - pub use_dangerous: Option, pub pgp_key: Option, diff --git a/crates/core/src/account/view.rs b/crates/core/src/account/view.rs index 6d9d9c7..d800f0b 100644 --- a/crates/core/src/account/view.rs +++ b/crates/core/src/account/view.rs @@ -51,7 +51,6 @@ pub struct AccountResp { pub created_by: u64, //user id pub created_user_name: String, pub created_user_email: String, - pub use_proxy: Option, pub use_dangerous: bool, pub pgp_key: Option, pub imap_quota_bytes: Option, @@ -90,7 +89,6 @@ impl AccountResp { created_user_email: user .map(|u| u.email.clone()) .unwrap_or_else(|| "N/A".to_string()), - use_proxy: account.use_proxy, use_dangerous: account.use_dangerous, pgp_key: account.pgp_key, imap_quota_bytes: account.imap_quota_bytes, diff --git a/docker/Dockerfile b/docker/Dockerfile index 1e1e6d3..0698988 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -38,6 +38,6 @@ EXPOSE 15630 WORKDIR /data HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ - CMD curl -fs http://localhost:15630/api/status || exit 1 + CMD curl -fs http://localhost:${BICHON_HTTP_PORT:-15630}/api/status || exit 1 CMD ["/opt/bichon/bichon-server"] diff --git a/web/src/api/account/api.ts b/web/src/api/account/api.ts index f3e4eb7..7be68c5 100644 --- a/web/src/api/account/api.ts +++ b/web/src/api/account/api.ts @@ -152,7 +152,6 @@ export interface AccountModel { created_user_email: string; created_at: number; updated_at: number; - use_proxy?: number; use_dangerous: boolean; pgp_key?: string; imap_quota_window?: QuotaWindow; diff --git a/web/src/features/accounts/account-new.tsx b/web/src/features/accounts/account-new.tsx index 5350329..70e6cdc 100644 --- a/web/src/features/accounts/account-new.tsx +++ b/web/src/features/accounts/account-new.tsx @@ -111,12 +111,14 @@ export function AccountNewPage() { const onSubmit = useCallback( (data: AccountFormValues) => { + const { use_proxy, ...imapRest } = data.imap; createMutation.mutate({ email: data.email, account_name: data.account_name, login_name: data.login_name, imap: { - ...data.imap, + ...imapRest, + use_proxy, auth: { ...data.imap.auth, password: data.imap.auth.auth_type === 'OAuth2' ? undefined : data.imap.auth.password, diff --git a/web/src/features/accounts/account-settings-page.tsx b/web/src/features/accounts/account-settings-page.tsx index 8857fbe..1b93179 100644 --- a/web/src/features/accounts/account-settings-page.tsx +++ b/web/src/features/accounts/account-settings-page.tsx @@ -44,15 +44,12 @@ const emptyImap = { port: 0, encryption: "None" as const, auth: { auth_type: "Password" as const, password: undefined }, - use_proxy: undefined, + use_proxy: null, }; function mapAccountToFormValues(account: AccountModel): AccountFormValues { const imap = { ...(account.imap ?? emptyImap) }; imap.auth = { ...imap.auth, password: undefined }; - if ((imap as any).use_proxy === null) { - (imap as any).use_proxy = undefined; - } return { account_name: account.account_name ?? undefined, @@ -137,12 +134,14 @@ export function AccountSettingsPage({ accountId }: AccountSettingsPageProps) { const onSubmit = useCallback( (data: AccountFormValues) => { + const { use_proxy, ...imapRest } = data.imap; const payload: Record = { email: data.email, account_name: data.account_name, login_name: data.login_name, imap: { - ...data.imap, + ...imapRest, + use_proxy, auth: { ...data.imap.auth, password: data.imap.auth.auth_type === 'OAuth2' diff --git a/web/src/features/accounts/components/tab-server.tsx b/web/src/features/accounts/components/tab-server.tsx index 44f9121..9e9c91a 100644 --- a/web/src/features/accounts/components/tab-server.tsx +++ b/web/src/features/accounts/components/tab-server.tsx @@ -37,6 +37,7 @@ import { } from "@/components/ui/select"; import { PasswordInput } from "@/components/password-input"; import { AccountFormValues } from "./schema"; +import useProxyList from "@/hooks/use-proxy"; interface TabServerProps { isEdit?: boolean; @@ -46,6 +47,7 @@ export function TabServer({ isEdit }: TabServerProps) { const { t } = useTranslation(); const { control, watch } = useFormContext(); const authType = watch('imap.auth.auth_type'); + const { proxyOptions } = useProxyList(); return (
@@ -161,6 +163,38 @@ export function TabServer({ isEdit }: TabServerProps) { /> )} + ( + + {t('accounts.useProxyOptional')} + + {t('accounts.imapProxy')} + + + )} + /> +