mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:57:32 +00:00
fix: return full url of assets in admin and mgmt api (#3157)
* fix: return full url of assets in admin and mgmt api * remove asset loading over asset service * remove unused code Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
@@ -13,7 +13,7 @@ func (s *Server) GetLabelPolicy(ctx context.Context, req *admin_pb.GetLabelPolic
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &admin_pb.GetLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy)}, nil
|
||||
return &admin_pb.GetLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy, s.assetsAPIDomain)}, nil
|
||||
}
|
||||
|
||||
func (s *Server) GetPreviewLabelPolicy(ctx context.Context, req *admin_pb.GetPreviewLabelPolicyRequest) (*admin_pb.GetPreviewLabelPolicyResponse, error) {
|
||||
@@ -21,7 +21,7 @@ func (s *Server) GetPreviewLabelPolicy(ctx context.Context, req *admin_pb.GetPre
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &admin_pb.GetPreviewLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy)}, nil
|
||||
return &admin_pb.GetPreviewLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy, s.assetsAPIDomain)}, nil
|
||||
}
|
||||
|
||||
func (s *Server) UpdateLabelPolicy(ctx context.Context, req *admin_pb.UpdateLabelPolicyRequest) (*admin_pb.UpdateLabelPolicyResponse, error) {
|
||||
|
@@ -14,7 +14,7 @@ func (s *Server) GetLabelPolicy(ctx context.Context, req *mgmt_pb.GetLabelPolicy
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mgmt_pb.GetLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy), IsDefault: policy.IsDefault}, nil
|
||||
return &mgmt_pb.GetLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy, s.assetAPIPrefix), IsDefault: policy.IsDefault}, nil
|
||||
}
|
||||
|
||||
func (s *Server) GetPreviewLabelPolicy(ctx context.Context, req *mgmt_pb.GetPreviewLabelPolicyRequest) (*mgmt_pb.GetPreviewLabelPolicyResponse, error) {
|
||||
@@ -22,7 +22,7 @@ func (s *Server) GetPreviewLabelPolicy(ctx context.Context, req *mgmt_pb.GetPrev
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mgmt_pb.GetPreviewLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy), IsDefault: policy.IsDefault}, nil
|
||||
return &mgmt_pb.GetPreviewLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy, s.assetAPIPrefix), IsDefault: policy.IsDefault}, nil
|
||||
}
|
||||
|
||||
func (s *Server) GetDefaultLabelPolicy(ctx context.Context, req *mgmt_pb.GetDefaultLabelPolicyRequest) (*mgmt_pb.GetDefaultLabelPolicyResponse, error) {
|
||||
@@ -30,7 +30,7 @@ func (s *Server) GetDefaultLabelPolicy(ctx context.Context, req *mgmt_pb.GetDefa
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mgmt_pb.GetDefaultLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy)}, nil
|
||||
return &mgmt_pb.GetDefaultLabelPolicyResponse{Policy: policy_grpc.ModelLabelPolicyToPb(policy, s.assetAPIPrefix)}, nil
|
||||
}
|
||||
|
||||
func (s *Server) AddCustomLabelPolicy(ctx context.Context, req *mgmt_pb.AddCustomLabelPolicyRequest) (*mgmt_pb.AddCustomLabelPolicyResponse, error) {
|
||||
|
@@ -2,11 +2,12 @@ package policy
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/api/grpc/object"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/query"
|
||||
policy_pb "github.com/caos/zitadel/pkg/grpc/policy"
|
||||
)
|
||||
|
||||
func ModelLabelPolicyToPb(policy *query.LabelPolicy) *policy_pb.LabelPolicy {
|
||||
func ModelLabelPolicyToPb(policy *query.LabelPolicy, assetPrefix string) *policy_pb.LabelPolicy {
|
||||
return &policy_pb.LabelPolicy{
|
||||
IsDefault: policy.IsDefault,
|
||||
PrimaryColor: policy.Light.PrimaryColor,
|
||||
@@ -17,11 +18,11 @@ func ModelLabelPolicyToPb(policy *query.LabelPolicy) *policy_pb.LabelPolicy {
|
||||
BackgroundColorDark: policy.Dark.BackgroundColor,
|
||||
WarnColorDark: policy.Dark.WarnColor,
|
||||
FontColorDark: policy.Dark.FontColor,
|
||||
FontUrl: policy.FontURL,
|
||||
LogoUrl: policy.Light.LogoURL,
|
||||
LogoUrlDark: policy.Dark.LogoURL,
|
||||
IconUrl: policy.Light.IconURL,
|
||||
IconUrlDark: policy.Dark.IconURL,
|
||||
FontUrl: domain.AssetURL(assetPrefix, policy.ResourceOwner, policy.FontURL),
|
||||
LogoUrl: domain.AssetURL(assetPrefix, policy.ResourceOwner, policy.Light.LogoURL),
|
||||
LogoUrlDark: domain.AssetURL(assetPrefix, policy.ResourceOwner, policy.Dark.LogoURL),
|
||||
IconUrl: domain.AssetURL(assetPrefix, policy.ResourceOwner, policy.Light.IconURL),
|
||||
IconUrlDark: domain.AssetURL(assetPrefix, policy.ResourceOwner, policy.Dark.IconURL),
|
||||
|
||||
DisableWatermark: policy.WatermarkDisabled,
|
||||
HideLoginNameSuffix: policy.HideLoginNameSuffix,
|
||||
|
Reference in New Issue
Block a user