mirror of
https://github.com/axllent/mailpit.git
synced 2025-03-19 21:28:07 +02:00
39 lines
807 B
Go
39 lines
807 B
Go
|
package htmlcheck
|
||
|
|
||
|
import "sort"
|
||
|
|
||
|
// Platforms returns all platforms with their respective email clients
|
||
|
func Platforms() (map[string][]string, error) {
|
||
|
// [platform]clients
|
||
|
data := make(map[string][]string)
|
||
|
|
||
|
if err := loadJSONData(); err != nil {
|
||
|
return data, err
|
||
|
}
|
||
|
|
||
|
for _, t := range cie.Data {
|
||
|
for family, stats := range t.Stats {
|
||
|
niceFamily := cie.NiceNames.Family[family]
|
||
|
for platform := range stats.(map[string]interface{}) {
|
||
|
c, found := data[platform]
|
||
|
if !found {
|
||
|
data[platform] = []string{}
|
||
|
}
|
||
|
if !inArray(niceFamily, c) {
|
||
|
c = append(c, niceFamily)
|
||
|
data[platform] = c
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for group, clients := range data {
|
||
|
sort.Slice(clients, func(i, j int) bool {
|
||
|
return clients[i] < clients[j]
|
||
|
})
|
||
|
data[group] = clients
|
||
|
}
|
||
|
|
||
|
return data, nil
|
||
|
}
|