package main import ( "sort" "strings" ) func DefaultBookmarks() []Bookmark { bookmarks := []Bookmark{ { Title: "DuckDuckGo", Image: "https://duckduckgo.com/assets/logo_homepage.alt.v108.svg", Link: "https://duckduckgo.com/", Color: "#e37151", }, { Title: "Google Dark", Image: "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png", Link: "https://google.com/", Color: "#202124", }, { Title: "Google Light", Image: "https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png", Link: "https://google.com/", Color: "#ffffff", }, { Title: "Wikipedia", Image: "https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg", Color: "#ffffff", Link: "https://www.wikipedia.org/", }, { Title: "Reddit", Image: "https://www.redditinc.com/assets/images/site/reddit-logo.png", Link: "https://www.reddit.com/", Color: "#ff4300", ImageSize: "cover", IconPadding: "0em", }, { Title: "YouTube", Image: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/YouTube_light_icon_%282017%29.svg/1280px-YouTube_light_icon_%282017%29.svg.png", Link: "https://www.youtube.com/", Color: "#ff0000", IconPadding: "1.5em", }, { Title: "Netflix", Image: "https://1000logos.net/wp-content/uploads/2017/05/emblem-Netflix.jpg", Link: "https://www.netflix.com/", Color: "#000000", }, { Title: "Übersetzer", Image: "https://tools.avans.nl/tools/image/wZkdyaMblN.jpg", Link: "https://www.deepl.com/translator", Color: "#042b48", ImageSize: "cover", IconPadding: "0em", }, { Title: "Cloud", Image: "https://cloud.tordarus.net/svg/core/logo/logo?color=ffffff\u0026v=1", Link: "https://cloud.tordarus.net/", Color: "#007ec2", }, { Title: "Passwörter", Image: "https://raw.githubusercontent.com/dani-garcia/vaultwarden/main/resources/vaultwarden-logo-white.svg", Link: "https://pw.tordarus.net", Color: "#175ddc", }, } Reorder(bookmarks) return bookmarks } type Bookmark struct { Title string `json:"title"` Image string `json:"image"` ImageSize string `json:"image_size"` IconPadding string `json:"icon_padding"` Color string `json:"color"` Link string `json:"link"` HideBorder bool `json:"hide_border"` Order int `json:"order"` } func (b *Bookmark) GetColor() string { if b.Color == "" { b.Color = "transparent" } return b.Color } func (b *Bookmark) GetImageSize() string { if b.ImageSize == "" { b.ImageSize = "contain" } return b.ImageSize } func (b *Bookmark) SmallLink() string { lnk := b.Link lnk = strings.TrimPrefix(lnk, "https://") lnk = strings.TrimPrefix(lnk, "http://") lnk = strings.TrimSuffix(lnk, "/") return lnk } func Reorder(bookmarks []Bookmark) { sort.SliceStable(bookmarks, func(i, j int) bool { return bookmarks[i].Order < bookmarks[j].Order }) for index := range bookmarks { bookmarks[index].Order = index * 10 } }