do some cssy stuff
This commit is contained in:
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ gen:
|
||||
#go run -tags generate gen.go
|
||||
|
||||
fmt: clean
|
||||
gofmt -w -s *.go
|
||||
gofmt -w -s *.go reseed-monitor/main.go
|
||||
|
||||
setup: fmt
|
||||
rsync -rav ~/i2p/certificates/ssl/ ssl/
|
||||
|
540
index.html
540
index.html
File diff suppressed because one or more lines are too long
4
page.go
4
page.go
@ -78,9 +78,9 @@ func GeneratePage() (string, error) {
|
||||
}
|
||||
Valid, Errored := CheckKeys(su3file, "./reseed")
|
||||
if Errored != nil {
|
||||
ret += `<div id="` + TrimDir(path) + ` Invalid">` + Errored.Error() + `</div>`
|
||||
ret += `<div class="` + TrimDir(path) + ` Invalid">` + Errored.Error() + `</div>`
|
||||
} else {
|
||||
ret += `<div id="` + TrimDir(path) + ` Valid">` + Valid + `</div>`
|
||||
ret += `<div class="` + TrimDir(path) + ` Valid">` + Valid + `</div>`
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1,12 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"github.com/eyedeekay/reseed-monitoring"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/eyedeekay/reseed-monitoring"
|
||||
)
|
||||
|
||||
func main() {
|
||||
go loop()
|
||||
if err := http.ListenAndServe("127.0.0.1:7672", &monitor.MonitorServer{}); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func loop() {
|
||||
for {
|
||||
config, err := monitor.SortedMap("config.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@ -21,5 +32,10 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ioutil.WriteFile("index.html", []byte(index), 0644)
|
||||
err = ioutil.WriteFile("index.html", []byte(index), 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
time.Sleep(time.Duration(24 * time.Hour))
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
36
server.go
Normal file
36
server.go
Normal file
@ -0,0 +1,36 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type MonitorServer struct {
|
||||
}
|
||||
|
||||
func (m *MonitorServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
path := strings.TrimSpace(strings.Replace(r.URL.Path, "/", "", -1))
|
||||
//path = strings.Replace(r.URL.Path, ".", "", -1)
|
||||
if r.URL.Path == "/" {
|
||||
r.URL.Path = "/index.html"
|
||||
}
|
||||
|
||||
if strings.HasSuffix(r.URL.Path, ".css") {
|
||||
w.Header().Set("Content-Type", "text/css")
|
||||
} else if strings.HasSuffix(r.URL.Path, ".js") {
|
||||
w.Header().Set("Content-Type", "text/javascript")
|
||||
} else if strings.HasSuffix(r.URL.Path, ".png") {
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
} else {
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
}
|
||||
if strings.HasPrefix(path, "data-dir") {
|
||||
return
|
||||
}
|
||||
bytes, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
w.Write(bytes)
|
||||
}
|
34
style.css
34
style.css
@ -1,3 +1,37 @@
|
||||
.Reseed {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.key {
|
||||
border: 1px solid black;
|
||||
min-width: 20%;
|
||||
min-height: 15px;
|
||||
display: inline-block;
|
||||
overflow: scroll;
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.value {
|
||||
border: 1px solid black;
|
||||
min-width: 70%;
|
||||
max-width: 70%;
|
||||
font-family: monospace;
|
||||
min-height: 15px;
|
||||
display: inline-block;
|
||||
overflow: scroll;
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.Valid {
|
||||
overflow: scroll;
|
||||
min-width: 90%;
|
||||
max-width: 90%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.Invalid {
|
||||
overflow: scroll;
|
||||
min-width: 90%;
|
||||
max-width: 90%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
Reference in New Issue
Block a user