From fd455b04fd31a84cfd666b21f5814cd7d48c92d1 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 11 Feb 2020 19:38:49 +0100 Subject: New paths --- dir.html | 520 ------------------------------------------------------- pink.svg | 23 --- server.go | 12 +- src/dir.tmpl | 520 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/request.tmpl | 33 ++++ static/ban.svg | 339 ++++++++++++++++++++++++++++++++++++ static/pink.svg | 23 +++ test.svg | 339 ------------------------------------ xml.tmpl | 33 ---- 9 files changed, 921 insertions(+), 921 deletions(-) delete mode 100644 dir.html delete mode 100644 pink.svg create mode 100644 src/dir.tmpl create mode 100644 src/request.tmpl create mode 100644 static/ban.svg create mode 100644 static/pink.svg delete mode 100644 test.svg delete mode 100644 xml.tmpl diff --git a/dir.html b/dir.html deleted file mode 100644 index 95bbdcf..0000000 --- a/dir.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - {{if .Name}}{{ .Name }}{{end}} - - -
-
- - -
-
-
- -
-
-
-
-
-
-
- -
-
-
-
- -
-
-
- Réponse du server : -
- -
-
-
- -
- - - - diff --git a/pink.svg b/pink.svg deleted file mode 100644 index 55f4952..0000000 --- a/pink.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - diff --git a/server.go b/server.go index d00bd6e..1bc72d2 100644 --- a/server.go +++ b/server.go @@ -423,16 +423,16 @@ func main() { "formatSize": normaliseSize, "formatName": normaliseName, } - tmpl = template.Must(template.New("dir.html").Funcs(fmap).ParseFiles("dir.html")) - tmplXML = template.Must(template.New("xml.tmpl").Funcs(fmap).ParseFiles("xml.tmpl")) + tmpl = template.Must(template.New("dir.tmpl").Funcs(fmap).ParseFiles("src/dir.tmpl")) + tmplXML = template.Must(template.New("request.tmpl").Funcs(fmap).ParseFiles("src/request.tmpl")) baseWd,_ := os.Getwd(); - http.HandleFunc("/pink.svg", func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, baseWd + "/pink.svg") + http.HandleFunc("/pink_davy.svg", func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, baseWd + "/static/pink.svg") }); - http.HandleFunc("/test.svg", func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, baseWd + "/test.svg") + http.HandleFunc("/ban_davy.svg", func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, baseWd + "/static/ban.svg") }) if err := os.Chdir(dir) ; err != nil { diff --git a/src/dir.tmpl b/src/dir.tmpl new file mode 100644 index 0000000..9c864f7 --- /dev/null +++ b/src/dir.tmpl @@ -0,0 +1,520 @@ + + + + {{if .Name}}{{ .Name }}{{end}} + + +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ Réponse du server : +
+ +
+
+
+ +
+ + + + diff --git a/src/request.tmpl b/src/request.tmpl new file mode 100644 index 0000000..1b67212 --- /dev/null +++ b/src/request.tmpl @@ -0,0 +1,33 @@ + + + +{{ .Href }} + + +{{ .Name }} +{{ .Date }} + + + + + +HTTP/1.1 200 OK + + +{{range .ListFiles}} +{{ .Href }} + + +{{ .DisplayName }} +{{ .Size }} +{{ .LastModifier }} +{{ if .IsDir }}{{end}} + + + + +HTTP/1.1 {{ .Status }} + + +{{end}} + diff --git a/static/ban.svg b/static/ban.svg new file mode 100644 index 0000000..bd3655d --- /dev/null +++ b/static/ban.svg @@ -0,0 +1,339 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Davy Webserver ! + + diff --git a/static/pink.svg b/static/pink.svg new file mode 100644 index 0000000..55f4952 --- /dev/null +++ b/static/pink.svg @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/test.svg b/test.svg deleted file mode 100644 index bd3655d..0000000 --- a/test.svg +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Davy Webserver ! - - diff --git a/xml.tmpl b/xml.tmpl deleted file mode 100644 index 1b67212..0000000 --- a/xml.tmpl +++ /dev/null @@ -1,33 +0,0 @@ - - - -{{ .Href }} - - -{{ .Name }} -{{ .Date }} - - - - - -HTTP/1.1 200 OK - - -{{range .ListFiles}} -{{ .Href }} - - -{{ .DisplayName }} -{{ .Size }} -{{ .LastModifier }} -{{ if .IsDir }}{{end}} - - - - -HTTP/1.1 {{ .Status }} - - -{{end}} - -- cgit v1.2.3