mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-11-20 08:01:19 +00:00
feat(website): warn when certificate domains do not match website domains
This commit is contained in:
@@ -24,26 +24,27 @@ type WebsiteDTO struct {
|
||||
}
|
||||
|
||||
type WebsiteRes struct {
|
||||
ID uint `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Protocol string `json:"protocol"`
|
||||
PrimaryDomain string `json:"primaryDomain"`
|
||||
Type string `json:"type"`
|
||||
Alias string `json:"alias"`
|
||||
Remark string `json:"remark"`
|
||||
Status string `json:"status"`
|
||||
ExpireDate time.Time `json:"expireDate"`
|
||||
SitePath string `json:"sitePath"`
|
||||
AppName string `json:"appName"`
|
||||
RuntimeName string `json:"runtimeName"`
|
||||
SSLExpireDate time.Time `json:"sslExpireDate"`
|
||||
SSLStatus string `json:"sslStatus"`
|
||||
AppInstallID uint `json:"appInstallId"`
|
||||
ChildSites []string `json:"childSites"`
|
||||
ParentSite string `json:"parentSite"`
|
||||
RuntimeType string `json:"runtimeType"`
|
||||
Favorite bool `json:"favorite"`
|
||||
IPV6 bool `json:"IPV6"`
|
||||
SSLDomainMismatch bool `json:"sslDomainMismatch"`
|
||||
ID uint `json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Protocol string `json:"protocol"`
|
||||
PrimaryDomain string `json:"primaryDomain"`
|
||||
Type string `json:"type"`
|
||||
Alias string `json:"alias"`
|
||||
Remark string `json:"remark"`
|
||||
Status string `json:"status"`
|
||||
ExpireDate time.Time `json:"expireDate"`
|
||||
SitePath string `json:"sitePath"`
|
||||
AppName string `json:"appName"`
|
||||
RuntimeName string `json:"runtimeName"`
|
||||
SSLExpireDate time.Time `json:"sslExpireDate"`
|
||||
SSLStatus string `json:"sslStatus"`
|
||||
AppInstallID uint `json:"appInstallId"`
|
||||
ChildSites []string `json:"childSites"`
|
||||
ParentSite string `json:"parentSite"`
|
||||
RuntimeType string `json:"runtimeType"`
|
||||
Favorite bool `json:"favorite"`
|
||||
IPV6 bool `json:"IPV6"`
|
||||
}
|
||||
|
||||
type WebsiteOption struct {
|
||||
|
||||
@@ -150,7 +150,7 @@ func (w *WebsiteRepo) Page(page, size int, opts ...DBOption) (int64, []model.Web
|
||||
db := getDb(opts...).Model(&model.Website{})
|
||||
count := int64(0)
|
||||
db = db.Count(&count)
|
||||
err := db.Limit(size).Offset(size * (page - 1)).Preload("WebsiteSSL").Find(&websites).Error
|
||||
err := db.Limit(size).Offset(size * (page - 1)).Preload("WebsiteSSL").Preload("Domains").Find(&websites).Error
|
||||
return count, websites, err
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
@@ -193,6 +194,7 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
certificates := make(map[uint]*x509.Certificate)
|
||||
for _, web := range websites {
|
||||
var (
|
||||
appName string
|
||||
@@ -216,25 +218,31 @@ func (w WebsiteService) PageWebsite(req request.WebsiteSearch) (int64, []respons
|
||||
}
|
||||
sitePath := GetSitePath(web, SiteDir)
|
||||
|
||||
cert, parsed := certificates[web.WebsiteSSLID]
|
||||
if !parsed && web.Protocol == constant.ProtocolHTTPS && web.WebsiteSSLID != 0 {
|
||||
cert, _ = parseCertificatePEM([]byte(web.WebsiteSSL.Pem))
|
||||
certificates[web.WebsiteSSLID] = cert
|
||||
}
|
||||
siteDTO := response.WebsiteRes{
|
||||
ID: web.ID,
|
||||
CreatedAt: web.CreatedAt,
|
||||
Protocol: web.Protocol,
|
||||
PrimaryDomain: web.PrimaryDomain,
|
||||
Type: web.Type,
|
||||
Remark: web.Remark,
|
||||
Status: web.Status,
|
||||
Alias: web.Alias,
|
||||
AppName: appName,
|
||||
ExpireDate: web.ExpireDate,
|
||||
SSLExpireDate: web.WebsiteSSL.ExpireDate,
|
||||
SSLStatus: checkSSLStatus(web.WebsiteSSL.ExpireDate),
|
||||
RuntimeName: runtimeName,
|
||||
SitePath: sitePath,
|
||||
AppInstallID: appInstallID,
|
||||
RuntimeType: runtimeType,
|
||||
Favorite: web.Favorite,
|
||||
IPV6: web.IPV6,
|
||||
SSLDomainMismatch: websiteCertificateDomainMismatch(web, cert),
|
||||
ID: web.ID,
|
||||
CreatedAt: web.CreatedAt,
|
||||
Protocol: web.Protocol,
|
||||
PrimaryDomain: web.PrimaryDomain,
|
||||
Type: web.Type,
|
||||
Remark: web.Remark,
|
||||
Status: web.Status,
|
||||
Alias: web.Alias,
|
||||
AppName: appName,
|
||||
ExpireDate: web.ExpireDate,
|
||||
SSLExpireDate: web.WebsiteSSL.ExpireDate,
|
||||
SSLStatus: checkSSLStatus(web.WebsiteSSL.ExpireDate),
|
||||
RuntimeName: runtimeName,
|
||||
SitePath: sitePath,
|
||||
AppInstallID: appInstallID,
|
||||
RuntimeType: runtimeType,
|
||||
Favorite: web.Favorite,
|
||||
IPV6: web.IPV6,
|
||||
}
|
||||
|
||||
if siteDTO.Type == constant.Subsite {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"log/slog"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
@@ -35,6 +36,7 @@ import (
|
||||
"github.com/1Panel-dev/1Panel/agent/utils/req_helper"
|
||||
"github.com/1Panel-dev/1Panel/agent/utils/ssl"
|
||||
"github.com/1Panel-dev/1Panel/agent/utils/xpack"
|
||||
"golang.org/x/net/idna"
|
||||
gormv2 "gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -641,6 +643,38 @@ func runShellScriptFile(workDir, shell string, logger *log.Logger) error {
|
||||
return cmdMgr.Run("bash", file.Name())
|
||||
}
|
||||
|
||||
// Domain warnings are advisory and intentionally do not check validity dates or trust.
|
||||
func websiteCertificateDomainMismatch(website model.Website, cert *x509.Certificate) bool {
|
||||
if website.Protocol != constant.ProtocolHTTPS || cert == nil {
|
||||
return false
|
||||
}
|
||||
for _, domain := range website.Domains {
|
||||
host := strings.TrimSpace(domain.Domain)
|
||||
if h, _, err := net.SplitHostPort(host); err == nil {
|
||||
host = h
|
||||
}
|
||||
host = strings.TrimSuffix(strings.ToLower(strings.Trim(host, "[]")), ".")
|
||||
if host == "" {
|
||||
continue
|
||||
}
|
||||
if net.ParseIP(host) == nil {
|
||||
wildcard := strings.HasPrefix(host, "*.")
|
||||
normalized, err := idna.Lookup.ToASCII(strings.TrimPrefix(host, "*."))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
host = normalized
|
||||
if wildcard {
|
||||
host = "*." + host
|
||||
}
|
||||
}
|
||||
if cert.VerifyHostname(host) != nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func parseCertificatePEM(certPEM []byte) (*x509.Certificate, error) {
|
||||
certBlock, _ := pem.Decode(certPEM)
|
||||
if certBlock == nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { CommonModel, ReqPage } from '.';
|
||||
|
||||
export namespace Website {
|
||||
export interface Website extends CommonModel {
|
||||
sslDomainMismatch?: boolean;
|
||||
primaryDomain: string;
|
||||
type: string;
|
||||
alias: string;
|
||||
@@ -53,6 +54,7 @@ export namespace Website {
|
||||
}
|
||||
|
||||
export interface WebsiteRes extends CommonModel {
|
||||
sslDomainMismatch: boolean;
|
||||
protocol: string;
|
||||
primaryDomain: string;
|
||||
type: string;
|
||||
|
||||
@@ -4625,6 +4625,7 @@ const message = {
|
||||
isEdirWarn: 'Changes to docker-compose.yml were detected. Please review the diff.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'The certificate domains do not match the website domains',
|
||||
primaryDomain: 'Primary domain',
|
||||
otherDomains: 'Other domains',
|
||||
static: 'Static',
|
||||
|
||||
@@ -4712,6 +4712,7 @@ const message = {
|
||||
isEdirWarn: 'Se detectaron cambios en el archivo docker-compose.yml. Revise la comparación.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'Los dominios del certificado no coinciden con los dominios del sitio web',
|
||||
primaryDomain: 'Dominio principal',
|
||||
otherDomains: 'Otros dominios',
|
||||
static: 'Estático',
|
||||
|
||||
@@ -4582,6 +4582,7 @@ const message = {
|
||||
isEdirWarn: 'تغییرات در docker-compose.yml شناسایی شد. لطفاً تفاوت را بررسی کنید.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'دامنههای گواهی با دامنههای وبسایت مطابقت ندارند',
|
||||
primaryDomain: 'دامنه اصلی',
|
||||
otherDomains: 'سایر دامنهها',
|
||||
static: 'ایستا',
|
||||
|
||||
@@ -4606,6 +4606,7 @@ const message = {
|
||||
isEdirWarn: 'docker-compose.yml ファイルの変更が検出されました。差分を確認してください。',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: '証明書のドメインがウェブサイトのドメインと一致しません',
|
||||
primaryDomain: 'プライマリドメイン',
|
||||
otherDomains: '他のドメイン',
|
||||
static: '静的',
|
||||
|
||||
@@ -4524,6 +4524,7 @@ const message = {
|
||||
isEdirWarn: 'docker-compose.yml 파일 변경이 감지되었습니다. 차이점을 확인해 주세요.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: '인증서 도메인이 웹사이트 도메인과 일치하지 않습니다',
|
||||
primaryDomain: '기본 도메인',
|
||||
otherDomains: '기타 도메인',
|
||||
static: '정적',
|
||||
|
||||
@@ -4486,6 +4486,7 @@ const message = {
|
||||
isEdirWarn: 'ກວດພົບການປ່ຽນແປງໃນ docker-compose.yml. ກະລຸນາກວດສອບຄວາມແຕກຕ່າງ.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'ໂດເມນຂອງໃບຢັ້ງຢືນບໍ່ກົງກັບໂດເມນຂອງເວັບໄຊ',
|
||||
primaryDomain: 'ໂດເມນຫຼັກ',
|
||||
otherDomains: 'ໂດເມນອື່ນໆ',
|
||||
static: 'ສະແຕຕິກ (Static)',
|
||||
|
||||
@@ -4695,6 +4695,7 @@ const message = {
|
||||
isEdirWarn: 'Perubahan pada fail docker-compose.yml telah dikesan. Sila semak perbezaannya.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'Domain sijil tidak sepadan dengan domain laman web',
|
||||
primaryDomain: 'Domain Utama',
|
||||
otherDomains: 'Domain Lain',
|
||||
static: 'Statik',
|
||||
|
||||
@@ -4719,6 +4719,7 @@ const message = {
|
||||
isEdirWarn: 'Foram detectadas alterações no arquivo docker-compose.yml. Revise a comparação.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'Os domínios do certificado não correspondem aos domínios do site',
|
||||
primaryDomain: 'Domínio principal',
|
||||
otherDomains: 'Outros domínios',
|
||||
static: 'Estático',
|
||||
|
||||
@@ -4689,6 +4689,7 @@ const message = {
|
||||
isEdirWarn: 'Обнаружены изменения в файле docker-compose.yml. Проверьте различия.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'Домены сертификата не соответствуют доменам сайта',
|
||||
primaryDomain: 'Основной домен',
|
||||
otherDomains: 'Другие домены',
|
||||
static: 'Статический',
|
||||
|
||||
@@ -4697,6 +4697,7 @@ const message = {
|
||||
isEdirWarn: 'docker-compose.yml dosyasında değişiklikler algılandı. Lütfen farkları inceleyin.',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: 'Sertifika alan adları web sitesinin alan adlarıyla eşleşmiyor',
|
||||
primaryDomain: 'Birincil alan adı',
|
||||
otherDomains: 'Diğer alan adları',
|
||||
static: 'Statik',
|
||||
|
||||
@@ -4287,6 +4287,7 @@ const message = {
|
||||
isEdirWarn: '偵測到 docker-compose.yml 檔案被修改,請檢視對比',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: '憑證網域與網站網域不相符',
|
||||
primaryDomain: '主域名',
|
||||
otherDomains: '其他域名',
|
||||
static: '靜態網站',
|
||||
|
||||
@@ -4321,6 +4321,7 @@ const message = {
|
||||
isEdirWarn: '检测到 docker-compose.yml 文件被修改,请查看对比',
|
||||
},
|
||||
website: {
|
||||
sslDomainMismatchWebsite: '证书域名与网站域名不匹配',
|
||||
primaryDomain: '主域名',
|
||||
otherDomains: '其他域名',
|
||||
static: '静态网站',
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
interface CertificateDomains {
|
||||
primaryDomain?: string;
|
||||
domains?: string;
|
||||
}
|
||||
|
||||
export function normalizeDomain(value = ''): string {
|
||||
let host = value.trim().toLowerCase();
|
||||
if (host.startsWith('[')) {
|
||||
host = host.slice(1, host.indexOf(']'));
|
||||
} else if ((host.match(/:/g) || []).length === 1) {
|
||||
host = host.replace(/:\d+$/, '');
|
||||
}
|
||||
host = host.replace(/\.$/, '');
|
||||
if (!host) return '';
|
||||
try {
|
||||
// URL normalizes internationalized hostnames and equivalent IPv6 spellings.
|
||||
const normalized = new URL(`http://${host.includes(':') ? `[${host}]` : host}`).hostname;
|
||||
return normalized.replace(/^\[|\]$/g, '');
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function domainMatches(pattern: string, target: string): boolean {
|
||||
pattern = normalizeDomain(pattern);
|
||||
target = normalizeDomain(target);
|
||||
if (!pattern || !target) return false;
|
||||
if (pattern === target) return true;
|
||||
if (!pattern.startsWith('*.') || target.includes(':') || /^\d+(\.\d+){3}$/.test(target)) return false;
|
||||
return target.endsWith(pattern.slice(1)) && target.split('.').length === pattern.split('.').length;
|
||||
}
|
||||
|
||||
export function getCertificateDomains(ssl: CertificateDomains): string[] {
|
||||
return [
|
||||
...new Set(
|
||||
[ssl.primaryDomain || '', ...(ssl.domains || '').split(/[,\s]+/)].map(normalizeDomain).filter(Boolean),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
export function certificateDomainMismatch(domains: string[], ssl?: CertificateDomains): boolean {
|
||||
if (!ssl) return false;
|
||||
const patterns = getCertificateDomains(ssl);
|
||||
const hosts = domains.map(normalizeDomain).filter(Boolean);
|
||||
if (!patterns.length || !hosts.length) return false;
|
||||
return hosts.some((host) => !patterns.some((pattern) => domainMatches(pattern, host)));
|
||||
}
|
||||
@@ -77,6 +77,9 @@
|
||||
</el-tag>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-text v-if="sslDomainMismatch" type="warning" class="w-full mt-1">
|
||||
{{ $t('website.sslDomainMismatchWebsite') }}
|
||||
</el-text>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -147,6 +150,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, onMounted, ref } from 'vue';
|
||||
import { certificateDomainMismatch } from '@/utils/ssl-domain';
|
||||
import { getAccountName } from '@/utils/ssl';
|
||||
import { dateFormatSimple } from '@/utils/date';
|
||||
import WebsiteSSL from '@/views/website/website/components/website-ssl/index.vue';
|
||||
@@ -180,6 +184,7 @@ interface Props {
|
||||
algorithm: string;
|
||||
};
|
||||
websiteSSL?: Website.SSL;
|
||||
websiteDomains?: string[];
|
||||
autoLoad?: boolean;
|
||||
}
|
||||
|
||||
@@ -196,6 +201,11 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
const sslDomainMismatch = computed(
|
||||
() =>
|
||||
props.websiteSSL?.id === props.modelValue.websiteSSLId &&
|
||||
certificateDomainMismatch(props.websiteDomains || [], props.websiteSSL),
|
||||
);
|
||||
|
||||
const acmeAccounts = ref<AcmeAccount[]>([]);
|
||||
const ssls = ref<SSLItem[]>([]);
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
<el-text type="warning" class="!ml-2">{{ $t('website.ipWebsiteWarn') }}</el-text>
|
||||
|
||||
<el-divider content-position="left">{{ $t('website.SSLConfig') }}</el-divider>
|
||||
<HttpsConfig v-model="form" :website-ssl="websiteSSL" @ssl-change="handleSSLChange" />
|
||||
<HttpsConfig
|
||||
v-model="form"
|
||||
:website-ssl="websiteSSL"
|
||||
:website-domains="websiteDomains"
|
||||
@ssl-change="handleSSLChange"
|
||||
/>
|
||||
<el-form-item>
|
||||
<el-button v-permission type="primary" @click="submit(httpsForm)">
|
||||
{{ $t('commons.button.save') }}
|
||||
@@ -43,7 +48,7 @@
|
||||
import HttpsConfig from '@/views/website/website/components/https/index.vue';
|
||||
|
||||
import { Website } from '@/api/interface/website';
|
||||
import { getHTTPSConfig, updateHTTPSConfig } from '@/api/modules/website';
|
||||
import { getHTTPSConfig, updateHTTPSConfig, listDomains } from '@/api/modules/website';
|
||||
import { ElMessageBox, FormInstance } from 'element-plus';
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
@@ -82,6 +87,7 @@ let form = reactive({
|
||||
});
|
||||
const loading = ref(false);
|
||||
const websiteSSL = ref();
|
||||
const websiteDomains = ref<string[]>([]);
|
||||
const rules = ref({
|
||||
type: [Rules.requiredSelect],
|
||||
privateKey: [Rules.requiredInput],
|
||||
@@ -101,6 +107,9 @@ const handleSSLChange = (ssl: Website.SSL) => {
|
||||
};
|
||||
|
||||
const get = () => {
|
||||
listDomains(id.value).then((res) => {
|
||||
websiteDomains.value = (res.data || []).map((item) => item.domain);
|
||||
});
|
||||
getHTTPSConfig(id.value).then((res) => {
|
||||
if (res.data) {
|
||||
form.type = 'existed';
|
||||
|
||||
@@ -266,6 +266,9 @@
|
||||
</el-tag>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-text v-if="sslDomainMismatch" type="warning" class="w-full mt-1">
|
||||
{{ $t('website.sslDomainMismatchWebsite') }}
|
||||
</el-text>
|
||||
</el-form-item>
|
||||
<el-form-item :label="' '" v-if="websiteSSL && websiteSSL.id > 0">
|
||||
<WebsiteSSL :websiteSSL="websiteSSL" />
|
||||
@@ -463,7 +466,8 @@ import {
|
||||
import { Rules, checkNumberRange } from '@/global/form-rules';
|
||||
import i18n from '@/lang';
|
||||
import { ElForm, FormInstance } from 'element-plus';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { normalizeDomain, domainMatches, getCertificateDomains, certificateDomainMismatch } from '@/utils/ssl-domain';
|
||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||
import { SearchRuntimes } from '@/api/modules/runtime';
|
||||
import { Runtime } from '@/api/interface/runtime';
|
||||
@@ -869,39 +873,6 @@ const selectFirstAvailableSSL = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const normalizeDomain = (domain?: string) => {
|
||||
if (!domain) {
|
||||
return '';
|
||||
}
|
||||
return domain.split(':')[0].trim().toLowerCase();
|
||||
};
|
||||
|
||||
const wildcardMatches = (pattern: string, target: string) => {
|
||||
if (!pattern.startsWith('*.')) {
|
||||
return false;
|
||||
}
|
||||
const suffix = pattern.slice(1);
|
||||
if (!suffix) {
|
||||
return false;
|
||||
}
|
||||
if (!target.endsWith(suffix)) {
|
||||
return false;
|
||||
}
|
||||
const suffixLabels = suffix.slice(1).split('.');
|
||||
const targetLabels = target.split('.');
|
||||
return targetLabels.length > suffixLabels.length;
|
||||
};
|
||||
|
||||
const domainMatches = (pattern: string, target: string) => {
|
||||
if (!pattern || !target) {
|
||||
return false;
|
||||
}
|
||||
if (pattern === target) {
|
||||
return true;
|
||||
}
|
||||
return wildcardMatches(pattern, target);
|
||||
};
|
||||
|
||||
const getWebsiteDomains = (): string[] => {
|
||||
const domains = new Set<string>();
|
||||
const pushDomain = (value?: string) => {
|
||||
@@ -919,28 +890,9 @@ const getWebsiteDomains = (): string[] => {
|
||||
return Array.from(domains);
|
||||
};
|
||||
|
||||
const getCertificateDomains = (ssl: SSLItem): string[] => {
|
||||
const domains = new Set<string>();
|
||||
const tokens: string[] = [];
|
||||
if (ssl.primaryDomain) {
|
||||
tokens.push(ssl.primaryDomain);
|
||||
}
|
||||
if (ssl.domains) {
|
||||
ssl.domains
|
||||
.replace(/\n/g, ',')
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item !== '')
|
||||
.forEach((item) => tokens.push(item));
|
||||
}
|
||||
tokens.forEach((token) => {
|
||||
const normalized = normalizeDomain(token);
|
||||
if (normalized) {
|
||||
domains.add(normalized);
|
||||
}
|
||||
});
|
||||
return Array.from(domains);
|
||||
};
|
||||
const sslDomainMismatch = computed(
|
||||
() => website.value.enableSSL && certificateDomainMismatch(getWebsiteDomains(), websiteSSL.value),
|
||||
);
|
||||
|
||||
const tryAutoSelectSSL = (): boolean => {
|
||||
if (!website.value.enableSSL) {
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
</span>
|
||||
</el-text>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="!hideName && row.sslDomainMismatch"
|
||||
:content="$t('website.sslDomainMismatchWebsite')"
|
||||
placement="top"
|
||||
>
|
||||
<el-icon class="ml-1" color="var(--el-color-warning)"><WarningFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
<el-popover
|
||||
placement="right"
|
||||
trigger="hover"
|
||||
@@ -85,6 +92,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { WarningFilled } from '@element-plus/icons-vue';
|
||||
import { ref, nextTick, computed } from 'vue';
|
||||
import { listDomains } from '@/api/modules/website';
|
||||
import { Website } from '@/api/interface/website';
|
||||
|
||||
@@ -92,6 +92,13 @@
|
||||
>
|
||||
{{ row.primaryDomain }}
|
||||
</el-text>
|
||||
<el-tooltip
|
||||
v-if="row.sslDomainMismatch"
|
||||
:content="$t('website.sslDomainMismatchWebsite')"
|
||||
placement="top"
|
||||
>
|
||||
<el-icon class="ml-1" color="var(--el-color-warning)"><WarningFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
<Domain
|
||||
class="website-card-domain__actions"
|
||||
:row="row"
|
||||
@@ -337,6 +344,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { WarningFilled } from '@element-plus/icons-vue';
|
||||
import { useSearchState } from '@/utils/search-reset';
|
||||
import Backups from '@/components/backup/index.vue';
|
||||
import UploadDialog from '@/components/upload/index.vue';
|
||||
|
||||
Reference in New Issue
Block a user