X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=list.go;h=356cd6bf01874f5aaf687028d3dfd556dc56db76;hb=cde8c8c45d508bf29d24365298f3c40c1729514c;hp=9c4c2912cb65e0d133df894441fa7145087e8b09;hpb=371b9da450b741c6dc50cf5427fcbdec4335d0fc;p=gocheese.git diff --git a/list.go b/list.go index 9c4c291..356cd6b 100644 --- a/list.go +++ b/list.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" "encoding/hex" "errors" "fmt" @@ -37,33 +38,14 @@ import ( // https://warehouse.pypa.io/api-reference/legacy.html var ( - HTMLRootTmpl = template.Must(template.New("root").Parse(` - - - - Simple index - - {{$Refresh := .RefreshURLPath}}{{range .Packages}} - {{.}}
-{{- end}} - - -`)) - HTMLReleasesTmpl = template.Must(template.New("list").Parse(` - - - - Links for {{.PkgName}} - - {{$Refresh := .RefreshURLPath}}{{$PkgName := .PkgName}}{{range .Releases}} - {{.Filename}}
-{{- end}} - - -`)) - KnownExts = []string{".tar.bz2", ".tar.gz", ".whl", ".zip", ".egg", + //go:embed root.tmpl + HTMLRootTmplRaw string + HTMLRootTmpl = template.Must(template.New("root").Parse(HTMLRootTmplRaw)) + + //go:embed list.tmpl + HTMLReleasesTmplRaw string + HTMLReleasesTmpl = template.Must(template.New("list").Parse(HTMLReleasesTmplRaw)) + KnownExts = []string{".tar.bz2", ".tar.gz", ".whl", ".zip", ".egg", ".exe", ".dmg", ".msi", ".rpm", ".deb", ".tgz"} )