icons improved
This commit is contained in:
parent
02100fe744
commit
b9c002a72b
32
bookmark.go
32
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",
|
||||
|
3
index.html
Normal file
3
index.html
Normal file
@ -0,0 +1,3 @@
|
||||
<svg class="icon logo inline"><use xlink:href="#RegExr">
|
||||
<symbol id="RegExr" viewBox="0 0 64 64"><path d="M0 0v64h64V0H0zm23.799 52.045H11.783V40.029h12.016v12.016zm29.957-22.401l-5.396 5.235-6.765-11.033L34.67 35.12l-5.396-5.235 9.744-7.328-13.046-4.188 3.785-6.604 10.711 8.617L37.65 7.739h7.57l-2.899 12.643 10.791-8.617 3.785 6.604-12.804 4.027 9.663 7.248z"></path></symbol>
|
||||
</use></svg>
|
After Width: | Height: | Size: 393 B |
24
main.go
24
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")
|
||||
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", "font/ttf")
|
||||
|
||||
w.Header().Add("Content-Type", contentType)
|
||||
io.Copy(w, file)
|
||||
}
|
||||
}
|
||||
|
||||
func search(w http.ResponseWriter, r *http.Request) {
|
||||
r.ParseForm()
|
||||
if err := r.ParseForm(); err != nil {
|
||||
fmt.Println(err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
|
BIN
static/gitea.png
Normal file
BIN
static/gitea.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
1
static/pihole.svg
Normal file
1
static/pihole.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88.32 129.93"><defs><linearGradient id="New_Gradient_Swatch_1" x1="2.71" x2="69.77" y1="20.04" y2="20.04" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#12b212"/><stop offset="1" stop-color="#0f0"/></linearGradient><style>.cls-2{fill:#980200}.cls-3{fill:red}</style></defs><title>NewVortex</title><path fill="url(#New_Gradient_Swatch_1)" d="M36.56 39.93C20.34 38.2 4 25.94 2.71 0c25.17 0 38.63 14.9 39.93 38.51 4.76-28.32 27.07-25 27.07-25 1.06 16.05-12.12 25.78-27.07 26.59-4.2-8.85-29.36-30.56-29.36-30.56a.07.07 0 00-.11.08s24.28 21.15 23.39 30.31"/><path d="M44.16 129.93c-1.57-.09-16.22-.65-17.11-17.11-.72-10 7.18-17.37 7.18-27.08C32.44 61.53 0 64.53 0 85.74a19.94 19.94 0 005.83 14.14L30 124.06a19.94 19.94 0 0014.14 5.83" class="cls-2"/><path d="M88.32 85.75c-.09 1.57-.65 16.22-17.11 17.11-10 .72-17.38-7.18-27.08-7.18-24.21 1.79-21.21 34.22 0 34.22a19.94 19.94 0 0014.14-5.83L82.46 99.9a19.94 19.94 0 005.83-14.14" class="cls-3"/><path d="M44.16 41.59c1.57.09 16.22.65 17.11 17.11.72 10-7.18 17.37-7.18 27.08 1.79 24.21 34.22 21.21 34.22 0a19.94 19.94 0 00-5.83-14.14L58.3 47.45a19.94 19.94 0 00-14.14-5.83" class="cls-2"/><path d="M.08 85.75c.09-1.57.65-16.22 17.11-17.11 10-.72 17.38 7.18 27.08 7.18 24.21-1.82 21.21-34.22 0-34.22a19.94 19.94 0 00-14.14 5.83L5.94 71.61A19.94 19.94 0 00.11 85.75" class="cls-3"/></svg>
|
After Width: | Height: | Size: 1.4 KiB |
BIN
static/transmission.png
Normal file
BIN
static/transmission.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -143,4 +143,6 @@ main {
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
border-radius: {{ .BorderRadius }};
|
||||
}
|
@ -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": {},
|
||||
|
Loading…
Reference in New Issue
Block a user