From 4ed8c6f75c9e6612a526f2482775a0f8a3833001 Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Sun, 15 Oct 2023 00:21:49 +0800 Subject: [PATCH] Improve GetCertByDomain(), improve web UI --- object/util.go | 4 ++++ web/src/CertListPage.js | 24 ++++++++++++------------ web/src/SiteListPage.js | 9 ++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/object/util.go b/object/util.go index 9f6b76b..4fcb75b 100644 --- a/object/util.go +++ b/object/util.go @@ -174,6 +174,10 @@ func getCertMap() (map[string]*Cert, error) { } func GetCertByDomain(domain string) (*Cert, error) { + if domain == "" { + return nil, fmt.Errorf("GetCertByDomain() error: domain should not be empty") + } + cert, ok := certMap[domain] if ok { return cert, nil diff --git a/web/src/CertListPage.js b/web/src/CertListPage.js index eacb91a..0b15b2b 100644 --- a/web/src/CertListPage.js +++ b/web/src/CertListPage.js @@ -114,16 +114,16 @@ class CertListPage extends React.Component { ); }, }, - // { - // title: i18next.t("general:Create time"), - // dataIndex: "createdTime", - // key: "createdTime", - // width: "150px", - // sorter: (a, b) => a.createdTime.localeCompare(b.createdTime), - // render: (text, record, index) => { - // return Setting.getFormattedDate(text); - // }, - // }, + { + title: i18next.t("general:Create time"), + dataIndex: "createdTime", + key: "createdTime", + width: "150px", + sorter: (a, b) => a.createdTime.localeCompare(b.createdTime), + render: (text, record, index) => { + return Setting.getFormattedDate(text); + }, + }, // { // title: i18next.t("general:Display name"), // dataIndex: "displayName", @@ -200,7 +200,7 @@ class CertListPage extends React.Component { width: "180px", sorter: (a, b) => a.certificate.localeCompare(b.certificate), render: (text, record, index) => { - return Setting.getShortText(text, 70); + return Setting.getShortText(text); }, }, { @@ -210,7 +210,7 @@ class CertListPage extends React.Component { width: "180px", sorter: (a, b) => a.privateKey.localeCompare(b.privateKey), render: (text, record, index) => { - return Setting.getShortText(text, 70); + return Setting.getShortText(text); }, }, { diff --git a/web/src/SiteListPage.js b/web/src/SiteListPage.js index c98d9ef..fe02b0b 100644 --- a/web/src/SiteListPage.js +++ b/web/src/SiteListPage.js @@ -59,7 +59,7 @@ class SiteListPage extends React.Component { challenges: [], host: "", port: 8000, - sslMode: "HTTP", + sslMode: "HTTPS Only", sslCert: "", publicIp: "", node: "", @@ -202,6 +202,9 @@ class SiteListPage extends React.Component { } if (!record.isSelf) { + if (text.includes(":/")) { + return Setting.getShortText(text, 10); + } return text; } @@ -292,14 +295,14 @@ class SiteListPage extends React.Component { title: i18next.t("site:Mode"), dataIndex: "sslMode", key: "sslMode", - width: "120px", + width: "100px", sorter: (a, b) => a.sslMode.localeCompare(b.sslMode), }, { title: i18next.t("site:SSL cert"), dataIndex: "sslCert", key: "sslCert", - width: "150px", + width: "130px", sorter: (a, b) => a.sslCert.localeCompare(b.sslCert), render: (text, record, index) => { return (