add logs, fix design
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
|
||||
<body>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<span style="margin-left: 1rem;" class="navbar-brand mb-0 h1">DownloadHub</span>
|
||||
<a style="margin-left: 1rem;" class="navbar-brand mb-0 h1" href="/">DownloadHub</a>
|
||||
</nav>
|
||||
<div class="container" style="margin-top: 1rem;">
|
||||
<div class="container" style="margin-top: 1rem; margin-bottom: 1rem;">
|
||||
<h2>{{.Name}} ({{.Version}})</h2>
|
||||
<img width="100%" src="{{index .ScreenshotURLs 0}}" />
|
||||
<p>{{.Description}}</p>
|
||||
@@ -32,7 +32,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js"
|
||||
integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy"
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
<div class="col-3">
|
||||
<img width="100%" src="{{index .ScreenshotURLs 0}}" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col">
|
||||
<h2><a href="/d/{{.UUID}}">{{.Name}}</a></h2>
|
||||
<p>{{.Description}}</p>
|
||||
</div>
|
||||
<hr />
|
||||
<hr style="margin-top: 1rem;" />
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
16
main.go
16
main.go
@@ -4,15 +4,25 @@ import (
|
||||
"downloadhub/api"
|
||||
"downloadhub/data"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var configFile string
|
||||
flag.StringVar(&configFile, "c", "config.json", "Configuration file path")
|
||||
var port int
|
||||
flag.StringVar(&configFile, "c", "config.json", "configuration file path")
|
||||
flag.IntVar(&port, "p", 3000, "port of the server")
|
||||
flag.Parse()
|
||||
|
||||
slog.Info("loading configuration...")
|
||||
d := data.Load(configFile)
|
||||
slog.Info("configuration loaded!")
|
||||
|
||||
s := api.New(3000, d)
|
||||
s.Serve()
|
||||
slog.Info(fmt.Sprintf("starting server on :%d", port))
|
||||
s := api.New(uint16(port), d)
|
||||
err := s.Serve()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user