🍱 Regenerate web templates

This commit is contained in:
Maxim Lebedev 2022-01-21 00:50:15 +05:00
parent fbd6512fde
commit 3fc1eeb4a7
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
6 changed files with 560 additions and 440 deletions

View File

@ -1,121 +1,139 @@
{% import "source.toby3d.me/website/indieauth/internal/domain" %} {% import "source.toby3d.me/website/indieauth/internal/domain" %}
{% code type AuthPage struct { {% code type AuthorizePage struct {
BaseOf BaseOf
Client *domain.Client Client *domain.Client
Me *domain.Me
RedirectURI *domain.URL RedirectURI *domain.URL
Me *domain.Me
CodeChallengeMethod domain.CodeChallengeMethod CodeChallengeMethod domain.CodeChallengeMethod
ResponseType domain.ResponseType ResponseType domain.ResponseType
Scope domain.Scopes Scope domain.Scopes
CSRF []byte
CodeChallenge string CodeChallenge string
CSRF string
State string State string
} %} } %}
{% func (p *AuthPage) Lang() %} {% func (p *AuthorizePage) Title() %}
en {% if p.Client.GetName() == "" %}
{% endfunc %} {%= p.T("Authorize %s", p.Client.GetName()) %}
{% else %}
{% func (p *AuthPage) Title() %} {%= p.T("Authorize application") %}
Authorize {%s p.Client.Name[0] %}
{% endfunc %}
{% func (p *AuthPage) Head() %}
{% endfunc %}
{% func (p *AuthPage) Body() %}
{% if p.Client.Logo[0] != nil %}
<img
alt="{%s p.Client.Name[0] %}"
crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
src="{%s p.Client.Logo[0].String() %}"
width="140">
{% endif %} {% endif %}
{% endfunc %}
<h2>{%s p.Client.Name[0] %}</h2> {% func (p *AuthorizePage) Body() %}
<header>
<form {% if p.Client.GetLogo() != nil %}
accept-charset="utf-8" <img
action="/api/authorize" alt="{%s p.Client.GetName() %}"
autocomplete="off" crossorigin="anonymous"
enctype="application/x-www-form-urlencoded" decoding="async"
method="post" height="140"
novalidate="true" importance="high"
target="_self"> loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
{% if p.CSRF != "" %} src="{%s p.Client.GetLogo().String() %}"
<input width="140">
name="_csrf"
type="hidden"
value="{%s p.CSRF %}">
{% endif %} {% endif %}
<input <h2>
name="response_type" {% if p.Client.GetURL() != nil %}
type="hidden" <a href="{%s p.Client.GetURL().String() %}">
value="code"> {% endif %}
{% if p.Client.GetName() != "" %}
{%s p.Client.GetName() %}
{% else %}
{%s p.Client.ID.String() %}
{% endif %}
{% if p.Client.GetURL() != nil %}
</a>
{% endif %}
</h2>
</header>
<input <main>
name="client_id" <form
type="hidden" accept-charset="utf-8"
value="{%s p.Client.URL[0].String() %}"> action="/api/authorize"
autocomplete="off"
enctype="application/x-www-form-urlencoded"
method="post"
novalidate="true"
target="_self">
<input {% if p.CSRF != nil %}
name="redirect_uri" <input
type="hidden" type="hidden"
value="{%s p.RedirectURI.String() %}"> name="_csrf"
value="{%z p.CSRF %}">
{% endif %}
<input {% for key, val := range map[string]string{
name="state" "client_id": p.Client.ID.String(),
type="hidden" "redirect_uri": p.RedirectURI.String(),
value="{%s p.State %}"> "response_type": p.ResponseType.String(),
"state": p.State,
} %}
<input
type="hidden"
name="{%s key %}"
value="{%s val %}">
{% endfor %}
{% if p.CodeChallenge != "" %} {% if len(p.Scope) > 0 %}
<input <fieldset>
name="code_challenge" <legend>{%= p.T("Choose your scopes") %}</legend>
type="hidden"
value="{%s p.CodeChallenge %}">
<input {% for _, scope := range p.Scope %}
name="code_challenge_method" <div>
type="hidden" <label>
value="{%s p.CodeChallengeMethod.String() %}"> <input
{% endif %} type="checkbox"
name="scope[]"
value="{%s scope.String() %}"
checked>
{% if len(p.Scope) != 0 %} {%s scope.String() %}
<input </label>
name="scope" </div>
type="hidden" {% endfor %}
value="{%s p.Scope.String() %}"> </fieldset>
{% endif %} {% endif %}
{% if p.Me != nil %} {% if p.CodeChallenge != "" %}
<input <input
name="me" type="hidden"
type="hidden" name="code_challenge"
value="{%s p.Me.String() %}"> value="{%s p.CodeChallenge %}">
{% endif %}
<button <input
name="authorize" type="hidden"
type="submit" name="code_challenge_method"
value="deny"> value="{%s p.CodeChallengeMethod.String() %}">
{% endif %}
{%= p.T("Deny") %} {% if p.Me != nil %}
</button> <input
type="hidden"
name="me"
value="{%s p.Me.String() %}">
{% endif %}
<button <button
name="authorize" type="submit"
type="submit" name="authorize"
value="allow"> value="deny">
{%= p.T("Allow") %} {%= p.T("Deny") %}
</button> </button>
</form>
<button
type="submit"
name="authorize"
value="allow">
{%= p.T("Allow") %}
</button>
</form>
</main>
{% endfunc %} {% endfunc %}

View File

@ -21,61 +21,46 @@ var (
) )
//line web/authorize.qtpl:3 //line web/authorize.qtpl:3
type AuthPage struct { type AuthorizePage struct {
BaseOf BaseOf
Client *domain.Client Client *domain.Client
Me *domain.Me
RedirectURI *domain.URL RedirectURI *domain.URL
Me *domain.Me
CodeChallengeMethod domain.CodeChallengeMethod CodeChallengeMethod domain.CodeChallengeMethod
ResponseType domain.ResponseType ResponseType domain.ResponseType
Scope domain.Scopes Scope domain.Scopes
CSRF []byte
CodeChallenge string CodeChallenge string
CSRF string
State string State string
} }
//line web/authorize.qtpl:16 //line web/authorize.qtpl:16
func (p *AuthPage) StreamLang(qw422016 *qt422016.Writer) { func (p *AuthorizePage) StreamTitle(qw422016 *qt422016.Writer) {
//line web/authorize.qtpl:16 //line web/authorize.qtpl:16
qw422016.N().S(` qw422016.N().S(`
en `)
`) //line web/authorize.qtpl:17
if p.Client.GetName() == "" {
//line web/authorize.qtpl:17
qw422016.N().S(`
`)
//line web/authorize.qtpl:18 //line web/authorize.qtpl:18
} p.StreamT(qw422016, "Authorize %s", p.Client.GetName())
//line web/authorize.qtpl:18 //line web/authorize.qtpl:18
func (p *AuthPage) WriteLang(qq422016 qtio422016.Writer) { qw422016.N().S(`
//line web/authorize.qtpl:18 `)
qw422016 := qt422016.AcquireWriter(qq422016) //line web/authorize.qtpl:19
//line web/authorize.qtpl:18 } else {
p.StreamLang(qw422016) //line web/authorize.qtpl:19
//line web/authorize.qtpl:18 qw422016.N().S(`
qt422016.ReleaseWriter(qw422016) `)
//line web/authorize.qtpl:18
}
//line web/authorize.qtpl:18
func (p *AuthPage) Lang() string {
//line web/authorize.qtpl:18
qb422016 := qt422016.AcquireByteBuffer()
//line web/authorize.qtpl:18
p.WriteLang(qb422016)
//line web/authorize.qtpl:18
qs422016 := string(qb422016.B)
//line web/authorize.qtpl:18
qt422016.ReleaseByteBuffer(qb422016)
//line web/authorize.qtpl:18
return qs422016
//line web/authorize.qtpl:18
}
//line web/authorize.qtpl:20 //line web/authorize.qtpl:20
func (p *AuthPage) StreamTitle(qw422016 *qt422016.Writer) { p.StreamT(qw422016, "Authorize application")
//line web/authorize.qtpl:20 //line web/authorize.qtpl:20
qw422016.N().S(` qw422016.N().S(`
Authorize `) `)
//line web/authorize.qtpl:21 //line web/authorize.qtpl:21
qw422016.E().S(p.Client.Name[0]) }
//line web/authorize.qtpl:21 //line web/authorize.qtpl:21
qw422016.N().S(` qw422016.N().S(`
`) `)
@ -83,7 +68,7 @@ func (p *AuthPage) StreamTitle(qw422016 *qt422016.Writer) {
} }
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
func (p *AuthPage) WriteTitle(qq422016 qtio422016.Writer) { func (p *AuthorizePage) WriteTitle(qq422016 qtio422016.Writer) {
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
@ -94,7 +79,7 @@ func (p *AuthPage) WriteTitle(qq422016 qtio422016.Writer) {
} }
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
func (p *AuthPage) Title() string { func (p *AuthorizePage) Title() string {
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line web/authorize.qtpl:22 //line web/authorize.qtpl:22
@ -109,254 +94,297 @@ func (p *AuthPage) Title() string {
} }
//line web/authorize.qtpl:24 //line web/authorize.qtpl:24
func (p *AuthPage) StreamHead(qw422016 *qt422016.Writer) { func (p *AuthorizePage) StreamBody(qw422016 *qt422016.Writer) {
//line web/authorize.qtpl:24 //line web/authorize.qtpl:24
qw422016.N().S(` qw422016.N().S(`
`) <header>
//line web/authorize.qtpl:25
}
//line web/authorize.qtpl:25
func (p *AuthPage) WriteHead(qq422016 qtio422016.Writer) {
//line web/authorize.qtpl:25
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/authorize.qtpl:25
p.StreamHead(qw422016)
//line web/authorize.qtpl:25
qt422016.ReleaseWriter(qw422016)
//line web/authorize.qtpl:25
}
//line web/authorize.qtpl:25
func (p *AuthPage) Head() string {
//line web/authorize.qtpl:25
qb422016 := qt422016.AcquireByteBuffer()
//line web/authorize.qtpl:25
p.WriteHead(qb422016)
//line web/authorize.qtpl:25
qs422016 := string(qb422016.B)
//line web/authorize.qtpl:25
qt422016.ReleaseByteBuffer(qb422016)
//line web/authorize.qtpl:25
return qs422016
//line web/authorize.qtpl:25
}
//line web/authorize.qtpl:27
func (p *AuthPage) StreamBody(qw422016 *qt422016.Writer) {
//line web/authorize.qtpl:27
qw422016.N().S(`
`)
//line web/authorize.qtpl:28
if p.Client.Logo[0] != nil {
//line web/authorize.qtpl:28
qw422016.N().S(`
<img
alt="`)
//line web/authorize.qtpl:30
qw422016.E().S(p.Client.Name[0])
//line web/authorize.qtpl:30
qw422016.N().S(`"
crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
src="`)
//line web/authorize.qtpl:37
qw422016.E().S(p.Client.Logo[0].String())
//line web/authorize.qtpl:37
qw422016.N().S(`"
width="140">
`)
//line web/authorize.qtpl:39
}
//line web/authorize.qtpl:39
qw422016.N().S(`
<h2>`)
//line web/authorize.qtpl:41
qw422016.E().S(p.Client.Name[0])
//line web/authorize.qtpl:41
qw422016.N().S(`</h2>
<form
accept-charset="utf-8"
action="/api/authorize"
autocomplete="off"
enctype="application/x-www-form-urlencoded"
method="post"
novalidate="true"
target="_self">
`) `)
//line web/authorize.qtpl:52 //line web/authorize.qtpl:26
if p.CSRF != "" { if p.Client.GetLogo() != nil {
//line web/authorize.qtpl:52 //line web/authorize.qtpl:26
qw422016.N().S(` qw422016.N().S(`
<input <img
name="_csrf" alt="`)
type="hidden" //line web/authorize.qtpl:28
value="`) qw422016.E().S(p.Client.GetName())
//line web/authorize.qtpl:56 //line web/authorize.qtpl:28
qw422016.E().S(p.CSRF) qw422016.N().S(`"
//line web/authorize.qtpl:56 crossorigin="anonymous"
decoding="async"
height="140"
importance="high"
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
src="`)
//line web/authorize.qtpl:35
qw422016.E().S(p.Client.GetLogo().String())
//line web/authorize.qtpl:35
qw422016.N().S(`"
width="140">
`)
//line web/authorize.qtpl:37
}
//line web/authorize.qtpl:37
qw422016.N().S(`
<h2>
`)
//line web/authorize.qtpl:40
if p.Client.GetURL() != nil {
//line web/authorize.qtpl:40
qw422016.N().S(`
<a href="`)
//line web/authorize.qtpl:41
qw422016.E().S(p.Client.GetURL().String())
//line web/authorize.qtpl:41
qw422016.N().S(`"> qw422016.N().S(`">
`) `)
//line web/authorize.qtpl:57 //line web/authorize.qtpl:42
} }
//line web/authorize.qtpl:57 //line web/authorize.qtpl:42
qw422016.N().S(`
`)
//line web/authorize.qtpl:43
if p.Client.GetName() != "" {
//line web/authorize.qtpl:43
qw422016.N().S(`
`)
//line web/authorize.qtpl:44
qw422016.E().S(p.Client.GetName())
//line web/authorize.qtpl:44
qw422016.N().S(`
`)
//line web/authorize.qtpl:45
} else {
//line web/authorize.qtpl:45
qw422016.N().S(`
`)
//line web/authorize.qtpl:46
qw422016.E().S(p.Client.ID.String())
//line web/authorize.qtpl:46
qw422016.N().S(`
`)
//line web/authorize.qtpl:47
}
//line web/authorize.qtpl:47
qw422016.N().S(`
`)
//line web/authorize.qtpl:48
if p.Client.GetURL() != nil {
//line web/authorize.qtpl:48
qw422016.N().S(`
</a>
`)
//line web/authorize.qtpl:50
}
//line web/authorize.qtpl:50
qw422016.N().S(`
</h2>
</header>
<main>
<form
accept-charset="utf-8"
action="/api/authorize"
autocomplete="off"
enctype="application/x-www-form-urlencoded"
method="post"
novalidate="true"
target="_self">
`)
//line web/authorize.qtpl:64
if p.CSRF != nil {
//line web/authorize.qtpl:64
qw422016.N().S(`
<input
type="hidden"
name="_csrf"
value="`)
//line web/authorize.qtpl:68
qw422016.E().Z(p.CSRF)
//line web/authorize.qtpl:68
qw422016.N().S(`">
`)
//line web/authorize.qtpl:69
}
//line web/authorize.qtpl:69
qw422016.N().S(` qw422016.N().S(`
<input `)
name="response_type" //line web/authorize.qtpl:71
type="hidden" for key, val := range map[string]string{
value="code"> "client_id": p.Client.ID.String(),
"redirect_uri": p.RedirectURI.String(),
<input "response_type": p.ResponseType.String(),
name="client_id" "state": p.State,
type="hidden" } {
value="`) //line web/authorize.qtpl:76
//line web/authorize.qtpl:67 qw422016.N().S(`
qw422016.E().S(p.Client.URL[0].String()) <input
//line web/authorize.qtpl:67 type="hidden"
qw422016.N().S(`"> name="`)
<input
name="redirect_uri"
type="hidden"
value="`)
//line web/authorize.qtpl:72
qw422016.E().S(p.RedirectURI.String())
//line web/authorize.qtpl:72
qw422016.N().S(`">
<input
name="state"
type="hidden"
value="`)
//line web/authorize.qtpl:77
qw422016.E().S(p.State)
//line web/authorize.qtpl:77
qw422016.N().S(`">
`)
//line web/authorize.qtpl:79 //line web/authorize.qtpl:79
qw422016.E().S(key)
//line web/authorize.qtpl:79
qw422016.N().S(`"
value="`)
//line web/authorize.qtpl:80
qw422016.E().S(val)
//line web/authorize.qtpl:80
qw422016.N().S(`">
`)
//line web/authorize.qtpl:81
}
//line web/authorize.qtpl:81
qw422016.N().S(`
`)
//line web/authorize.qtpl:83
if len(p.Scope) > 0 {
//line web/authorize.qtpl:83
qw422016.N().S(`
<fieldset>
<legend>`)
//line web/authorize.qtpl:85
p.StreamT(qw422016, "Choose your scopes")
//line web/authorize.qtpl:85
qw422016.N().S(`</legend>
`)
//line web/authorize.qtpl:87
for _, scope := range p.Scope {
//line web/authorize.qtpl:87
qw422016.N().S(`
<div>
<label>
<input
type="checkbox"
name="scope[]"
value="`)
//line web/authorize.qtpl:93
qw422016.E().S(scope.String())
//line web/authorize.qtpl:93
qw422016.N().S(`"
checked>
`)
//line web/authorize.qtpl:96
qw422016.E().S(scope.String())
//line web/authorize.qtpl:96
qw422016.N().S(`
</label>
</div>
`)
//line web/authorize.qtpl:99
}
//line web/authorize.qtpl:99
qw422016.N().S(`
</fieldset>
`)
//line web/authorize.qtpl:101
}
//line web/authorize.qtpl:101
qw422016.N().S(`
`)
//line web/authorize.qtpl:103
if p.CodeChallenge != "" { if p.CodeChallenge != "" {
//line web/authorize.qtpl:79 //line web/authorize.qtpl:103
qw422016.N().S(` qw422016.N().S(`
<input <input
name="code_challenge" type="hidden"
type="hidden" name="code_challenge"
value="`) value="`)
//line web/authorize.qtpl:83 //line web/authorize.qtpl:107
qw422016.E().S(p.CodeChallenge) qw422016.E().S(p.CodeChallenge)
//line web/authorize.qtpl:83 //line web/authorize.qtpl:107
qw422016.N().S(`"> qw422016.N().S(`">
<input <input
name="code_challenge_method" type="hidden"
type="hidden" name="code_challenge_method"
value="`) value="`)
//line web/authorize.qtpl:88 //line web/authorize.qtpl:112
qw422016.E().S(p.CodeChallengeMethod.String()) qw422016.E().S(p.CodeChallengeMethod.String())
//line web/authorize.qtpl:88 //line web/authorize.qtpl:112
qw422016.N().S(`"> qw422016.N().S(`">
`) `)
//line web/authorize.qtpl:89 //line web/authorize.qtpl:113
} }
//line web/authorize.qtpl:89 //line web/authorize.qtpl:113
qw422016.N().S(` qw422016.N().S(`
`) `)
//line web/authorize.qtpl:91 //line web/authorize.qtpl:115
if len(p.Scope) != 0 {
//line web/authorize.qtpl:91
qw422016.N().S(`
<input
name="scope"
type="hidden"
value="`)
//line web/authorize.qtpl:95
qw422016.E().S(p.Scope.String())
//line web/authorize.qtpl:95
qw422016.N().S(`">
`)
//line web/authorize.qtpl:96
}
//line web/authorize.qtpl:96
qw422016.N().S(`
`)
//line web/authorize.qtpl:98
if p.Me != nil { if p.Me != nil {
//line web/authorize.qtpl:98 //line web/authorize.qtpl:115
qw422016.N().S(` qw422016.N().S(`
<input <input
name="me" type="hidden"
type="hidden" name="me"
value="`) value="`)
//line web/authorize.qtpl:102 //line web/authorize.qtpl:119
qw422016.E().S(p.Me.String()) qw422016.E().S(p.Me.String())
//line web/authorize.qtpl:102 //line web/authorize.qtpl:119
qw422016.N().S(`"> qw422016.N().S(`">
`) `)
//line web/authorize.qtpl:103 //line web/authorize.qtpl:120
} }
//line web/authorize.qtpl:103 //line web/authorize.qtpl:120
qw422016.N().S(` qw422016.N().S(`
<button <button
name="authorize" type="submit"
type="submit" name="authorize"
value="deny"> value="deny">
`) `)
//line web/authorize.qtpl:110 //line web/authorize.qtpl:127
p.StreamT(qw422016, "Deny") p.StreamT(qw422016, "Deny")
//line web/authorize.qtpl:110 //line web/authorize.qtpl:127
qw422016.N().S(` qw422016.N().S(`
</button> </button>
<button <button
name="authorize" type="submit"
type="submit" name="authorize"
value="allow"> value="allow">
`) `)
//line web/authorize.qtpl:118 //line web/authorize.qtpl:135
p.StreamT(qw422016, "Allow") p.StreamT(qw422016, "Allow")
//line web/authorize.qtpl:118 //line web/authorize.qtpl:135
qw422016.N().S(` qw422016.N().S(`
</button> </button>
</form> </form>
</main>
`) `)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
} }
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
func (p *AuthPage) WriteBody(qq422016 qtio422016.Writer) { func (p *AuthorizePage) WriteBody(qq422016 qtio422016.Writer) {
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
p.StreamBody(qw422016) p.StreamBody(qw422016)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
} }
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
func (p *AuthPage) Body() string { func (p *AuthorizePage) Body() string {
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
p.WriteBody(qb422016) p.WriteBody(qb422016)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
return qs422016 return qs422016
//line web/authorize.qtpl:121 //line web/authorize.qtpl:139
} }

15
web/callback.qtpl Normal file
View File

@ -0,0 +1,15 @@
{% import "source.toby3d.me/website/indieauth/internal/domain" %}
{% code type CallbackPage struct {
BaseOf
Token *domain.Token
} %}
{% collapsespace %}
{% func (p *CallbackPage) Body() %}
{% if p.Token != nil %}
<h1>{%s p.Token.Me.String() %}</h1>
<small>{%s p.Token.AccessToken %}</small>
{% endif %}
{% endfunc %}
{% endcollapsespace %}

76
web/callback.qtpl.go Normal file
View File

@ -0,0 +1,76 @@
// Code generated by qtc from "callback.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line web/callback.qtpl:1
package web
//line web/callback.qtpl:1
import "source.toby3d.me/website/indieauth/internal/domain"
//line web/callback.qtpl:3
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line web/callback.qtpl:3
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line web/callback.qtpl:3
type CallbackPage struct {
BaseOf
Token *domain.Token
}
//line web/callback.qtpl:9
func (p *CallbackPage) StreamBody(qw422016 *qt422016.Writer) {
//line web/callback.qtpl:9
qw422016.N().S(` `)
//line web/callback.qtpl:10
if p.Token != nil {
//line web/callback.qtpl:10
qw422016.N().S(` <h1>`)
//line web/callback.qtpl:11
qw422016.E().S(p.Token.Me.String())
//line web/callback.qtpl:11
qw422016.N().S(`</h1> <small>`)
//line web/callback.qtpl:12
qw422016.E().S(p.Token.AccessToken)
//line web/callback.qtpl:12
qw422016.N().S(`</small> `)
//line web/callback.qtpl:13
}
//line web/callback.qtpl:13
qw422016.N().S(` `)
//line web/callback.qtpl:14
}
//line web/callback.qtpl:14
func (p *CallbackPage) WriteBody(qq422016 qtio422016.Writer) {
//line web/callback.qtpl:14
qw422016 := qt422016.AcquireWriter(qq422016)
//line web/callback.qtpl:14
p.StreamBody(qw422016)
//line web/callback.qtpl:14
qt422016.ReleaseWriter(qw422016)
//line web/callback.qtpl:14
}
//line web/callback.qtpl:14
func (p *CallbackPage) Body() string {
//line web/callback.qtpl:14
qb422016 := qt422016.AcquireByteBuffer()
//line web/callback.qtpl:14
p.WriteBody(qb422016)
//line web/callback.qtpl:14
qs422016 := string(qb422016.B)
//line web/callback.qtpl:14
qt422016.ReleaseByteBuffer(qb422016)
//line web/callback.qtpl:14
return qs422016
//line web/callback.qtpl:14
}

View File

@ -2,26 +2,24 @@
{% code type HomePage struct { {% code type HomePage struct {
BaseOf BaseOf
RedirectURI []*domain.URL Client *domain.Client
Client *domain.Client State string
AuthEndpoint,
State string
} %} } %}
{% collapsespace %} {% collapsespace %}
{% func (p *HomePage) Head() %} {% func (p *HomePage) Head() %}
{%= p.BaseOf.Head() %} {%= p.BaseOf.Head() %}
{% for i := range p.RedirectURI %} {% for i := range p.Client.RedirectURI %}
<link rel="redirect_uri" href="{%s p.RedirectURI[i].String() %}"> <link rel="redirect_uri" href="{%s p.Client.RedirectURI[i].String() %}">
{% endfor %} {% endfor %}
{% endfunc %} {% endfunc %}
{% func (p *HomePage) Body() %} {% func (p *HomePage) Body() %}
<div class="h-app h-x-app"> <header class="h-app h-x-app">
<img <img
class="u-logo" class="u-logo"
src="{%s p.Client.Logo[0].String() %}" src="{%s p.Client.GetLogo().String() %}"
alt="{%s p.Client.Name[0] %}" alt="{%s p.Client.GetName() %}"
crossorigin="anonymous" crossorigin="anonymous"
decoding="async" decoding="async"
height="140" height="140"
@ -32,24 +30,27 @@
<h1> <h1>
<a <a
class="p-name u-url" class="p-name u-url"
href="{%s p.Client.URL[0].String() %}"> href="{%s p.Client.GetURL().String() %}">
{%s p.Client.Name[0] %} {%s p.Client.GetName() %}
</a> </a>
</h1> </h1>
</header>
<main>
<form <form
method="get" method="get"
action="{%s p.AuthEndpoint %}" action="/authorize"
enctype="application/x-www-form-urlencoded" enctype="application/x-www-form-urlencoded"
accept-charset="utf-8" accept-charset="utf-8"
target="_self"> target="_self">
{% for name, value := range map[string]string { {% for name, value := range map[string]string {
"client_id": p.Client.ID.String(), "client_id": p.Client.ID.String(),
"redirect_uri": p.Client.RedirectURI[0].String(), "redirect_uri": p.Client.RedirectURI[0].String(),
"response_type": "code", "response_type": domain.ResponseTypeCode.String(),
"state": p.State, "state": p.State,
"scope": domain.Scopes{domain.ScopeProfile, domain.ScopeEmail}.String(),
} %} } %}
<input <input
type="hidden" type="hidden"
@ -57,11 +58,6 @@
value="{%s value %}"> value="{%s value %}">
{% endfor %} {% endfor %}
<input
type="hidden"
name="scope"
value="{%s domain.ScopeProfile.String() %} {%s domain.ScopeEmail.String() %}">
<input <input
type="url" type="url"
name="me" name="me"
@ -72,6 +68,6 @@
<button type="submit">{%= p.T("Sign In") %}</button> <button type="submit">{%= p.T("Sign In") %}</button>
</form> </form>
</div> </main>
{% endfunc %} {% endfunc %}
{% endcollapsespace %} {% endcollapsespace %}

View File

@ -23,143 +23,130 @@ var (
//line web/home.qtpl:3 //line web/home.qtpl:3
type HomePage struct { type HomePage struct {
BaseOf BaseOf
RedirectURI []*domain.URL Client *domain.Client
Client *domain.Client State string
AuthEndpoint,
State string
} }
//line web/home.qtpl:12 //line web/home.qtpl:10
func (p *HomePage) StreamHead(qw422016 *qt422016.Writer) { func (p *HomePage) StreamHead(qw422016 *qt422016.Writer) {
//line web/home.qtpl:12 //line web/home.qtpl:10
qw422016.N().S(` `) qw422016.N().S(` `)
//line web/home.qtpl:13 //line web/home.qtpl:11
p.BaseOf.StreamHead(qw422016) p.BaseOf.StreamHead(qw422016)
//line web/home.qtpl:13 //line web/home.qtpl:11
qw422016.N().S(` `) qw422016.N().S(` `)
//line web/home.qtpl:14 //line web/home.qtpl:12
for i := range p.RedirectURI { for i := range p.Client.RedirectURI {
//line web/home.qtpl:14 //line web/home.qtpl:12
qw422016.N().S(` <link rel="redirect_uri" href="`) qw422016.N().S(` <link rel="redirect_uri" href="`)
//line web/home.qtpl:15 //line web/home.qtpl:13
qw422016.E().S(p.RedirectURI[i].String()) qw422016.E().S(p.Client.RedirectURI[i].String())
//line web/home.qtpl:15 //line web/home.qtpl:13
qw422016.N().S(`"> `) qw422016.N().S(`"> `)
//line web/home.qtpl:16 //line web/home.qtpl:14
} }
//line web/home.qtpl:16 //line web/home.qtpl:14
qw422016.N().S(` `) qw422016.N().S(` `)
//line web/home.qtpl:17 //line web/home.qtpl:15
} }
//line web/home.qtpl:17 //line web/home.qtpl:15
func (p *HomePage) WriteHead(qq422016 qtio422016.Writer) { func (p *HomePage) WriteHead(qq422016 qtio422016.Writer) {
//line web/home.qtpl:17 //line web/home.qtpl:15
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line web/home.qtpl:17 //line web/home.qtpl:15
p.StreamHead(qw422016) p.StreamHead(qw422016)
//line web/home.qtpl:17 //line web/home.qtpl:15
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line web/home.qtpl:17 //line web/home.qtpl:15
} }
//line web/home.qtpl:17 //line web/home.qtpl:15
func (p *HomePage) Head() string { func (p *HomePage) Head() string {
//line web/home.qtpl:17 //line web/home.qtpl:15
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line web/home.qtpl:17 //line web/home.qtpl:15
p.WriteHead(qb422016) p.WriteHead(qb422016)
//line web/home.qtpl:17 //line web/home.qtpl:15
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line web/home.qtpl:17 //line web/home.qtpl:15
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line web/home.qtpl:17 //line web/home.qtpl:15
return qs422016 return qs422016
//line web/home.qtpl:17 //line web/home.qtpl:15
} }
//line web/home.qtpl:19 //line web/home.qtpl:17
func (p *HomePage) StreamBody(qw422016 *qt422016.Writer) { func (p *HomePage) StreamBody(qw422016 *qt422016.Writer) {
//line web/home.qtpl:19 //line web/home.qtpl:17
qw422016.N().S(` <div class="h-app h-x-app"> <img class="u-logo" src="`) qw422016.N().S(` <header class="h-app h-x-app"> <img class="u-logo" src="`)
//line web/home.qtpl:23 //line web/home.qtpl:21
qw422016.E().S(p.Client.Logo[0].String()) qw422016.E().S(p.Client.GetLogo().String())
//line web/home.qtpl:23 //line web/home.qtpl:21
qw422016.N().S(`" alt="`) qw422016.N().S(`" alt="`)
//line web/home.qtpl:24 //line web/home.qtpl:22
qw422016.E().S(p.Client.Name[0]) qw422016.E().S(p.Client.GetName())
//line web/home.qtpl:24 //line web/home.qtpl:22
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="`) 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:35 //line web/home.qtpl:33
qw422016.E().S(p.Client.URL[0].String()) qw422016.E().S(p.Client.GetURL().String())
//line web/home.qtpl:35 //line web/home.qtpl:33
qw422016.N().S(`"> `) qw422016.N().S(`"> `)
//line web/home.qtpl:37 //line web/home.qtpl:35
qw422016.E().S(p.Client.Name[0]) qw422016.E().S(p.Client.GetName())
//line web/home.qtpl:37 //line web/home.qtpl:35
qw422016.N().S(` </a> </h1> <form method="get" action="`) qw422016.N().S(` </a> </h1> </header> <main> <form method="get" action="/authorize" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" target="_self"> `)
//line web/home.qtpl:43
qw422016.E().S(p.AuthEndpoint)
//line web/home.qtpl:43
qw422016.N().S(`" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" target="_self"> `)
//line web/home.qtpl:48 //line web/home.qtpl:48
for name, value := range map[string]string{ for name, value := range map[string]string{
"client_id": p.Client.ID.String(), "client_id": p.Client.ID.String(),
"redirect_uri": p.Client.RedirectURI[0].String(), "redirect_uri": p.Client.RedirectURI[0].String(),
"response_type": "code", "response_type": domain.ResponseTypeCode.String(),
"state": p.State, "state": p.State,
"scope": domain.Scopes{domain.ScopeProfile, domain.ScopeEmail}.String(),
} { } {
//line web/home.qtpl:53 //line web/home.qtpl:54
qw422016.N().S(` <input type="hidden" name="`) qw422016.N().S(` <input type="hidden" name="`)
//line web/home.qtpl:56 //line web/home.qtpl:57
qw422016.E().S(name) qw422016.E().S(name)
//line web/home.qtpl:56 //line web/home.qtpl:57
qw422016.N().S(`" value="`) qw422016.N().S(`" value="`)
//line web/home.qtpl:57 //line web/home.qtpl:58
qw422016.E().S(value) qw422016.E().S(value)
//line web/home.qtpl:57 //line web/home.qtpl:58
qw422016.N().S(`"> `) qw422016.N().S(`"> `)
//line web/home.qtpl:58 //line web/home.qtpl:59
} }
//line web/home.qtpl:58 //line web/home.qtpl:59
qw422016.N().S(` <input type="hidden" name="scope" value="`) qw422016.N().S(` <input type="url" name="me" placeholder="https://example.com/" inputmode="url" autocomplete="url" required> <button type="submit">`)
//line web/home.qtpl:63 //line web/home.qtpl:69
qw422016.E().S(domain.ScopeProfile.String())
//line web/home.qtpl:63
qw422016.N().S(` `)
//line web/home.qtpl:63
qw422016.E().S(domain.ScopeEmail.String())
//line web/home.qtpl:63
qw422016.N().S(`"> <input type="url" name="me" placeholder="https://example.com/" inputmode="url" autocomplete="url" required> <button type="submit">`)
//line web/home.qtpl:73
p.StreamT(qw422016, "Sign In") p.StreamT(qw422016, "Sign In")
//line web/home.qtpl:73 //line web/home.qtpl:69
qw422016.N().S(`</button> </form> </div> `) qw422016.N().S(`</button> </form> </main> `)
//line web/home.qtpl:76 //line web/home.qtpl:72
} }
//line web/home.qtpl:76 //line web/home.qtpl:72
func (p *HomePage) WriteBody(qq422016 qtio422016.Writer) { func (p *HomePage) WriteBody(qq422016 qtio422016.Writer) {
//line web/home.qtpl:76 //line web/home.qtpl:72
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line web/home.qtpl:76 //line web/home.qtpl:72
p.StreamBody(qw422016) p.StreamBody(qw422016)
//line web/home.qtpl:76 //line web/home.qtpl:72
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line web/home.qtpl:76 //line web/home.qtpl:72
} }
//line web/home.qtpl:76 //line web/home.qtpl:72
func (p *HomePage) Body() string { func (p *HomePage) Body() string {
//line web/home.qtpl:76 //line web/home.qtpl:72
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line web/home.qtpl:76 //line web/home.qtpl:72
p.WriteBody(qb422016) p.WriteBody(qb422016)
//line web/home.qtpl:76 //line web/home.qtpl:72
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line web/home.qtpl:76 //line web/home.qtpl:72
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line web/home.qtpl:76 //line web/home.qtpl:72
return qs422016 return qs422016
//line web/home.qtpl:76 //line web/home.qtpl:72
} }