Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

New dedicated IP function on domain page

zdm8b63fb17becb
diff --git a/core/frontend/build/config.ts b/core/frontend/build/config.ts
index 143b98de..0c0b76fe 100644
--- a/core/frontend/build/config.ts
+++ b/core/frontend/build/config.ts
@@ -22,7 +22,7 @@ const serverConfig: Record<string, ServerConfig> = {
},
'103.179.242.193': {
https: true,
- address: 'https://103.179.242.193',
+ address: 'https://103.179.242.193:4433',
host: '103.179.242.193',
},
}
diff --git a/core/frontend/src/api/modules/domain.ts b/core/frontend/src/api/modules/domain.ts
index bcf9402f..39c8213f 100644
--- a/core/frontend/src/api/modules/domain.ts
+++ b/core/frontend/src/api/modules/domain.ts
@@ -11,12 +11,17 @@ export const getDomainAll = () => {
return instance.get('/domains/all')
}
+export const getDomainIpCommand = () => {
+ return instance.post('/multi_ip_domain/apply')
+}
+
type DomainParams = {
domain: string
quota: number
mailboxes: number
email: string
urls: string[]
+ outbound_ip: string
hasbrandinfo?: number
}
@@ -87,16 +92,24 @@ export const setDefaultDomain = (params: { domain: string }) => {
})
}
-
-export const initAiConfiguration = (params: { domain: string, urls: string[] }) => {
- return instance.post("/askai/project/create", params, {
+export const initAiConfiguration = (params: { domain: string; urls: string[] }) => {
+ return instance.post('/askai/project/create', params, {
fetchOptions: {
loading: 'Setting domain brand info , please wait...',
successMessage: true,
- }
+ },
})
}
export const checkAiConfiguration = () => {
- return instance.post("/askai/supplier/status")
-}
\ No newline at end of file
+ return instance.post('/askai/supplier/status')
+}
+
+export const testConnection = (params: { domain: string; outbound_ip: string }) => {
+ return instance.post('/multi_ip_domain/test', params, {
+ fetchOptions: {
+ loading: 'Testing connection, please wait...',
+ successMessage: true,
+ },
+ })
+}
diff --git a/core/frontend/src/hooks/useCopy.ts b/core/frontend/src/hooks/useCopy.ts
index 28af4081..7c0b7368 100644
--- a/core/frontend/src/hooks/useCopy.ts
+++ b/core/frontend/src/hooks/useCopy.ts
@@ -9,7 +9,7 @@ export const useCopy = () => {
legacy: true,
})
- const copyText = async (value: string) => {
+ const copyText = async (value: string, showSuccess = true) => {
if (!value) {
Message.error(t('common.useCopy.noText'))
return
@@ -17,7 +17,7 @@ export const useCopy = () => {
if (isSupported.value) {
await copy(value)
- Message.success(t('common.useCopy.success'))
+ if (showSuccess) Message.success(t('common.useCopy.success'))
} else {
Message.error(t('common.useCopy.failed'))
}
diff --git a/core/frontend/src/i18n/lang/ja.json b/core/frontend/src/i18n/lang/ja.json
index ee9f000b..01e14a78 100644
--- a/core/frontend/src/i18n/lang/ja.json
+++ b/core/frontend/src/i18n/lang/ja.json
@@ -691,7 +691,8 @@
},
"edit": {
"domainConfiguration": {
- "createNow": "Create Immediately"
+ "createNow": "Create Immediately",
+ "catchAll": "Catch all"
}
}
},
diff --git a/core/frontend/src/i18n/lang/zh.json b/core/frontend/src/i18n/lang/zh.json
index 2f700b66..3f635cfe 100644
--- a/core/frontend/src/i18n/lang/zh.json
+++ b/core/frontend/src/i18n/lang/zh.json
@@ -826,7 +826,7 @@
"domain": "域名",
"domainQuota": "域名配额",
"mailboxCount": "邮箱数量",
- "catchAll": "全部接收",
+ "catchAll": "Catch all",
"autoCreateBrand": "自动创建品牌信息",
"aiIntegrationWarning": "要使用此功能,您需要先集成AI模型。",
"integrateImmediately": "立即集成",
@@ -839,7 +839,9 @@
},
"specifyDomain": "指定域名",
"addMoreUrls": "添加更多URL",
- "createNow": "Create Immediately"
+ "createNow": "Create Immediately",
+ "brandInfo": "Brand information",
+ "noBrandInfo": "No brand information available."
},
"projectDetails": {
"title": "项目详情",
diff --git a/core/frontend/src/styles/variables.scss b/core/frontend/src/styles/variables.scss
index 56cb08f7..519ed180 100644
--- a/core/frontend/src/styles/variables.scss
+++ b/core/frontend/src/styles/variables.scss
@@ -25,6 +25,7 @@
--color-button-text-1: #ffffff;
--color-table-th-1: rgba(250, 250, 252, 1);
--color-table-td-1: #ffffff;
+ --color-command: #101010;
}
:root[theme-mode='dark'] {
@@ -54,4 +55,5 @@
--color-button-text-1: #ffffff;
--color-table-th-1: #2c2c2c;
--color-table-td-1: #242424;
+ --color-command: #101010;
}
diff --git a/core/frontend/src/views/domain/components/DomainForm.vue b/core/frontend/src/views/domain/components/DomainForm.vue
index 644b8bd5..5c455d6e 100644
--- a/core/frontend/src/views/domain/components/DomainForm.vue
+++ b/core/frontend/src/views/domain/components/DomainForm.vue
@@ -18,12 +18,11 @@
</n-popover>
</div>
</template>
- <n-input v-model:value="form.domain" :disabled="isEdit"
- :placeholder="t('domain.form.domainPlaceholder')" @update:value="syncToUrls">
- </n-input>
- </n-form-item>
- <n-form-item v-if="false" label="A记录">
- <n-input v-model:value="form.a_record" :disabled="isEdit" placeholder="请输入A记录,例如:mail.aapanel.com">
+ <n-input
+ v-model:value="form.domain"
+ :disabled="isEdit"
+ :placeholder="t('domain.form.domainPlaceholder')"
+ @update:value="syncToUrls">
</n-input>
</n-form-item>
<n-form-item :label="t('domain.form.quota')">
@@ -34,46 +33,70 @@
</div>
</n-form-item>
<n-form-item :label="t('domain.form.mailboxCount')">
- <n-input-number v-model:value="form.mailboxes" class="flex-1" :min="0" :show-button="false">
+ <n-input-number
+ v-model:value="form.mailboxes"
+ class="flex-1"
+ :min="0"
+ :show-button="false">
</n-input-number>
</n-form-item>
+ <n-form-item label="域名专用IP">
+ <div class="flex-1 mr-16px">
+ <n-input v-model:value="form.outbound_ip" placeholder="未设置"> </n-input>
+ </div>
+ <n-button type="primary" ghost @click="onTestConnection">连接测试</n-button>
+ </n-form-item>
<n-form-item :label="t('domain.form.globalCatch')">
- <n-input v-model:value="form.email" :placeholder="t('domain.form.globalCatchPlaceholder')">
+ <n-input
+ v-model:value="form.email"
+ :placeholder="t('domain.form.globalCatchPlaceholder')">
</n-input>
</n-form-item>
<n-form-item>
<template #label>
- <div class="flex justify-start items-center ">
- <i class="i-domain:brand-info w-5 h-5 mr-1.25 "></i>
- <span>{{ $t("domain.form.createBrandInfo") }}</span>
+ <div class="flex justify-start items-center">
+ <i class="i-domain:brand-info w-5 h-5 mr-1.25"></i>
+ <span>{{ $t('domain.form.createBrandInfo') }}</span>
</div>
</template>
<n-switch v-model:value="initAi" :disabled="!aiConfigurationStatus"></n-switch>
</n-form-item>
- <n-alert v-if="!aiConfigurationStatus" style="margin: 0 0 15px 0" type="warning" :show-icon="false">
+ <n-alert
+ v-if="!aiConfigurationStatus"
+ class="mb-16px"
+ size="small"
+ type="warning"
+ :show-icon="false">
<div class="w-100% flex justify-between items-center">
- <span class="mr-5">{{ $t("domain.form.modelNotice") }}</span>
- <n-button type="primary" @click="goIntegrate">{{ $t("domain.form.integrateImmediately") }}</n-button>
+ <span class="mr-5">{{ $t('domain.form.modelNotice') }}</span>
+ <n-button type="primary" size="small" @click="goIntegrate">
+ {{ $t('domain.form.integrateImmediately') }}
+ </n-button>
</div>
</n-alert>
<div class="text-[#777] flex justify-start">
<span><i class="i-domain:brand-info w-5 h-5 mr-1.25"></i></span>
- <span>{{ $t("domain.form.modelDescription") }}</span>
+ <span>{{ $t('domain.form.modelDescription') }}</span>
</div>
<bt-tips style="margin-bottom: 15px">
- <li>{{ $t("domain.form.extractBrand") }}</li>
- <li>{{ $t("domain.form.analyzeStructure") }}</li>
- <li>{{ $t("domain.form.importContent") }}</li>
- <li>{{ $t("domain.form.customLogo") }}</li>
+ <li>{{ $t('domain.form.extractBrand') }}</li>
+ <li>{{ $t('domain.form.analyzeStructure') }}</li>
+ <li>{{ $t('domain.form.importContent') }}</li>
+ <li>{{ $t('domain.form.customLogo') }}</li>
</bt-tips>
<n-form-item :label="$t('domain.form.specifyDomain')">
<div class="w-100% flex flex-col gap-2.5">
<!-- <n-input v-for="(item, index) in urls" :key="index" v-model:value="urls[index]" placeholder="">
</n-input> -->
- <div v-for="(_, index) in urls" :key="index" class="flex justify-start items-center gap-2.5">
- <n-input v-model:value="urls[index]"
- :placeholder="t('domain.form.urlsPlacement')" :disabled="!aiConfigurationStatus"></n-input>
+ <div
+ v-for="(_, index) in urls"
+ :key="index"
+ class="flex justify-start items-center gap-2.5">
+ <n-input
+ v-model:value="urls[index]"
+ :placeholder="t('domain.form.urlsPlacement')"
+ :disabled="!aiConfigurationStatus"></n-input>
<div v-if="index != 0" class="close" @click="removeUrl(index)">
<i class="i-material-symbols:close-rounded text-5"></i>
</div>
@@ -95,20 +118,19 @@
<!-- Wait for init brand info -->
<WaitAndCheckDomainStatus ref="waitAndCheckDomainStatusRef" />
-
-
</template>
<script lang="ts" setup>
import WaitAndCheckDomainStatus from './WaitAndCheckDomainStatus.vue'
import { FormRules } from 'naive-ui'
-import { getByteUnit, getNumber } from '@/utils'
+import { getByteUnit, getNumber, Message } from '@/utils'
import { useModal } from '@/hooks/modal/useModal'
import {
createDomain,
initAiConfiguration,
updateDomain,
checkAiConfiguration,
+ testConnection,
} from '@/api/modules/domain'
import type { MailDomain } from '../interface'
import router from '@/router'
@@ -123,17 +145,23 @@ const title = computed(() => {
return isEdit.value ? t('domain.form.editTitle') : t('domain.form.addTitle')
})
-const aiConfigurationStatus = ref(false)
const globalStore = useGlobalStore()
+
+const aiConfigurationStatus = ref(false)
+
const formRef = useTemplateRef('formRef')
+
const initAi = ref(false)
+
const urls = ref(['https://'])
+
const form = reactive({
domain: '',
a_record: '',
quota: 5,
quota_unit: 'GB',
mailboxes: 50,
+ outbound_ip: '',
email: '',
})
@@ -196,6 +224,24 @@ const removeUrl = (index: number) => {
urls.value.splice(index, 1)
}
+/**
+ * @description Test connection
+ */
+const onTestConnection = async () => {
+ if (form.domain == '') {
+ Message.error('请先输入域名')
+ return
+ }
+ if (form.outbound_ip == '') {
+ Message.error('请先输入域名专用IP')
+ return
+ }
+ await testConnection({
+ domain: form.domain,
+ outbound_ip: form.outbound_ip,
+ })
+}
+
const [Modal, modalApi] = useModal({
onChangeState: async isOpen => {
if (isOpen) {
@@ -220,6 +266,7 @@ const [Modal, modalApi] = useModal({
form.quota_unit = 'GB'
form.mailboxes = 50
form.email = ''
+ form.outbound_ip = ''
urls.value = ['https://']
}
},
@@ -232,6 +279,7 @@ const [Modal, modalApi] = useModal({
mailboxes: form.mailboxes,
email: form.email,
urls: urls.value,
+ outbound_ip: form.outbound_ip,
})
} else {
await createDomain({
@@ -240,9 +288,10 @@ const [Modal, modalApi] = useModal({
mailboxes: form.mailboxes,
email: form.email,
urls: urls.value,
- hasbrandinfo:Number(initAi.value),
+ hasbrandinfo: Number(initAi.value),
+ outbound_ip: form.outbound_ip,
})
-
+
// Init Ai configuration (via. src\api\modules\domain.ts)
if (initAi.value) {
await initAiConfiguration({
@@ -251,24 +300,21 @@ const [Modal, modalApi] = useModal({
})
waitAndCheckDomainStatusRef.value.open(form.domain)
globalStore.domainSource = form.domain
- }else{
- globalStore.domainSource = ""
+ } else {
+ globalStore.domainSource = ''
}
-
}
const state = modalApi.getState<{ refresh: Function }>()
state.refresh()
},
})
-
-
/**
* @description Go to integrate AI model
*/
function goIntegrate() {
router.push({
- name: "AiModel"
+ name: 'AiModel',
})
}
</script>
diff --git a/core/frontend/src/views/domain/components/DomainIpSet.vue b/core/frontend/src/views/domain/components/DomainIpSet.vue
new file mode 100644
index 00000000..5be2be2b
--- /dev/null
+++ b/core/frontend/src/views/domain/components/DomainIpSet.vue
@@ -0,0 +1,127 @@
+<template>
+ <modal :title="title" :width="500" :footer="false">
+ <div class="pt-16px px-16px text-basic">
+ <div class="flex justify-between items-center mb-16px">
+ <div>专用IP:{{ ip }}</div>
+ <div class="flex items-center">
+ 配置文件:
+ <ip-status :status="configStatus"></ip-status>
+ </div>
+ <div class="flex items-center">
+ 连接状态:
+ <ip-status :status="connectStatus"></ip-status>
+ </div>
+ </div>
+ <n-alert class="mb-16px" type="warning" :show-icon="false" :bordered="false">
+ 你可以通过手工在SSH终端执行以下命令使专用IP连接状态激活
+ 如果你有多个域名需要配置专用IP,我们建议你先把所有域名配
+ 置完成后在执行以下命令,避免邮件服务器多次中断
+ </n-alert>
+
+ <n-spin size="small" :show="loading">
+ <n-alert class="command-alert mb-16px" :show-icon="false" :bordered="false">
+ {{ command || '--' }}
+ </n-alert>
+ </n-spin>
+
+ <div class="flex justify-center gap-16px">
+ <n-button type="primary" :loading="loading" :disabled="loading" @click="getCommand">
+ 获取命令
+ </n-button>
+ <n-button @click="onCopyCommand">复制命令</n-button>
+ </div>
+ </div>
+
+ <bt-modal v-model:show="showModal" :width="420" title="操作提醒" :footer="false">
+ <n-alert class="mb-16px" type="warning" :show-icon="false" :bordered="false">
+ 如果执行命令失败,您可以执行该命令进行修复:<br />"{{ fixCommand }}"
+ </n-alert>
+ <div class="flex justify-center">
+ <n-button type="primary" @click="showModal = false">我知道了</n-button>
+ </div>
+ </bt-modal>
+ </modal>
+</template>
+
+<script lang="ts" setup>
+import { isObject, Message } from '@/utils'
+import { useCopy } from '@/hooks/useCopy'
+import { useModal } from '@/hooks/modal/useModal'
+import { getDomainIpCommand } from '@/api/modules/domain'
+import { MailDomain } from '../interface'
+import IpStatus from './IpStatus.vue'
+
+const domain = ref('')
+
+const ip = ref('')
+
+const status = ref('')
+
+const configStatus = computed(() => {
+ if (status.value === 'failed') return 'failed'
+ return 'applied'
+})
+
+const connectStatus = computed(() => {
+ if (status.value === 'applied') return 'applied'
+ return 'failed'
+})
+
+const title = computed(() => {
+ return domain.value ? `专用IP设置【${domain.value}】` : '专用IP设置'
+})
+
+const loading = ref(false)
+
+const isFetchCommand = ref(false)
+
+const command = ref('')
+
+const fixCommand = ref('')
+
+const getCommand = async () => {
+ try {
+ loading.value = true
+ const res = await getDomainIpCommand()
+ if (isObject<{ command: string; fix_command: string }>(res)) {
+ command.value = res.command
+ fixCommand.value = res.fix_command
+ isFetchCommand.value = true
+ }
+ } finally {
+ loading.value = false
+ }
+}
+
+const showModal = ref(false)
+
+const { copyText } = useCopy()
+
+const onCopyCommand = () => {
+ if (!isFetchCommand.value) {
+ Message.error('请先获取命令')
+ return
+ }
+
+ copyText(command.value, false)
+ showModal.value = true
+}
+
+const [Modal, modalApi] = useModal({
+ onChangeState: isOpen => {
+ if (isOpen) {
+ const { row } = modalApi.getState<{ row: MailDomain }>()
+ domain.value = row.domain
+ ip.value = row.multi_ip_domains?.outbound_ip || ''
+ status.value = row.multi_ip_domains?.status || ''
+ }
+ },
+})
+</script>
+
+<style lang="scss" scoped>
+.command-alert {
+ --n-color: var(--color-command);
+ --n-content-text-color: #fff;
+}
+</style>
diff --git a/core/frontend/src/views/domain/components/IpStatus.vue b/core/frontend/src/views/domain/components/IpStatus.vue
new file mode 100644
index 00000000..93911180
--- /dev/null
+++ b/core/frontend/src/views/domain/components/IpStatus.vue
@@ -0,0 +1,29 @@
+<template>
+ <div class="inline-flex items-center text-16px">
+ <template v-if="status === 'applied'">
+ <i class="i-tdesign:check-circle-filled text-primary"></i>
+ </template>
+ <template v-if="status === 'failed'">
+ <div class="inline-flex flex-center w-16px h-16px bg-error rounded-full">
+ <i class="i-fa-solid:unlink text-#fff text-10px"></i>
+ </div>
+ </template>
+ <template v-if="status === 'pending'">
+ <i class="i-tdesign:time-filled text-desc"></i>
+ </template>
+ <template v-if="status === 'applying'">
+ <n-spin :show="true" :size="16"></n-spin>
+ </template>
+ </div>
+</template>
+
+<script lang="ts" setup>
+defineProps({
+ status: {
+ type: String,
+ default: 'pending',
+ },
+})
+</script>
+
+<style lang="scss" scoped></style>
diff --git a/core/frontend/src/views/domain/index.vue b/core/frontend/src/views/domain/index.vue
index ab24bf5d..0133e255 100644
--- a/core/frontend/src/views/domain/index.vue
+++ b/core/frontend/src/views/domain/index.vue
@@ -26,6 +26,7 @@
<form-modal />
<ssl-modal />
<dns-modal />
+ <domain-ip-set-modal />
</template>
</bt-table-layout>
</div>
@@ -42,6 +43,8 @@ import type { MailDomain, MailDomainParams } from './interface'
import DomainForm from './components/DomainForm.vue'
import DomainSsl from './components/DomainSsl/index.vue'
import DomainDns from './components/DomainDns.vue'
+import DomainIpSet from './components/DomainIpSet.vue'
+import IpStatus from './components/IpStatus.vue'
const { t } = useI18n()
@@ -58,8 +61,8 @@ const { tableParams, tableList, loading, tableTotal, getTableData } = useTableDa
fetchFn: getDomainList,
})
-const router = useRouter()
const route = useRoute()
+const router = useRouter()
// Table columns
const columns = ref<DataTableColumns<MailDomain>>([
@@ -71,23 +74,18 @@ const columns = ref<DataTableColumns<MailDomain>>([
tooltip: true,
},
render: row => {
- // <i class="i-domain:brand-info w-5 h-5 mr-1.25"></i>
return (
- <>
- <div class="inline-flex items-center">
- {row.hasbrandinfo == 1 && <i class="i-domain:brand-info w-4 h-4 mr-1.25"></i>}
- <NButton text type="primary" onClick={() => handleEdit(row)}>
- {row.domain}
- </NButton>
- </div>
- {row.default ? (
+ <div class="inline-flex items-center">
+ {row.hasbrandinfo == 1 && <i class="i-domain:brand-info w-4 h-4 mr-4px"></i>}
+ <NButton text type="primary" onClick={() => handleEdit(row)}>
+ {row.domain}
+ </NButton>
+ {row.default === 1 && (
<NTag size="small" class="ml-8px" bordered={false}>
Default
</NTag>
- ) : (
- ''
)}
- </>
+ </div>
)
},
},
@@ -122,6 +120,25 @@ const columns = ref<DataTableColumns<MailDomain>>([
// />
// ),
// },
+ {
+ key: 'multi_ip_domains',
+ title: '专用IP',
+ render: row => {
+ if (row.multi_ip_domains) {
+ return (
+ <div
+ class="flex items-center cursor-pointer"
+ onClick={() => {
+ handleMultiIpDomains(row)
+ }}>
+ <span class="leading-14px mr-6px">{row.multi_ip_domains.outbound_ip}</span>
+ <IpStatus status={row.multi_ip_domains.status}></IpStatus>
+ </div>
+ )
+ }
+ return '--'
+ },
+ },
{
key: 'ssl',
title: 'SSL',
@@ -264,12 +281,6 @@ const handleSetDefault = (row: MailDomain) => {
// Handle edit
const handleEdit = (row: MailDomain) => {
- /* formModalApi.setState({
- row,
- isEdit: true,
- })
- formModalApi.open() */
-
router.push({
name: 'EditDomain',
params: {
@@ -278,6 +289,16 @@ const handleEdit = (row: MailDomain) => {
})
}
+const [DomainIpSetModal, domainIpSetModalApi] = useModal({
+ component: DomainIpSet,
+})
+
+// Handle multi ip domains
+const handleMultiIpDomains = (row: MailDomain) => {
+ domainIpSetModalApi.setState({ row })
+ domainIpSetModalApi.open()
+}
+
// Handle delete
const handleDelete = (row: MailDomain) => {
confirm({
diff --git a/core/frontend/src/views/domain/interface.ts b/core/frontend/src/views/domain/interface.ts
index b0555350..877b9d96 100644
--- a/core/frontend/src/views/domain/interface.ts
+++ b/core/frontend/src/views/domain/interface.ts
@@ -16,8 +16,27 @@ export interface MailDomain {
default: number
email: string
hasbrandinfo: number
+ urls: string[]
dns_records: DomainDnsRecords
cert_info: DomainCertInfo
+ multi_ip_domains: DomainMultiIp | null
+}
+
+export interface DomainMultiIp {
+ id: number
+ domain: string
+ outbound_ip: string
+ network_name: string
+ subnet: string
+ postfix_ip: string
+ aliases: string
+ smtp_server_name: string
+ active: number
+ create_time: number
+ update_time: number
+ status: string
+ repair_command: string
+ utility_command: string
}
export type DomainDnsRecords = {
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue b/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
index b68ba392..e8e4fbdf 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/DomainConfiguration.vue
@@ -5,47 +5,57 @@
<div class="page-tit mb-5">
<div class="left-tit">
<div class="back-tool">
- <i class="i-cuida:mail-outline text-7"></i>
+ <i class="i-cuida:mail-outline text-28px"></i>
</div>
<span class="tit-content">{{ $t('domain.edit.domainConfiguration.title') }}</span>
</div>
</div>
<!-- form data -->
<n-form>
- <n-form-item>
- <template #label
- ><span class="form-label">{{
- $t('domain.edit.domainConfiguration.domain')
- }}</span></template
- >
+ <n-form-item :label="$t('domain.edit.domainConfiguration.domain')">
<n-input v-model:value="domainTit" :disabled="true" @input="syncToUrl"></n-input>
</n-form-item>
- <n-form-item label="">
- <template #label
- ><span class="form-label">{{
- $t('domain.edit.domainConfiguration.domainQuota')
- }}</span></template
- >
- <div class="flex justify-between gap-5 items-center w-100%">
- <n-input v-model:value="quota"></n-input>
- <n-select v-model:value="unit" :options="uinitOptions" class="w-20"></n-select>
+ <n-form-item label="域名专用IP">
+ <div class="flex-1">
+ <div class="mb-12px text-desc">
+ * 域名 aapanel.com
+ 发送和接受邮件时会在iptables处指定此专属IP,如果你的服务器只有一个IP的话不需要设置此功能
+ </div>
+ <div class="flex gap-16px">
+ <div class="flex-1">
+ <n-input v-model:value="domainIp" placeholder="未设置"></n-input>
+ </div>
+ <n-button type="primary" ghost @click="testConnection">连接测试</n-button>
+ </div>
</div>
</n-form-item>
- <n-form-item>
- <template #label
- ><span class="form-label">{{
- $t('domain.edit.domainConfiguration.mailboxCount')
- }}</span></template
- >
- <n-input-number v-model:value="mailboxes" :show-button="false"></n-input-number>
+ <n-form-item :label="$t('domain.edit.domainConfiguration.catchAll')">
+ <div class="flex-1">
+ <div class="mb-12px text-desc">
+ * 在您这里填写邮箱后,这个域名下所有未知的邮箱收到邮件将会转发到这个邮箱里面
+ </div>
+ <n-input v-model:value="catch_email"></n-input>
+ </div>
</n-form-item>
- <n-form-item>
- <template #label
- ><span class="form-label">{{
- $t('domain.edit.domainConfiguration.catchAll')
- }}</span></template
- >
- <n-input v-model:value="catch_email"></n-input>
+ <n-form-item :label="$t('domain.edit.domainConfiguration.domainQuota')">
+ <div class="flex-1">
+ <div class="mb-12px text-desc">* 设置此域名的可用空间</div>
+ <div class="flex gap-16px">
+ <div class="flex-1">
+ <n-input v-model:value="quota"></n-input>
+ </div>
+ <div class="w-80px">
+ <n-select v-model:value="unit" :options="uintOptions"></n-select>
+ </div>
+ </div>
+ </div>
+ </n-form-item>
+ <n-form-item :label="$t('domain.edit.domainConfiguration.mailboxCount')">
+ <div class="flex-1">
+ <div class="mb-12px text-desc">* 设置此域名可以创建多少个邮箱</div>
+ <n-input-number v-model:value="mailboxes" class="w-full" :show-button="false">
+ </n-input-number>
+ </div>
</n-form-item>
</n-form>
</n-card>
@@ -87,15 +97,15 @@
</div>
<n-alert v-if="!supplierStatus" type="warning" class="mb-15px" :show-icon="false">
<div class="w-100% flex justify-between items-center">
- <span class="mr-5">{{
- $t('domain.edit.domainConfiguration.aiIntegrationWarning')
- }}</span>
- <n-button ghost type="primary" @click="jumpToAiSettings">{{
- $t('domain.edit.domainConfiguration.integrateImmediately')
- }}</n-button>
+ <span class="mr-5">
+ {{ $t('domain.edit.domainConfiguration.aiIntegrationWarning') }}
+ </span>
+ <n-button ghost type="primary" @click="jumpToAiSettings">
+ {{ $t('domain.edit.domainConfiguration.integrateImmediately') }}
+ </n-button>
</div>
</n-alert>
- <div class="text-[#777]">
+ <div class="mb-8px text-default">
{{ $t('domain.edit.domainConfiguration.aiDescription') }}
</div>
<bt-tips style="margin-bottom: 15px">
@@ -128,7 +138,7 @@
</n-button> -->
</div>
</n-form-item>
- <n-button type="primary" @click="createBrandInfo">
+ <n-button type="primary" ghost @click="createBrandInfo">
{{ $t('domain.edit.domainConfiguration.createNow') }}
</n-button>
</n-card>
@@ -155,12 +165,17 @@ import {
createBrandInfo,
switchBrandInfo,
updateDomain,
+ testConnection,
} from '../controller/domainConfiguration.controller'
import { getEditDomainStoreData } from '../store'
+
const router = useRouter()
+
const supplierStatus = ref(false)
+
const {
domainTit,
+ domainIp,
quota,
unit,
mailboxes,
@@ -170,9 +185,12 @@ const {
createdBrandInfo,
waitAndCheckDomainStatusRef,
} = getEditDomainStoreData()
+
const route = useRoute()
+
const domain = route.params.domain as any
-const uinitOptions = ref([
+
+const uintOptions = ref([
{
label: 'B',
value: 'B',
@@ -194,6 +212,7 @@ const uinitOptions = ref([
value: 'TB',
},
])
+
getDomainDetail(domain)
/**
@@ -205,6 +224,7 @@ async function checkAiConfig() {
supplierStatus.value = res.is_configured
}
}
+
checkAiConfig()
/**
@@ -230,6 +250,7 @@ function jumpToAiSettings() {
.content-wrapper {
@include mixin.content-wrapper;
+ padding-bottom: 32px;
// title
.page-tit {
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
index 47648a12..4992937f 100644
--- a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
@@ -1,11 +1,11 @@
import { instance } from '@/api'
import { instanceOptions } from './companyProfile.controller'
import { getEditDomainStoreData } from '../store'
-import { getByteUnit, Message, isUrl } from '@/utils'
+import { getByteUnit, Message, isUrl, isObject } from '@/utils'
import { initAiConfiguration } from '@/api/modules/domain'
import { useGlobalStore } from '@/store'
import i18n from '@/i18n'
-
+import { MailDomain } from '@/views/domain/interface'
/**
* @description Check if this domain has brand info
@@ -31,23 +31,38 @@ import i18n from '@/i18n'
* @description Get domain detail
*/
export async function getDomainDetail(domain: string) {
- const { domainTit, quota, unit, mailboxes, catch_email, hasGotDomainConfiguration, urls } =
- getEditDomainStoreData()
+ const {
+ domainTit,
+ domainIp,
+ quota,
+ unit,
+ mailboxes,
+ catch_email,
+ hasGotDomainConfiguration,
+ urls,
+ } = getEditDomainStoreData()
if (hasGotDomainConfiguration.value) return
try {
- const { list } = (await instance.get('/domains/list', {
+ const res = await instance.get('/domains/list', {
params: { keyword: domain, page: 1, page_size: 1 },
- })) as { total: number; list: Record<string, any>[] }
- const quotaAndUnit = getByteUnit(list[0].quota, true, 2).split(' ')
- domainTit.value = list[0].domain
- quota.value = quotaAndUnit[0]
- unit.value = quotaAndUnit[1]
- mailboxes.value = list[0].mailboxes
- catch_email.value = list[0].email
- urls.value =
- list[0].urls && list[0].urls.length > 0 && list[0].urls[0] != '' ? list[0].urls : [`https://${domain}`]
- await configurationStatus(domain)
- hasGotDomainConfiguration.value = true
+ })
+ if (isObject<{ list: MailDomain[] }>(res)) {
+ const { list } = res
+ const quotaAndUnit = getByteUnit(list[0].quota, true, 2).split(' ')
+ domainTit.value = list[0].domain
+ domainIp.value = list[0].multi_ip_domains?.outbound_ip || ''
+ quota.value = quotaAndUnit[0]
+ unit.value = quotaAndUnit[1]
+ mailboxes.value = list[0].mailboxes
+ catch_email.value = list[0].email
+ urls.value =
+ list[0].urls && list[0].urls.length > 0 && list[0].urls[0] != ''
+ ? list[0].urls
+ : [`https://${domain}`]
+
+ await configurationStatus(domain)
+ hasGotDomainConfiguration.value = true
+ }
} catch (error) {
console.warn(error)
}
@@ -70,12 +85,39 @@ export async function configurationStatus(domain: string) {
}
}
+export async function testConnection() {
+ const { domainTit, domainIp } = getEditDomainStoreData()
+ if (domainIp.value == '') {
+ Message.error('请先设置域名专用IP')
+ return
+ }
+
+ try {
+ await instance.post(
+ '/multi_ip_domain/test',
+ {
+ domain: domainTit.value,
+ outbound_ip: domainIp.value,
+ },
+ {
+ fetchOptions: {
+ loading: '正在测试连接中,请稍候...',
+ successMessage: true,
+ },
+ }
+ )
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
/**
* @description Update domain
*/
export async function updateDomain() {
const {
domainTit,
+ domainIp,
quota,
unit,
urls,
@@ -99,6 +141,7 @@ export async function updateDomain() {
active: 1,
email: catch_email.value,
urls: urls.value,
+ outbound_ip: domainIp.value,
},
instanceOptions
)
diff --git a/core/frontend/src/views/domain/pages/editDomain/index.vue b/core/frontend/src/views/domain/pages/editDomain/index.vue
index 270206b6..bbc8ceeb 100644
--- a/core/frontend/src/views/domain/pages/editDomain/index.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/index.vue
@@ -1,9 +1,16 @@
<template>
<div class="wrapper">
<!-- Page tit -->
- <div class="page-tit">
+ <!-- <div class="page-tit">
<span class="tit-content">{{ $t('domain.edit.pageTitle') }}</span>
- </div>
+ </div> -->
+ <n-breadcrumb class="mb-20px">
+ <n-breadcrumb-item>
+ <router-link to="/domain">域名</router-link>
+ </n-breadcrumb-item>
+ <n-breadcrumb-item>{{ domain }}</n-breadcrumb-item>
+ <n-breadcrumb-item>编辑域名</n-breadcrumb-item>
+ </n-breadcrumb>
<!-- Content tabs -->
<div class="content-tabs">
@@ -22,7 +29,7 @@
</div>
<div v-if="!['Domain Configuration', 'Sitemap'].includes(activeTab)" class="footer-tool">
- <n-button type="primary" @click="switchHanldeSave">
+ <n-button type="primary" @click="handleSwitchSave">
<template #icon>
<i class="i-mingcute:save-2-line text-5"></i>
</template>
@@ -110,7 +117,7 @@ function getTabLabel(tabKey: string): string {
/**
* @description Switch for handle save
*/
-function switchHanldeSave() {
+function handleSwitchSave() {
switch (activeTab.value) {
case 'Domain Configuration':
updateDomain()
@@ -232,6 +239,7 @@ function switchToTab(tab: string) {
}
&.active {
+ color: var(--color-primary-1);
border-bottom: 2px solid var(--color-primary-1);
margin-bottom: -2px;
}
diff --git a/core/frontend/src/views/domain/pages/editDomain/store/index.ts b/core/frontend/src/views/domain/pages/editDomain/store/index.ts
index 48c2bceb..7fc776e6 100644
--- a/core/frontend/src/views/domain/pages/editDomain/store/index.ts
+++ b/core/frontend/src/views/domain/pages/editDomain/store/index.ts
@@ -1,146 +1,146 @@
-import { defineStore, storeToRefs } from "pinia";
-import { KnowledgeBase, SiteInfo } from "../dto";
+import { defineStore, storeToRefs } from 'pinia'
+import { KnowledgeBase, SiteInfo } from '../dto'
-const editDomainStore = defineStore("editDomainStore", () => {
- // domain configuration
- const hasGotDomainConfiguration = ref(false)
- const domainTit = ref("")
- const quota = ref("0")
- const unit = ref("B")
- const mailboxes = ref(0)
- const catch_email = ref("")
- const urls = ref(["https://"])
- const brandInfo = ref(false)
- const waitAndCheckDomainStatusRef = ref()
- const createdBrandInfo = ref(false)
+const editDomainStore = defineStore('editDomainStore', () => {
+ // domain configuration
+ const hasGotDomainConfiguration = ref(false)
+ const domainTit = ref('')
+ const domainIp = ref('')
+ const quota = ref('0')
+ const unit = ref('B')
+ const mailboxes = ref(0)
+ const catch_email = ref('')
+ const urls = ref(['https://'])
+ const brandInfo = ref(false)
+ const waitAndCheckDomainStatusRef = ref()
+ const createdBrandInfo = ref(false)
-
+ // Project detail
+ const hasGotProjectDetail = ref(false)
+ const domain = ref('')
+ const description = ref('')
+ const favicon = ref('')
+ const industry = ref('')
+ const primary_logo = ref('')
+ const project_name = ref('')
+ const secondary_logo = ref('')
+ const knowledge_base = ref<KnowledgeBase[]>([])
+ const activeKnowledge = ref<KnowledgeBase>({
+ title: '',
+ content: '',
+ kid: '',
+ update_time: 0,
+ })
+ const knowledgeTitle = ref('')
+ const knowledgeContent = ref('')
+ const knowledgeModalShow = ref(false)
+ const isEditKnowledge = ref(false)
+ const knowledge_base_content = ref('')
+ const knowledgeBasePreview = ref(false)
+ const knowledgeBasePreviewTit = ref('')
- // Project detail
- const hasGotProjectDetail = ref(false)
- const domain = ref("")
- const description = ref("")
- const favicon = ref("")
- const industry = ref("")
- const primary_logo = ref("")
- const project_name = ref("")
- const secondary_logo = ref("")
- const knowledge_base = ref<KnowledgeBase[]>([])
- const activeKnowledge = ref<KnowledgeBase>({
- title: "",
- content: "",
- kid: "",
- update_time: 0
- })
- const knowledgeTitle = ref("")
- const knowledgeContent = ref("")
- const knowledgeModalShow = ref(false)
- const isEditKnowledge = ref(false)
- const knowledge_base_content = ref("")
- const knowledgeBasePreview = ref(false)
- const knowledgeBasePreviewTit = ref("")
+ // Company profile
+ const hasGotCompanyProfile = ref(false)
+ const legal_company_name = ref('')
+ const web_site = ref('')
+ const company_profile = ref('')
+ const email = ref('')
+ const phone = ref('')
+ const support_url = ref('')
- // Company profile
- const hasGotCompanyProfile = ref(false)
- const legal_company_name = ref("")
- const web_site = ref("")
- const company_profile = ref("")
- const email = ref("")
- const phone = ref("")
- const support_url = ref("")
+ // Styling
+ const hasGotStyling = ref(false)
+ const accent_color = ref('')
+ const text_color = ref('')
+ const page_background = ref('')
+ const container_background = ref('')
+ const link_social_color = ref('')
+ const link_footer_color = ref('')
+ const heading_font = ref('')
+ const body_font = ref('')
- // Styling
- const hasGotStyling = ref(false)
- const accent_color = ref("")
- const text_color = ref("")
- const page_background = ref("")
- const container_background = ref("")
- const link_social_color = ref("")
- const link_footer_color = ref("")
- const heading_font = ref("")
- const body_font = ref("")
+ // Sitemap
+ const hasGotSitemap = ref(false)
+ const sitemap = ref<SiteInfo[]>([
+ {
+ title: '',
+ uri_path: '',
+ },
+ ])
- // Sitemap
- const hasGotSitemap = ref(false)
- const sitemap = ref<SiteInfo[]>([
- {
- title: "",
- uri_path: ""
- }
- ])
+ // Footer settings
+ const hasGotFootersettings = ref(false)
+ const copyright_text = ref('')
+ const disclaimer = ref('')
- // Footer settings
- const hasGotFootersettings = ref(false)
- const copyright_text = ref("")
- const disclaimer = ref("")
+ // Ai settings
+ const hasGotAisettings = ref(false)
+ const prompt = ref('')
- // Ai settings
- const hasGotAisettings = ref(false)
- const prompt = ref("")
+ return {
+ hasGotDomainConfiguration,
+ domainTit,
+ domainIp,
+ quota,
+ unit,
+ mailboxes,
+ catch_email,
+ urls,
+ brandInfo,
+ waitAndCheckDomainStatusRef,
+ createdBrandInfo,
- return {
- hasGotDomainConfiguration,
- domainTit,
- quota,
- unit,
- mailboxes,
- catch_email,
- urls,
- brandInfo,
- waitAndCheckDomainStatusRef,
- createdBrandInfo,
-
- hasGotProjectDetail,
- domain,
- description,
- favicon,
- industry,
- primary_logo,
- project_name,
- secondary_logo,
- knowledge_base,
- activeKnowledge,
- knowledgeTitle,
- knowledgeContent,
- knowledgeModalShow,
- isEditKnowledge,
- knowledge_base_content,
- knowledgeBasePreview,
- knowledgeBasePreviewTit,
+ hasGotProjectDetail,
+ domain,
+ description,
+ favicon,
+ industry,
+ primary_logo,
+ project_name,
+ secondary_logo,
+ knowledge_base,
+ activeKnowledge,
+ knowledgeTitle,
+ knowledgeContent,
+ knowledgeModalShow,
+ isEditKnowledge,
+ knowledge_base_content,
+ knowledgeBasePreview,
+ knowledgeBasePreviewTit,
- hasGotCompanyProfile,
- legal_company_name,
- web_site,
- company_profile,
- email,
- phone,
- support_url,
+ hasGotCompanyProfile,
+ legal_company_name,
+ web_site,
+ company_profile,
+ email,
+ phone,
+ support_url,
- hasGotStyling,
- accent_color,
- text_color,
- page_background,
- container_background,
- link_social_color,
- link_footer_color,
- heading_font,
- body_font,
+ hasGotStyling,
+ accent_color,
+ text_color,
+ page_background,
+ container_background,
+ link_social_color,
+ link_footer_color,
+ heading_font,
+ body_font,
- hasGotSitemap,
- sitemap,
+ hasGotSitemap,
+ sitemap,
- hasGotFootersettings,
- copyright_text,
- disclaimer,
+ hasGotFootersettings,
+ copyright_text,
+ disclaimer,
- hasGotAisettings,
- prompt
- }
+ hasGotAisettings,
+ prompt,
+ }
})
export function getEditDomainStoreData() {
- const store = editDomainStore()
- return {
- ...storeToRefs(store)
- }
-}
\ No newline at end of file
+ const store = editDomainStore()
+ return {
+ ...storeToRefs(store),
+ }
+}
diff --git a/core/frontend/uno.config.ts b/core/frontend/uno.config.ts
index 19052360..c4fe3aa4 100644
--- a/core/frontend/uno.config.ts
+++ b/core/frontend/uno.config.ts
@@ -3,32 +3,30 @@ import presetUno from '@unocss/preset-uno'
import presetIcons from '@unocss/preset-icons'
import presetAttributify from '@unocss/preset-attributify'
import transformerDirectives from '@unocss/transformer-directives'
-
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
import path from 'node:path'
import { globSync } from 'glob'
function getIcons() {
- const icons = {}
- const files = globSync('src/assets/icons/**/*.svg', { nodir: true })
- files.forEach((filePath) => {
- const fileName = path.basename(filePath) // 获取文件名,包括后缀
- const fileNameWithoutExt = path.parse(fileName).name // 获取去除后缀的文件名
- const folderName = path.basename(path.dirname(filePath)) // 获取文件夹名
- if (!icons[folderName]) {
- icons[folderName] = []
- }
- icons[folderName].push(`i-${folderName}:${fileNameWithoutExt}`)
- })
- return icons
+ const icons = {}
+ const files = globSync('src/assets/icons/**/*.svg', { nodir: true })
+ files.forEach(filePath => {
+ const fileName = path.basename(filePath) // 获取文件名,包括后缀
+ const fileNameWithoutExt = path.parse(fileName).name // 获取去除后缀的文件名
+ const folderName = path.basename(path.dirname(filePath)) // 获取文件夹名
+ if (!icons[folderName]) {
+ icons[folderName] = []
+ }
+ icons[folderName].push(`i-${folderName}:${fileNameWithoutExt}`)
+ })
+ return icons
}
const icons = getIcons()
const collections = Object.fromEntries(
- Object.keys(icons).map((item) => [item, FileSystemIconLoader(`src/assets/icons/${item}`)])
+ Object.keys(icons).map(item => [item, FileSystemIconLoader(`src/assets/icons/${item}`)])
)
-
export default defineConfig({
presets: [
presetUno({ preflight: false }),