Better licences page
This commit is contained in:
parent
150c289741
commit
8155b54f99
5 changed files with 1219 additions and 1046 deletions
|
|
@ -29,3 +29,9 @@ func SetColorMode(c *fiber.Ctx) error {
|
|||
colorMode,
|
||||
))
|
||||
}
|
||||
|
||||
func Licences(c *fiber.Ctx) error {
|
||||
return c.Render("licences", fiber.Map{
|
||||
"PageTitle": "Licences",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
TPL_LOCATION="$SCRIPT_DIR/template.html"
|
||||
STATIC_LOCATION="$SCRIPT_DIR/../static/licences.html"
|
||||
STATIC_LOCATION="$SCRIPT_DIR/../views/licences.html"
|
||||
PROJECT_URL="git.readonly.ch/bouzoure/pop-camarades"
|
||||
|
||||
go-licenses report "$PROJECT_URL" --template "$TPL_LOCATION" > "$STATIC_LOCATION"
|
||||
|
|
|
|||
|
|
@ -1,39 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Licences</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: serif;
|
||||
}
|
||||
pre {
|
||||
background-color: lightgrey;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "layouts/main.html" %}
|
||||
|
||||
{% block main %}
|
||||
<div class="container">
|
||||
{{ range . }}
|
||||
<div>
|
||||
<h3>{{ .Name }}</h3>
|
||||
<ul>
|
||||
<li>Name: {{ .Name }}</li>
|
||||
<li>Version: {{ .Version }}</li>
|
||||
<li>
|
||||
License:
|
||||
{{ if ne .LicenseURL "Unknown" }}
|
||||
<a href="{{ .LicenseURL }}">
|
||||
<div class="my-5">
|
||||
<span class="h3 my-3">
|
||||
{{ .Name }}
|
||||
</span>
|
||||
<ul class="list-group my-3">
|
||||
<li class="list-group-item">
|
||||
<b>Version:</b> {{ .Version }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>License:</b>
|
||||
{{ if ne .LicenseURL "Unknown" }}
|
||||
<a href="{{ .LicenseURL }}">
|
||||
{{ .LicenseName }}
|
||||
</a>
|
||||
{{ else }}
|
||||
{{ .LicenseName }}
|
||||
</a>
|
||||
{{ else }}
|
||||
{{ .LicenseName }}
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
<pre>{{ .LicenseText }}</pre>
|
||||
</div>
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
<pre>{{ .LicenseText }}</pre>
|
||||
</div>
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
{% endblock %}
|
||||
4
main.go
4
main.go
|
|
@ -91,6 +91,10 @@ func main() {
|
|||
// Misc endpoints without auth
|
||||
app.Post("/set-color-mode", controllers.SetColorMode)
|
||||
|
||||
// Licences page
|
||||
app.Use("/licences", middlewares.TemplatesMiddleware)
|
||||
app.Get("/licences", controllers.Licences)
|
||||
|
||||
// Security middlewares
|
||||
app.Use(middlewares.SavedSessionMiddleware)
|
||||
app.Use(middlewares.AuthMiddleware)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue