aboutsummaryrefslogtreecommitdiff
blob: 7d4311d0a9e1b3782be7ed80f35f5dfbce1dedd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package about

import "net/http"
import "runtime/debug"
import "soko/pkg/app/layout"
import "soko/pkg/config"

func getCommitId() string {
	if info, ok := debug.ReadBuildInfo(); ok {
		for _, setting := range info.Settings {
			if setting.Key == "vcs.revision" {
				return setting.Value[:8]
			}
		}
	}
	return ""
}

func versionText() string {
	commitId := getCommitId()
	version := config.Version()
	if commitId == "" {
		return "Currently " + version + " is running."
	}
	return "Currently " + version + " is running, based on commit " + commitId + "."
}

templ index() {
	<div class="container mb-5">
		<div class="row">
			<div class="col-12 text-center">
				<h1 class="px-3 pt-5 pb-1" style="font-size: 3em;">About packages.gentoo.org</h1>
				<span style="font-size: 90%;" class="text-muted">
					Feel free to <a href="/about/feedback">get in touch</a> { "if" } you have any questions that are not answered on this page.
					<br/>
					And welcome to the new packages.gentoo.org!
				</span>
			</div>
			<div class="col-12 mt-5 pt-4">
				<h2>FAQ</h2>
				<dl>
					<dt>Which version is currently running?</dt>
					<dd>{ versionText() }</dd>
					<br/>
					<dt>How often is the site updated?</dt>
					<dd>
						Updates are scheduled <strong>every 5 minutes now</strong>.
						You can find the last time an import task was started in the footer.
					</dd>
				</dl>
			</div>
		</div>
	</div>
}

// Index shows the landing page of the about pages
func Index(w http.ResponseWriter, r *http.Request) {
	layout.Layout("About", layout.About, index()).Render(r.Context(), w)
}