🧑‍💻 Added revision info in templates footer

develop
Maxim Lebedev 6 months ago
parent b92992d1d6
commit 52166f6602
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
  1. 4
      Makefile
  2. 49
      catalog_gen.go
  3. 7
      locales/en/out.gotext.json
  4. 5
      locales/ru/messages.gotext.json
  5. 5
      locales/ru/out.gotext.json
  6. 29
      web/baseof.qtpl
  7. 311
      web/baseof.qtpl.go

@ -6,14 +6,14 @@ SHELL = /bin/sh
srcdir = .
GO ?= go
GOFLAGS ?=
GOFLAGS ?= -buildvcs=true
EXECUTABLE ?= indieauth
#### End of system configuration section. ####
.PHONY: all clean check help
all: main.go
all:
$(GO) build -v $(GOFLAGS) -o $(EXECUTABLE) $<
clean: ## Delete all files in the current directory that are normally created by building the program

@ -44,37 +44,38 @@ var messageKeyToIndex = map[string]int{
"Authorize application": 1,
"Choose your scopes": 2,
"Deny": 3,
"Error": 5,
"How do I fix it?": 6,
"Recipient": 9,
"Resource": 10,
"Send": 11,
"Sign In": 7,
"TicketAuth": 8,
"Error": 6,
"How do I fix it?": 7,
"Recipient": 10,
"Resource": 11,
"Send": 12,
"Sign In": 8,
"TicketAuth": 9,
"version": 5,
}
var enIndex = []uint32{ // 13 elements
var enIndex = []uint32{ // 14 elements
0x00000000, 0x00000010, 0x00000026, 0x00000039,
0x0000003e, 0x00000044, 0x0000004a, 0x0000005b,
0x00000063, 0x0000006e, 0x00000078, 0x00000081,
0x00000086,
} // Size: 76 bytes
0x0000003e, 0x00000044, 0x0000004c, 0x00000052,
0x00000063, 0x0000006b, 0x00000076, 0x00000080,
0x00000089, 0x0000008e,
} // Size: 80 bytes
const enData string = "" + // Size: 134 bytes
const enData string = "" + // Size: 142 bytes
"\x02Authorize %[1]s\x02Authorize application\x02Choose your scopes\x02De" +
"ny\x02Allow\x02Error\x02How do I fix it?\x02Sign In\x02TicketAuth\x02Rec" +
"ipient\x02Resource\x02Send"
"ny\x02Allow\x02version\x02Error\x02How do I fix it?\x02Sign In\x02Ticket" +
"Auth\x02Recipient\x02Resource\x02Send"
var ruIndex = []uint32{ // 13 elements
var ruIndex = []uint32{ // 14 elements
0x00000000, 0x0000001f, 0x0000004d, 0x0000008e,
0x0000009f, 0x000000b2, 0x000000bf, 0x000000e1,
0x000000ec, 0x000000f7, 0x0000010c, 0x00000119,
0x0000012c,
} // Size: 76 bytes
0x0000009f, 0x000000b2, 0x000000bf, 0x000000cc,
0x000000ee, 0x000000f9, 0x00000104, 0x00000119,
0x00000126, 0x00000139,
} // Size: 80 bytes
const ruData string = "" + // Size: 300 bytes
const ruData string = "" + // Size: 313 bytes
"\x02Авторизовать %[1]s\x02Авторизовать приложение\x02Выбери предоставляе" +
"мые разрешения\x02Отказать\x02Разрешить\x02Ошибка\x02Как исправить это?" +
"\x02Войти\x02TicketAuth\x02Получатель\x02Ресурс\x02Отправить"
"мые разрешения\x02Отказать\x02Разрешить\x02версия\x02Ошибка\x02Как испр" +
"авить это?\x02Войти\x02TicketAuth\x02Получатель\x02Ресурс\x02Отправить"
// Total table size 586 bytes (0KiB); checksum: D0ACA2B7
// Total table size 615 bytes (0KiB); checksum: 66FB60EC

@ -46,6 +46,13 @@
"translatorComment": "The name of the button to continue the application authorization process",
"fuzzy": true
},
{
"id": "version",
"message": "version",
"translation": "version",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Error",
"message": "Error",

@ -40,6 +40,11 @@
"translation": "Разрешить",
"translatorComment": "Название кнопки продолжения процесса авторизациии приложения"
},
{
"id": "version",
"message": "version",
"translation": "версия"
},
{
"id": "Error",
"message": "Error",

@ -40,6 +40,11 @@
"translation": "Разрешить",
"translatorComment": "Название кнопки продолжения процесса авторизациии приложения"
},
{
"id": "version",
"message": "version",
"translation": "версия"
},
{
"id": "Error",
"message": "Error",

@ -1,4 +1,6 @@
{% import (
"runtime/debug"
"golang.org/x/text/language"
"golang.org/x/text/message"
@ -75,6 +77,33 @@
</head>
<body class="page__body body">
{%= p.Body() %}
{% code
var path, vcsRevision string
if bi, ok := debug.ReadBuildInfo(); ok {
path = bi.Path
for i := range bi.Settings {
if bi.Settings[i].Key != "vcs.revision" {
continue
}
vcsRevision = bi.Settings[i].Value
}
}
%}
{% if vcsRevision != "" %}
<footer>
<small>
{%= p.T("version") %}
<a href="https://{%s path %}/commit/{%s vcsRevision %}" target="_blank">
{%s vcsRevision[:7] -%}
</a>
</small>
</footer>
{% endif %}
</body>
</html>
{% endfunc %}

@ -6,309 +6,352 @@ package web
//line web/baseof.qtpl:1
import (
"runtime/debug"
"golang.org/x/text/language"
"golang.org/x/text/message"
"source.toby3d.me/toby3d/auth/internal/domain"
)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
type Page interface {
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
Body() string
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
StreamBody(qw422016 *qt422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
WriteBody(qq422016 qtio422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
Head() string
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
StreamHead(qw422016 *qt422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
WriteHead(qq422016 qtio422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
Lang() string
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
StreamLang(qw422016 *qt422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
WriteLang(qq422016 qtio422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
Title() string
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
StreamTitle(qw422016 *qt422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
WriteTitle(qq422016 qtio422016.Writer)
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
T(format string, args ...interface{}) string
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
StreamT(qw422016 *qt422016.Writer, format string, args ...interface{})
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
WriteT(qq422016 qtio422016.Writer, format string, args ...interface{})
//line web/baseof.qtpl:8
//line web/baseof.qtpl:10
}
//line web/baseof.qtpl:16
//line web/baseof.qtpl:18
type BaseOf struct {
Config *domain.Config
Language language.Tag
Printer *message.Printer
}
//line web/baseof.qtpl:23
//line web/baseof.qtpl:25
func (p *BaseOf) StreamLang(qw422016 *qt422016.Writer) {
//line web/baseof.qtpl:24
//line web/baseof.qtpl:26
if p.Language != language.Und {
//line web/baseof.qtpl:25
//line web/baseof.qtpl:27
qw422016.E().S(p.Language.String())
//line web/baseof.qtpl:26
//line web/baseof.qtpl:28
} else {
//line web/baseof.qtpl:26
qw422016.N().S(`en`)
//line web/baseof.qtpl:28
qw422016.N().S(`en`)
//line web/baseof.qtpl:30
}
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
}
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
func (p *BaseOf) WriteLang(qq422016 qtio422016.Writer) {
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
p.StreamLang(qw422016)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
}
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
func (p *BaseOf) Lang() string {
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
p.WriteLang(qb422016)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
return qs422016
//line web/baseof.qtpl:29
//line web/baseof.qtpl:31
}
//line web/baseof.qtpl:33
//line web/baseof.qtpl:35
func (p *BaseOf) StreamTitle(qw422016 *qt422016.Writer) {
//line web/baseof.qtpl:33
//line web/baseof.qtpl:35
qw422016.N().S(` `)
//line web/baseof.qtpl:34
//line web/baseof.qtpl:36
qw422016.E().S(p.Config.Name)
//line web/baseof.qtpl:34
//line web/baseof.qtpl:36
qw422016.N().S(` `)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
}
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
func (p *BaseOf) WriteTitle(qq422016 qtio422016.Writer) {
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
p.StreamTitle(qw422016)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
}
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
func (p *BaseOf) Title() string {
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
p.WriteTitle(qb422016)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
return qs422016
//line web/baseof.qtpl:35
//line web/baseof.qtpl:37
}
//line web/baseof.qtpl:37
//line web/baseof.qtpl:39
func (p *BaseOf) StreamHead(qw422016 *qt422016.Writer) {
//line web/baseof.qtpl:37
//line web/baseof.qtpl:39
qw422016.N().S(` `)
//line web/baseof.qtpl:38
//line web/baseof.qtpl:40
qw422016.N().S(` <link rel="icon" href="`)
//line web/baseof.qtpl:41
//line web/baseof.qtpl:43
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:41
//line web/baseof.qtpl:43
qw422016.N().S(`/favicon.ico" sizes="any"> <link rel="icon" href="`)
//line web/baseof.qtpl:46
//line web/baseof.qtpl:48
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:46
//line web/baseof.qtpl:48
qw422016.N().S(`/icon.svg" type="image/svg+xml"> <link rel="apple-touch-icon" href="`)
//line web/baseof.qtpl:51
//line web/baseof.qtpl:53
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:51
//line web/baseof.qtpl:53
qw422016.N().S(`/apple-touch-icon.png"> <link rel="manifest" href="`)
//line web/baseof.qtpl:55
//line web/baseof.qtpl:57
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:55
//line web/baseof.qtpl:57
qw422016.N().S(`/manifest.webmanifest"> `)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
}
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
func (p *BaseOf) WriteHead(qq422016 qtio422016.Writer) {
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
p.StreamHead(qw422016)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
}
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
func (p *BaseOf) Head() string {
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
p.WriteHead(qb422016)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
return qs422016
//line web/baseof.qtpl:56
//line web/baseof.qtpl:58
}
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
func (p *BaseOf) StreamBody(qw422016 *qt422016.Writer) {
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
}
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
func (p *BaseOf) WriteBody(qq422016 qtio422016.Writer) {
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
p.StreamBody(qw422016)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
}
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
func (p *BaseOf) Body() string {
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
p.WriteBody(qb422016)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
return qs422016
//line web/baseof.qtpl:58
//line web/baseof.qtpl:60
}
//line web/baseof.qtpl:60
//line web/baseof.qtpl:62
func StreamTemplate(qw422016 *qt422016.Writer, p Page) {
//line web/baseof.qtpl:60
//line web/baseof.qtpl:62
qw422016.N().S(` <!DOCTYPE html> <html class="page" lang="`)
//line web/baseof.qtpl:64
//line web/baseof.qtpl:66
p.StreamLang(qw422016)
//line web/baseof.qtpl:64
//line web/baseof.qtpl:66
qw422016.N().S(`"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> `)
//line web/baseof.qtpl:72
//line web/baseof.qtpl:74
p.StreamHead(qw422016)
//line web/baseof.qtpl:72
qw422016.N().S(` <title>`)
//line web/baseof.qtpl:74
qw422016.N().S(` <title>`)
//line web/baseof.qtpl:76
p.StreamTitle(qw422016)
//line web/baseof.qtpl:74
//line web/baseof.qtpl:76
qw422016.N().S(`</title> </head> <body class="page__body body"> `)
//line web/baseof.qtpl:77
//line web/baseof.qtpl:79
p.StreamBody(qw422016)
//line web/baseof.qtpl:77
//line web/baseof.qtpl:79
qw422016.N().S(` `)
//line web/baseof.qtpl:82
var path, vcsRevision string
if bi, ok := debug.ReadBuildInfo(); ok {
path = bi.Path
for i := range bi.Settings {
if bi.Settings[i].Key != "vcs.revision" {
continue
}
vcsRevision = bi.Settings[i].Value
}
}
//line web/baseof.qtpl:95
qw422016.N().S(` `)
//line web/baseof.qtpl:97
if vcsRevision != "" {
//line web/baseof.qtpl:97
qw422016.N().S(` <footer> <small> `)
//line web/baseof.qtpl:100
p.StreamT(qw422016, "version")
//line web/baseof.qtpl:100
qw422016.N().S(` <a href="https://`)
//line web/baseof.qtpl:101
qw422016.E().S(path)
//line web/baseof.qtpl:101
qw422016.N().S(`/commit/`)
//line web/baseof.qtpl:101
qw422016.E().S(vcsRevision)
//line web/baseof.qtpl:101
qw422016.N().S(`" target="_blank"> `)
//line web/baseof.qtpl:102
qw422016.E().S(vcsRevision[:7])
//line web/baseof.qtpl:102
qw422016.N().S(`</a> </small> </footer> `)
//line web/baseof.qtpl:106
}
//line web/baseof.qtpl:106
qw422016.N().S(` </body> </html> `)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
}
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
func WriteTemplate(qq422016 qtio422016.Writer, p Page) {
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
StreamTemplate(qw422016, p)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
}
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
func Template(p Page) string {
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
WriteTemplate(qb422016, p)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
return qs422016
//line web/baseof.qtpl:80
//line web/baseof.qtpl:109
}
//line web/baseof.qtpl:82
//line web/baseof.qtpl:111
func (p *BaseOf) StreamT(qw422016 *qt422016.Writer, format string, args ...interface{}) {
//line web/baseof.qtpl:82
//line web/baseof.qtpl:111
qw422016.N().S(` `)
//line web/baseof.qtpl:83
//line web/baseof.qtpl:112
qw422016.E().S(p.Printer.Sprintf(format, args...))
//line web/baseof.qtpl:83
//line web/baseof.qtpl:112
qw422016.N().S(` `)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
}
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
func (p *BaseOf) WriteT(qq422016 qtio422016.Writer, format string, args ...interface{}) {
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
p.StreamT(qw422016, format, args...)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
}
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
func (p *BaseOf) T(format string, args ...interface{}) string {
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
p.WriteT(qb422016, format, args...)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
return qs422016
//line web/baseof.qtpl:84
//line web/baseof.qtpl:113
}

Loading…
Cancel
Save