@@ -552,56 +552,33 @@ func (s *Handler) GetDomainsHandler(res http.ResponseWriter, req *http.Request)
552552 return
553553 }
554554
555+ // 检查 PublishEnabled 权限
556+ if ! license .GetFeatures ().PublishEnabled {
557+ s .jsonError (res , "Publish feature not enabled for this license plan" , http .StatusForbidden )
558+ return
559+ }
560+
555561 // 获取 PublishDomain 记录
556562 pd , err := s .contentApp .GetPublishDomainByKey (license .LicenseKey )
557563 if err != nil {
558564 s .jsonError (res , "Publish domain not found" , http .StatusNotFound )
559565 return
560566 }
561567
562- // 构建响应
563- response := map [string ]interface {}{
564- "license_key" : license .LicenseKey ,
565- "platform_domain" : s .adminApp .Domain (),
566- "features" : map [string ]interface {}{
567- "custom_domain_enabled" : license .GetFeatures ().CustomDomain ,
568- "max_custom_domains" : 1 ,
569- },
570- }
571-
572- // SubDomain 信息
573- if pd .SubDomain != "" {
574- response ["subdomain" ] = map [string ]interface {}{
575- "name" : pd .SubDomain ,
576- "full_domain" : fmt .Sprintf ("%s.%s" , pd .SubDomain , s .adminApp .Domain ()),
577- "status" : "active" ,
578- }
579- }
580-
581- // 自定义域名信息
582- if pd .CusDomain != "" {
583- customDomainInfo := map [string ]interface {}{
584- "domain" : pd .CusDomain ,
585- }
586-
587- // ✅ 执行 TLS 检测获取实时状态
588- tlsResult := s .caddyClient .GetChecker ().CheckTLS (pd .CusDomain )
589-
590- customDomainInfo ["status" ] = tlsResult .TLSStatus
591- customDomainInfo ["tls_ready" ] = tlsResult .TLSReady
592-
593- if tlsResult .TLSReady && tlsResult .CertInfo != nil {
594- customDomainInfo ["certificate" ] = map [string ]interface {}{
595- "status" : tlsResult .CertInfo .Status ,
596- "issuer" : tlsResult .CertInfo .Issuer ,
597- "expires_at" : tlsResult .CertInfo .NotAfter ,
598- }
599- }
600-
601- response ["custom_domain" ] = customDomainInfo
568+ // 获取 SubDomain 记录
569+ sd , err := s .contentApp .GetSubDomainByKey (pd .SubDomain )
570+ if err != nil {
571+ s .jsonError (res , "Subdomain not found" , http .StatusNotFound )
572+ return
602573 }
603574
604- s .jsonResponse (res , response )
575+ s .jsonResponse (res , map [string ]interface {}{
576+ "subdomain" : sd .Sub ,
577+ "full_domain" : fmt .Sprintf ("%s.%s" , sd .Sub , s .adminApp .Domain ()),
578+ "cus_domain" : pd .CusDomain ,
579+ "folder" : pd .Folder ,
580+ "created_at" : sd .Timestamp ,
581+ })
605582}
606583
607584// ========== 辅助函数 ==========
0 commit comments