X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=hr.go;h=687f4607e03c80e525ddfc656cab0606f8066605;hb=10711e8819e19eae53fdd0f4252acfeb8619ef09;hp=b751e4dd2ccd9aae55c33fdc8ddf3bcbc7caf928;hpb=371b9da450b741c6dc50cf5427fcbdec4335d0fc;p=gocheese.git diff --git a/hr.go b/hr.go index b751e4d..687f460 100644 --- a/hr.go +++ b/hr.go @@ -1,6 +1,6 @@ /* GoCheese -- Python private package repository and caching proxy -Copyright (C) 2019-2021 Sergey Matveev +Copyright (C) 2019-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package main import ( "bytes" + _ "embed" "html/template" "io/ioutil" "log" @@ -29,97 +30,13 @@ import ( ) var ( - HRRootTmpl = template.Must(template.New("hr-root").Parse(` - - - {{.Version}}: packages - - - - - -`)) - HRPkgTmpl = template.Must(template.New("hr-pkg").Parse(` - - - {{.Version}}: package {{.PkgName}} - - -
- {{with .Info.Name}}
Name
{{.}}
{{end}} - {{with .Info.Version}}
Version
{{.}}
{{end}} + //go:embed hr-root.tmpl + HRRootTmplRaw string + HRRootTmpl = template.Must(template.New("hr-root").Parse(HRRootTmplRaw)) - {{with .Info.Platform}}
Platform
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - - {{with .Info.SupportedPlatform}}
SupportedPlatform
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - -
Summary
{{.Info.Summary}}
-
Description
-{{.Info.Description}}
-      
- - {{with .Info.DescriptionContentType}}
DescriptionContentType
{{.}}
{{end}} - {{with .Info.Keywords}}
Keywords
{{.}}
{{end}} - {{with .Info.HomePage}}
HomePage
{{.}}
{{end}} - {{with .Info.Author}}
Author
{{.}}
{{end}} - {{with .Info.AuthorEmail}}
AuthorEmail
{{.}}
{{end}} - {{with .Info.Maintainer}}
Maintainer
{{.}}
{{end}} - {{with .Info.MaintainerEmail}}
MaintainerEmail
{{.}}
{{end}} - {{with .Info.License}}
License
{{.}}
{{end}} - - {{with .Info.Classifier}}
Classifier
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - - {{with .Info.RequiresDist}}
RequiresDist
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - - {{with .Info.RequiresPython}}
RequiresPython
{{.}}
{{end}} - - {{with .Info.RequiresExternal}}
RequiresExternal
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - - {{with .Info.ProjectURL}}
ProjectURL
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} - - {{with .Info.ProvidesExtra}}
ProvidesExtra
    - {{range .}}
  • {{.}}
  • - {{end}}
{{end}} -
- -

Releases

- - - - - - - - - {{range .Releases}}{{if .Size}} - - - {{end}}{{end}} -
FilenameVersionUploadedSizeDigests
{{.Filename}} - {{.Version}} - {{.UploadTimeISO8601}} - {{.Size}} -
    {{range $a, $d := .Digests}} -
  • {{$a}}: {{$d}}
  • - {{end}}
- - -`)) + //go:embed hr-pkg.tmpl + HRPkgTmplRaw string + HRPkgTmpl = template.Must(template.New("hr-pkg").Parse(HRPkgTmplRaw)) ) func serveHRRoot(w http.ResponseWriter, r *http.Request) {