Improved the default templates

This commit is contained in:
ChaoticByte 2023-10-19 20:50:32 +02:00
parent 676454972c
commit 8c427cc571

View file

@ -7,23 +7,26 @@ import (
"text/template" "text/template"
) )
const DEFAULT_SUBJECT_TEMPLATE = "{{ if .Status }}{{.Status}} {{ end }}[{{.Classification}}] {{.Title}}" const DEFAULT_SUBJECT_TEMPLATE = "[{{ .Classification }}] {{ .Title }}"
const DEFAULT_BODY_TEMPLATE = `{{.Name}} const DEFAULT_BODY_TEMPLATE = `{{ if .Status }}[{{ .Status }}] {{ end }}{{ .Name }}
{{.PortalUrl}} -> {{ .PortalUrl }}
{{- if eq .NoPatch "true" }}
Published: {{.Published}} No patch available!
{{ if gt .Basescore -1 }}Basescore: {{.Basescore}} {{- end }}
{{ end -}} {{ if gt .Basescore -1 }}
{{ if eq .NoPatch "true" }}There is no patch available at the moment! Basescore: {{ .Basescore }}{{- end }}
{{ end }} Published: {{ .Published }}
Affected Products: {{- if .ProductNames }}
{{ range $product := .ProductNames }} - {{ $product }}
{{ else }} unknown Affected Products:{{ range $product := .ProductNames }}
{{ end }} - {{ $product }}
Assigned CVEs: {{- end }}{{ end }}
{{ range $cve := .Cves }} - {{ $cve }} {{- if .Cves }}
{{ else }} unknown
{{ end }}` Assigned CVEs:{{ range $cve := .Cves }}
- {{ $cve }} -> https://www.cve.org/CVERecord?id={{ $cve }}
{{- end }}{{ end }}`
type MailTemplateConfig struct { type MailTemplateConfig struct {
SubjectTemplate string `json:"subject"` SubjectTemplate string `json:"subject"`