🎨 Format template files

This commit is contained in:
Maxim Lebedev 2023-01-16 16:19:22 +06:00
parent 43af05a02b
commit 834d27d939
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
10 changed files with 301 additions and 287 deletions

View File

@ -101,13 +101,14 @@
{% endif %}
{% if p.CodeChallenge != "" %}
{% for key, val := range map[string]string{
"code_challenge": p.CodeChallenge,
"code_challenge_method": p.CodeChallengeMethod.String(),
} %}
<input type="hidden"
name="code_challenge"
value="{%s p.CodeChallenge %}">
<input type="hidden"
name="code_challenge_method"
value="{%s p.CodeChallengeMethod.String() %}">
name="{%s key %}"
value="{%s val %}">
{% endfor %}
{% endif %}
{% if p.Me != nil %}

View File

@ -292,19 +292,23 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {
if p.CodeChallenge != "" {
//line web/authorize.qtpl:103
qw422016.N().S(`
`)
//line web/authorize.qtpl:104
for key, val := range map[string]string{
"code_challenge": p.CodeChallenge,
"code_challenge_method": p.CodeChallengeMethod.String(),
} {
//line web/authorize.qtpl:107
qw422016.N().S(`
<input type="hidden"
name="code_challenge"
value="`)
//line web/authorize.qtpl:106
qw422016.E().S(p.CodeChallenge)
//line web/authorize.qtpl:106
qw422016.N().S(`">
<input type="hidden"
name="code_challenge_method"
name="`)
//line web/authorize.qtpl:109
qw422016.E().S(key)
//line web/authorize.qtpl:109
qw422016.N().S(`"
value="`)
//line web/authorize.qtpl:110
qw422016.E().S(p.CodeChallengeMethod.String())
qw422016.E().S(val)
//line web/authorize.qtpl:110
qw422016.N().S(`">
`)
@ -312,78 +316,83 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {
}
//line web/authorize.qtpl:111
qw422016.N().S(`
`)
//line web/authorize.qtpl:112
}
//line web/authorize.qtpl:112
qw422016.N().S(`
`)
//line web/authorize.qtpl:113
//line web/authorize.qtpl:114
if p.Me != nil {
//line web/authorize.qtpl:113
//line web/authorize.qtpl:114
qw422016.N().S(`
<input type="hidden"
name="me"
value="`)
//line web/authorize.qtpl:116
//line web/authorize.qtpl:117
qw422016.E().S(p.Me.String())
//line web/authorize.qtpl:116
//line web/authorize.qtpl:117
qw422016.N().S(`">
`)
//line web/authorize.qtpl:117
//line web/authorize.qtpl:118
}
//line web/authorize.qtpl:117
//line web/authorize.qtpl:118
qw422016.N().S(`
`)
//line web/authorize.qtpl:119
//line web/authorize.qtpl:120
if len(p.Providers) > 0 {
//line web/authorize.qtpl:119
//line web/authorize.qtpl:120
qw422016.N().S(`
<select name="provider"
autocomplete
required>
`)
//line web/authorize.qtpl:124
//line web/authorize.qtpl:125
for _, provider := range p.Providers {
//line web/authorize.qtpl:124
//line web/authorize.qtpl:125
qw422016.N().S(`
<option value="`)
//line web/authorize.qtpl:125
//line web/authorize.qtpl:126
qw422016.E().S(provider.UID)
//line web/authorize.qtpl:125
//line web/authorize.qtpl:126
qw422016.N().S(`"
`)
//line web/authorize.qtpl:126
//line web/authorize.qtpl:127
if provider.UID == "mastodon" {
//line web/authorize.qtpl:126
//line web/authorize.qtpl:127
qw422016.N().S(`selected`)
//line web/authorize.qtpl:126
//line web/authorize.qtpl:127
}
//line web/authorize.qtpl:126
//line web/authorize.qtpl:127
qw422016.N().S(`>
`)
//line web/authorize.qtpl:128
//line web/authorize.qtpl:129
qw422016.E().S(provider.Name)
//line web/authorize.qtpl:128
//line web/authorize.qtpl:129
qw422016.N().S(`
</option>
`)
//line web/authorize.qtpl:130
//line web/authorize.qtpl:131
}
//line web/authorize.qtpl:130
//line web/authorize.qtpl:131
qw422016.N().S(`
</select>
`)
//line web/authorize.qtpl:132
//line web/authorize.qtpl:133
} else {
//line web/authorize.qtpl:132
//line web/authorize.qtpl:133
qw422016.N().S(`
<input type="hidden"
name="provider"
value="direct">
`)
//line web/authorize.qtpl:136
//line web/authorize.qtpl:137
}
//line web/authorize.qtpl:136
//line web/authorize.qtpl:137
qw422016.N().S(`
<button type="submit"
@ -391,9 +400,9 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {
value="deny">
`)
//line web/authorize.qtpl:142
//line web/authorize.qtpl:143
p.StreamT(qw422016, "Deny")
//line web/authorize.qtpl:142
//line web/authorize.qtpl:143
qw422016.N().S(`
</button>
@ -402,39 +411,39 @@ func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {
value="allow">
`)
//line web/authorize.qtpl:149
//line web/authorize.qtpl:150
p.StreamT(qw422016, "Allow")
//line web/authorize.qtpl:149
//line web/authorize.qtpl:150
qw422016.N().S(`
</button>
</form>
</main>
`)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
}
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
func (p *AuthorizePage) WriteBody(qq422016 qtio422016.Writer) {
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
p.StreamBody(qw422016)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
qt422016.ReleaseWriter(qw422016)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
}
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
func (p *AuthorizePage) Body() string {
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
qb422016 := qt422016.AcquireByteBuffer()
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
p.WriteBody(qb422016)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
qs422016 := string(qb422016.B)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
qt422016.ReleaseByteBuffer(qb422016)
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
return qs422016
//line web/authorize.qtpl:153
//line web/authorize.qtpl:154
}

View File

@ -62,12 +62,14 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
{%= p.Head() %}
<title>{%= p.Title() %}</title>
</head>
<body class="page__body body">
{%= p.Body() %}
@ -91,7 +93,8 @@
<footer>
<small>
{%= p.T("version") %}
<a href="https://{%s path %}/commit/{%s vcsRevision %}" target="_blank">
<a href="https://{%s path %}/commit/{%s vcsRevision %}"
target="_blank">
{%s vcsRevision[:7] -%}
</a>
</small>

View File

@ -237,19 +237,19 @@ func StreamTemplate(qw422016 *qt422016.Writer, p Page) {
p.StreamLang(qw422016)
//line web/baseof.qtpl:61
qw422016.N().S(`"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> `)
//line web/baseof.qtpl:67
//line web/baseof.qtpl:68
p.StreamHead(qw422016)
//line web/baseof.qtpl:67
//line web/baseof.qtpl:68
qw422016.N().S(` <title>`)
//line web/baseof.qtpl:69
//line web/baseof.qtpl:70
p.StreamTitle(qw422016)
//line web/baseof.qtpl:69
//line web/baseof.qtpl:70
qw422016.N().S(`</title> </head> <body class="page__body body"> `)
//line web/baseof.qtpl:72
//line web/baseof.qtpl:74
p.StreamBody(qw422016)
//line web/baseof.qtpl:72
//line web/baseof.qtpl:74
qw422016.N().S(` `)
//line web/baseof.qtpl:75
//line web/baseof.qtpl:77
var path, vcsRevision string
if bi, ok := debug.ReadBuildInfo(); ok {
@ -264,94 +264,94 @@ func StreamTemplate(qw422016 *qt422016.Writer, p Page) {
}
}
//line web/baseof.qtpl:88
qw422016.N().S(` `)
//line web/baseof.qtpl:90
qw422016.N().S(` `)
//line web/baseof.qtpl:92
if vcsRevision != "" {
//line web/baseof.qtpl:90
//line web/baseof.qtpl:92
qw422016.N().S(` <footer> <small> `)
//line web/baseof.qtpl:93
//line web/baseof.qtpl:95
p.StreamT(qw422016, "version")
//line web/baseof.qtpl:93
//line web/baseof.qtpl:95
qw422016.N().S(` <a href="https://`)
//line web/baseof.qtpl:94
//line web/baseof.qtpl:96
qw422016.E().S(path)
//line web/baseof.qtpl:94
//line web/baseof.qtpl:96
qw422016.N().S(`/commit/`)
//line web/baseof.qtpl:94
//line web/baseof.qtpl:96
qw422016.E().S(vcsRevision)
//line web/baseof.qtpl:94
//line web/baseof.qtpl:96
qw422016.N().S(`" target="_blank"> `)
//line web/baseof.qtpl:95
//line web/baseof.qtpl:98
qw422016.E().S(vcsRevision[:7])
//line web/baseof.qtpl:95
//line web/baseof.qtpl:98
qw422016.N().S(`</a> </small> </footer> `)
//line web/baseof.qtpl:99
//line web/baseof.qtpl:102
}
//line web/baseof.qtpl:99
//line web/baseof.qtpl:102
qw422016.N().S(` </body> </html> `)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
}
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
func WriteTemplate(qq422016 qtio422016.Writer, p Page) {
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
StreamTemplate(qw422016, p)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
}
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
func Template(p Page) string {
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
WriteTemplate(qb422016, p)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
return qs422016
//line web/baseof.qtpl:102
//line web/baseof.qtpl:105
}
//line web/baseof.qtpl:104
//line web/baseof.qtpl:107
func (p *BaseOf) StreamT(qw422016 *qt422016.Writer, format string, args ...interface{}) {
//line web/baseof.qtpl:104
//line web/baseof.qtpl:107
qw422016.N().S(` `)
//line web/baseof.qtpl:105
//line web/baseof.qtpl:108
qw422016.E().S(p.Printer.Sprintf(format, args...))
//line web/baseof.qtpl:105
//line web/baseof.qtpl:108
qw422016.N().S(` `)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
}
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
func (p *BaseOf) WriteT(qq422016 qtio422016.Writer, format string, args ...interface{}) {
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
p.StreamT(qw422016, format, args...)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
qt422016.ReleaseWriter(qw422016)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
}
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
func (p *BaseOf) T(format string, args ...interface{}) string {
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
qb422016 := qt422016.AcquireByteBuffer()
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
p.WriteT(qb422016, format, args...)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
qs422016 := string(qb422016.B)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
qt422016.ReleaseByteBuffer(qb422016)
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
return qs422016
//line web/baseof.qtpl:106
//line web/baseof.qtpl:109
}

View File

@ -12,7 +12,8 @@
{% func (p *HomePage) Head() %}
{%= p.BaseOf.Head() %}
{% for i := range p.Client.RedirectURI %}
<link rel="redirect_uri" href="{%s p.Client.RedirectURI[i].String() %}">
<link rel="redirect_uri"
href="{%s p.Client.RedirectURI[i].String() %}">
{% endfor %}
{% endfunc %}

View File

@ -41,128 +41,128 @@ func (p *HomePage) StreamHead(qw422016 *qt422016.Writer) {
for i := range p.Client.RedirectURI {
//line web/home.qtpl:14
qw422016.N().S(` <link rel="redirect_uri" href="`)
//line web/home.qtpl:15
//line web/home.qtpl:16
qw422016.E().S(p.Client.RedirectURI[i].String())
//line web/home.qtpl:15
//line web/home.qtpl:16
qw422016.N().S(`"> `)
//line web/home.qtpl:16
//line web/home.qtpl:17
}
//line web/home.qtpl:16
//line web/home.qtpl:17
qw422016.N().S(` `)
//line web/home.qtpl:17
//line web/home.qtpl:18
}
//line web/home.qtpl:17
//line web/home.qtpl:18
func (p *HomePage) WriteHead(qq422016 qtio422016.Writer) {
//line web/home.qtpl:17
//line web/home.qtpl:18
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/home.qtpl:17
//line web/home.qtpl:18
p.StreamHead(qw422016)
//line web/home.qtpl:17
//line web/home.qtpl:18
qt422016.ReleaseWriter(qw422016)
//line web/home.qtpl:17
//line web/home.qtpl:18
}
//line web/home.qtpl:17
//line web/home.qtpl:18
func (p *HomePage) Head() string {
//line web/home.qtpl:17
//line web/home.qtpl:18
qb422016 := qt422016.AcquireByteBuffer()
//line web/home.qtpl:17
//line web/home.qtpl:18
p.WriteHead(qb422016)
//line web/home.qtpl:17
//line web/home.qtpl:18
qs422016 := string(qb422016.B)
//line web/home.qtpl:17
//line web/home.qtpl:18
qt422016.ReleaseByteBuffer(qb422016)
//line web/home.qtpl:17
//line web/home.qtpl:18
return qs422016
//line web/home.qtpl:17
//line web/home.qtpl:18
}
//line web/home.qtpl:19
//line web/home.qtpl:20
func (p *HomePage) StreamBody(qw422016 *qt422016.Writer) {
//line web/home.qtpl:19
//line web/home.qtpl:20
qw422016.N().S(` <header class="h-app h-x-app"> <img class="u-logo" src="`)
//line web/home.qtpl:22
//line web/home.qtpl:23
qw422016.E().S(p.Client.GetLogo().String())
//line web/home.qtpl:22
//line web/home.qtpl:23
qw422016.N().S(`" alt="`)
//line web/home.qtpl:23
//line web/home.qtpl:24
qw422016.E().S(p.Client.GetName())
//line web/home.qtpl:23
//line web/home.qtpl:24
qw422016.N().S(`" crossorigin="anonymous" decoding="async" height="140" importance="high" referrerpolicy="no-referrer-when-downgrade" width="140"> <h1> <a class="p-name u-url" href="`)
//line web/home.qtpl:33
//line web/home.qtpl:34
qw422016.E().S(p.Client.GetURL().String())
//line web/home.qtpl:33
//line web/home.qtpl:34
qw422016.N().S(`"> `)
//line web/home.qtpl:35
//line web/home.qtpl:36
qw422016.E().S(p.Client.GetName())
//line web/home.qtpl:35
//line web/home.qtpl:36
qw422016.N().S(` </a> </h1> </header> <main> <form class="" method="get" action="/authorize" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" target="_self"> `)
//line web/home.qtpl:48
//line web/home.qtpl:49
for name, value := range map[string]string{
"client_id": p.Client.ID.String(),
"redirect_uri": p.Client.RedirectURI[0].String(),
"response_type": domain.ResponseTypeCode.String(),
"state": p.State,
} {
//line web/home.qtpl:53
//line web/home.qtpl:54
qw422016.N().S(` <input type="hidden" name="`)
//line web/home.qtpl:55
//line web/home.qtpl:56
qw422016.E().S(name)
//line web/home.qtpl:55
//line web/home.qtpl:56
qw422016.N().S(`" value="`)
//line web/home.qtpl:56
//line web/home.qtpl:57
qw422016.E().S(value)
//line web/home.qtpl:56
//line web/home.qtpl:57
qw422016.N().S(`"> `)
//line web/home.qtpl:57
//line web/home.qtpl:58
}
//line web/home.qtpl:57
//line web/home.qtpl:58
qw422016.N().S(` `)
//line web/home.qtpl:59
//line web/home.qtpl:60
for _, scope := range []domain.Scope{
domain.ScopeEmail,
domain.ScopeProfile,
} {
//line web/home.qtpl:62
//line web/home.qtpl:63
qw422016.N().S(` <input type="hidden" name="scope[]" value="`)
//line web/home.qtpl:65
//line web/home.qtpl:66
qw422016.E().S(scope.String())
//line web/home.qtpl:65
//line web/home.qtpl:66
qw422016.N().S(`"> `)
//line web/home.qtpl:66
//line web/home.qtpl:67
}
//line web/home.qtpl:66
//line web/home.qtpl:67
qw422016.N().S(` <input type="url" name="me" placeholder="https://example.com/" inputmode="url" autocomplete="url" required> <button type="submit">`)
//line web/home.qtpl:75
//line web/home.qtpl:76
p.StreamT(qw422016, "Sign In")
//line web/home.qtpl:75
//line web/home.qtpl:76
qw422016.N().S(`</button> </form> </main> `)
//line web/home.qtpl:78
//line web/home.qtpl:79
}
//line web/home.qtpl:78
//line web/home.qtpl:79
func (p *HomePage) WriteBody(qq422016 qtio422016.Writer) {
//line web/home.qtpl:78
//line web/home.qtpl:79
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/home.qtpl:78
//line web/home.qtpl:79
p.StreamBody(qw422016)
//line web/home.qtpl:78
//line web/home.qtpl:79
qt422016.ReleaseWriter(qw422016)
//line web/home.qtpl:78
//line web/home.qtpl:79
}
//line web/home.qtpl:78
//line web/home.qtpl:79
func (p *HomePage) Body() string {
//line web/home.qtpl:78
//line web/home.qtpl:79
qb422016 := qt422016.AcquireByteBuffer()
//line web/home.qtpl:78
//line web/home.qtpl:79
p.WriteBody(qb422016)
//line web/home.qtpl:78
//line web/home.qtpl:79
qs422016 := string(qb422016.B)
//line web/home.qtpl:78
//line web/home.qtpl:79
qt422016.ReleaseByteBuffer(qb422016)
//line web/home.qtpl:78
//line web/home.qtpl:79
return qs422016
//line web/home.qtpl:78
//line web/home.qtpl:79
}

View File

@ -30,7 +30,7 @@
type="url"
name="subject"
inputmode="url"
placeholder="https://bob.example.org"
placeholder="https://bob.example.org/"
required>
</div>

View File

@ -46,7 +46,7 @@ func (p *TicketPage) StreamBody(qw422016 *qt422016.Writer) {
//line web/ticket.qtpl:28
p.StreamT(qw422016, "Recipient")
//line web/ticket.qtpl:28
qw422016.N().S(`</label> <input id="subject" type="url" name="subject" inputmode="url" placeholder="https://bob.example.org" required> </div> <div> <label for="resource">`)
qw422016.N().S(`</label> <input id="subject" type="url" name="subject" inputmode="url" placeholder="https://bob.example.org/" required> </div> <div> <label for="resource">`)
//line web/ticket.qtpl:38
p.StreamT(qw422016, "Resource")
//line web/ticket.qtpl:38