diff --git a/bookmark.go b/bookmark.go
index 10fc84a..dd2e20b 100644
--- a/bookmark.go
+++ b/bookmark.go
@@ -10,6 +10,24 @@ var (
Link: "https://duckduckgo.com/",
Color: "#e37151",
},
+ {
+ Title: "Cloud",
+ Image: "https://cloud.tordarus.net/svg/core/logo/logo?color=ffffff&v=1",
+ Link: "https://cloud.tordarus.net/",
+ Color: "#007ec2",
+ },
+ {
+ Title: "Torrents",
+ Image: "/transmission.png",
+ Link: "https://torrents.tordarus.net/",
+ Color: "#e7402c",
+ },
+ {
+ Title: "Adblock",
+ Image: "/pihole.svg",
+ Link: "https://adblock.tordarus.net/",
+ Color: "#272c30",
+ },
{
Title: "Postbank",
Image: "https://wintouch.de/wp-content/uploads/2014/06/Postbank-Icon.png",
@@ -37,6 +55,12 @@ var (
Link: "https://www.youtube.com/",
IconPadding: "1.5em",
},
+ {
+ Title: "Netflix",
+ Image: "https://1000logos.net/wp-content/uploads/2017/05/emblem-Netflix.jpg",
+ Color: "#000000",
+ Link: "https://www.netflix.com/",
+ },
{
Title: "Jisho",
Image: "https://assets.jisho.org/assets/jisho-logo-v4@2x-7330091c079b9dd59601401b052b52e103978221c8fb6f5e22406d871fcc746a.png",
@@ -77,6 +101,14 @@ var (
ImageSize: "cover",
IconPadding: "0em",
},
+ {
+ Title: "Regexr",
+ Image: "https://raw.githubusercontent.com/gskinner/regexr/master/dev/icons/RegExr.svg",
+ Link: "https://regex.tordarus.net",
+ Color: "#101112",
+ ImageSize: "contain",
+ IconPadding: "0em",
+ },
{
Title: "Wikipedia",
Image: "https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg",
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..95d901d
--- /dev/null
+++ b/index.html
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/main.go b/main.go
index 4b21ac5..17dcf43 100644
--- a/main.go
+++ b/main.go
@@ -43,7 +43,10 @@ func main() {
http.HandleFunc("/", handler)
http.HandleFunc("/search", search)
http.HandleFunc("/style.css", style)
- http.HandleFunc("/icons.ttf", icons)
+ http.HandleFunc("/icons.ttf", ProvideFile("static/icons.ttf", "font/ttf"))
+ http.HandleFunc("/transmission.png", ProvideFile("static/transmission.png", "image/png"))
+ http.HandleFunc("/pihole.svg", ProvideFile("static/pihole.svg", "image/svg+xml"))
+ http.HandleFunc("/gitea.png", ProvideFile("static/gitea.png", "image/png"))
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", *intf, *port), nil); err != nil {
panic(err)
}
@@ -77,22 +80,27 @@ func style(w http.ResponseWriter, r *http.Request) {
}
}
-func icons(w http.ResponseWriter, r *http.Request) {
- file, err := StaticFS.Open("static/icons.ttf")
- if err != nil {
+func ProvideFile(path, contentType string) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ file, err := StaticFS.Open(path)
+ if err != nil {
+ fmt.Println(err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ defer file.Close()
+ w.Header().Add("Content-Type", contentType)
+ io.Copy(w, file)
+ }
+}
+
+func search(w http.ResponseWriter, r *http.Request) {
+ if err := r.ParseForm(); err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
- defer file.Close()
- w.Header().Add("Content-Type", "font/ttf")
-
- io.Copy(w, file)
-}
-
-func search(w http.ResponseWriter, r *http.Request) {
- r.ParseForm()
query := r.Form.Get("query")
if uri, err := ParseURI(query); err == nil {
@@ -104,12 +112,14 @@ func search(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Location", fmt.Sprintf("https://duckduckgo.com/?q=%s", query))
w.WriteHeader(http.StatusMovedPermanently)
}
+
}
func ParseURI(uri string) (*url.URL, error) {
if !strings.HasPrefix(uri, "http://") && !strings.HasPrefix(uri, "https://") {
uri = "https://" + uri
}
+
ret, err := url.ParseRequestURI(uri)
if err != nil {
return nil, err
diff --git a/static/gitea.png b/static/gitea.png
new file mode 100644
index 0000000..e609ab3
Binary files /dev/null and b/static/gitea.png differ
diff --git a/static/pihole.svg b/static/pihole.svg
new file mode 100644
index 0000000..3955f31
--- /dev/null
+++ b/static/pihole.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/static/transmission.png b/static/transmission.png
new file mode 100644
index 0000000..1f37bab
Binary files /dev/null and b/static/transmission.png differ
diff --git a/templates/style.css b/templates/style.css
index 52741ed..c31a0f2 100644
--- a/templates/style.css
+++ b/templates/style.css
@@ -143,4 +143,6 @@ main {
background-position: center;
background-size: contain;
background-repeat: no-repeat;
+
+ border-radius: {{ .BorderRadius }};
}
\ No newline at end of file
diff --git a/top_level_domains.go b/top_level_domains.go
index f9a57c1..fb1ceeb 100644
--- a/top_level_domains.go
+++ b/top_level_domains.go
@@ -1,6 +1,8 @@
package main
var TLDs = map[string]struct{}{
+ "localhost": {},
+ "localdomain": {},
"abudhabi": {},
"ae": {},
"af": {},
@@ -1315,7 +1317,6 @@ var TLDs = map[string]struct{}{
"example": {},
"invalid": {},
"local": {},
- "localhost": {},
"onion": {},
"test": {},
"eth": {},