forked from FrenchGithubUser/Hatt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistWebsites.go
43 lines (38 loc) · 1 KB
/
listWebsites.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"hatt/assets"
"hatt/configuration"
"hatt/helpers"
)
func (a *App) GetWebsitesWithCategories(selectedCategories []string) []string {
var websites []string
configFiles := assets.GetWebsiteConfigs()
for _, configFile := range configFiles {
var conf configuration.Config = assets.DeserializeWebsiteConf(configFile.Name())
for _, category := range selectedCategories {
if helpers.IsStringInSlice(conf.Categories, category) || category == "all" {
websites = append(websites, conf.Name)
break
}
}
}
return websites
}
type website struct {
Name string
Fields []string
}
func (a *App) GetWebsitesWithLogin() []website {
var websites []website
configFiles := assets.GetWebsiteConfigs()
for _, configFile := range configFiles {
var config configuration.Config = assets.DeserializeWebsiteConf(configFile.Name())
if config.Login.Url != "" {
websites = append(websites, website{
Name: config.Name,
Fields: config.Login.Fields,
})
}
}
return websites
}