From 834d27d939b29a572015c93ce2437d944e2574bd Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Mon, 16 Jan 2023 16:19:22 +0600 Subject: [PATCH] :art: Format template files --- web/authorize.qtpl | 23 +++++---- web/authorize.qtpl.go | 115 +++++++++++++++++++++++------------------- web/baseof.qtpl | 89 ++++++++++++++++---------------- web/baseof.qtpl.go | 100 ++++++++++++++++++------------------ web/callback.qtpl | 8 +-- web/error.qtpl | 40 +++++++-------- web/home.qtpl | 97 +++++++++++++++++------------------ web/home.qtpl.go | 112 ++++++++++++++++++++-------------------- web/ticket.qtpl | 2 +- web/ticket.qtpl.go | 2 +- 10 files changed, 301 insertions(+), 287 deletions(-) diff --git a/web/authorize.qtpl b/web/authorize.qtpl index 05b6495..c484cd4 100644 --- a/web/authorize.qtpl +++ b/web/authorize.qtpl @@ -71,11 +71,11 @@ {% endif %} {% for key, val := range map[string]string{ - "client_id": p.Client.ID.String(), - "redirect_uri": p.RedirectURI.String(), - "response_type": p.ResponseType.String(), - "state": p.State, - } %} + "client_id": p.Client.ID.String(), + "redirect_uri": p.RedirectURI.String(), + "response_type": p.ResponseType.String(), + "state": p.State, + } %} @@ -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(), + } %} - - + name="{%s key %}" + value="{%s val %}"> + {% endfor %} {% endif %} {% if p.Me != nil %} diff --git a/web/authorize.qtpl.go b/web/authorize.qtpl.go index 56c0bf0..ff5bfe0 100644 --- a/web/authorize.qtpl.go +++ b/web/authorize.qtpl.go @@ -292,98 +292,107 @@ 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(` - - + qw422016.N().S(`"> `) //line web/authorize.qtpl:111 - } + } //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(` `) -//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(` `) -//line web/authorize.qtpl:132 +//line web/authorize.qtpl:133 } else { -//line web/authorize.qtpl:132 +//line web/authorize.qtpl:133 qw422016.N().S(` `) -//line web/authorize.qtpl:136 +//line web/authorize.qtpl:137 } -//line web/authorize.qtpl:136 +//line web/authorize.qtpl:137 qw422016.N().S(` @@ -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(` `) -//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 } diff --git a/web/baseof.qtpl b/web/baseof.qtpl index ec626d7..ad7660d 100644 --- a/web/baseof.qtpl +++ b/web/baseof.qtpl @@ -23,55 +23,57 @@ {% stripspace %} {% func (p *BaseOf) Lang() %} - {% if p.Language != language.Und %} - {%s p.Language.String() %} - {% else %} - en - {% endif %} +{% if p.Language != language.Und %} +{%s p.Language.String() %} +{% else %} +en +{% endif %} {% endfunc %} {% endstripspace %} {% collapsespace %} {% func (p *BaseOf) Title() %} - {%s p.Config.Name %} +{%s p.Config.Name %} {% endfunc %} {% func (p *BaseOf) Head() %} - {% comment %}https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs{% endcomment %} - +{% comment %}https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs{% endcomment %} + - + - + - + {% endfunc %} {% func (p *BaseOf) Body() %}{% endfunc %} {% func Template(p Page) %} - - + + - - - + + + - {%= p.Head() %} - - {%= p.Title() %} - - - {%= p.Body() %} + {%= p.Head() %} - {% code + {%= p.Title() %} + + + + {%= p.Body() %} + + {% code var path, vcsRevision string if bi, ok := debug.ReadBuildInfo(); ok { @@ -87,21 +89,22 @@ } %} - {% if vcsRevision != "" %} - - {% endif %} - - + {% if vcsRevision != "" %} + + {% endif %} + + {% endfunc %} {% func (p *BaseOf) T(format string, args ...interface{}) %} - {%s p.Printer.Sprintf(format, args...) %} +{%s p.Printer.Sprintf(format, args...) %} {% endfunc %} {% endcollapsespace %} diff --git a/web/baseof.qtpl.go b/web/baseof.qtpl.go index adf9552..871c918 100644 --- a/web/baseof.qtpl.go +++ b/web/baseof.qtpl.go @@ -237,19 +237,19 @@ func StreamTemplate(qw422016 *qt422016.Writer, p Page) { p.StreamLang(qw422016) //line web/baseof.qtpl:61 qw422016.N().S(`"> `) -//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(` `) -//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(` `) -//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(` `) -//line web/baseof.qtpl:99 +//line web/baseof.qtpl:102 } -//line web/baseof.qtpl:99 +//line web/baseof.qtpl:102 qw422016.N().S(` `) -//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 } diff --git a/web/callback.qtpl b/web/callback.qtpl index 0b07d99..5171ee1 100644 --- a/web/callback.qtpl +++ b/web/callback.qtpl @@ -9,9 +9,9 @@ {% collapsespace %} {% func (p *CallbackPage) Body() %} - {% if p.Token != nil %} -

{%s p.Token.Me.String() %}

- {%s p.Token.AccessToken %} - {% endif %} +{% if p.Token != nil %} +

{%s p.Token.Me.String() %}

+{%s p.Token.AccessToken %} +{% endif %} {% endfunc %} {% endcollapsespace %} diff --git a/web/error.qtpl b/web/error.qtpl index 026da32..9efa1e0 100644 --- a/web/error.qtpl +++ b/web/error.qtpl @@ -11,31 +11,31 @@ {% collapsespace %} {% func (p *ErrorPage) Title() %} - {%s p.T("Error") %} +{%s p.T("Error") %} {% endfunc %} {% func (p *ErrorPage) Body() %} -
- {% code err := new(domain.Error) %} - {% if errors.As(p.Error, err) %} -

{%s err.Code.String() %}

+
+ {% code err := new(domain.Error) %} + {% if errors.As(p.Error, err) %} +

{%s err.Code.String() %}

- {% if err.Description != "" %} -

{%s err.Description %}

- {% endif %} + {% if err.Description != "" %} +

{%s err.Description %}

+ {% endif %} - {% if err.URI != "" %} - + {% if err.URI != "" %} + - {%s p.T("How do I fix it?") %} - - {% endif %} - {% else %} -

{%s p.T("Error") %}

-

{%s p.Error.Error() %}

- {% endif %} -
+ {%s p.T("How do I fix it?") %} + + {% endif %} + {% else %} +

{%s p.T("Error") %}

+

{%s p.Error.Error() %}

+ {% endif %} +
{% endfunc %} {% endcollapsespace %} diff --git a/web/home.qtpl b/web/home.qtpl index 5904e8b..9e6b52b 100644 --- a/web/home.qtpl +++ b/web/home.qtpl @@ -10,70 +10,71 @@ {% collapsespace %} {% func (p *HomePage) Head() %} - {%= p.BaseOf.Head() %} - {% for i := range p.Client.RedirectURI %} - - {% endfor %} +{%= p.BaseOf.Head() %} +{% for i := range p.Client.RedirectURI %} + +{% endfor %} {% endfunc %} {% func (p *HomePage) Body() %} -
- +
+ -

- +

+ - {%s p.Client.GetName() %} - -

-

+ {%s p.Client.GetName() %} + + +
-
-
+
+ - {% for name, value := range map[string]string{ + {% 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, } %} - - {% endfor %} - - {% for _, scope := range []domain.Scope{ + + {% endfor %} + + {% for _, scope := range []domain.Scope{ domain.ScopeEmail, domain.ScopeProfile, } %} - - {% endfor %} + + {% endfor %} - + - - -
+ + +
{% endfunc %} {% endcollapsespace %} diff --git a/web/home.qtpl.go b/web/home.qtpl.go index b0f068c..5ce13ba 100644 --- a/web/home.qtpl.go +++ b/web/home.qtpl.go @@ -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(` `) -//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(`

`) -//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(`

`) -//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(` `) -//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(` `) -//line web/home.qtpl:66 +//line web/home.qtpl:67 } -//line web/home.qtpl:66 +//line web/home.qtpl:67 qw422016.N().S(`
`) -//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 } diff --git a/web/ticket.qtpl b/web/ticket.qtpl index 96dcf3f..41ba679 100644 --- a/web/ticket.qtpl +++ b/web/ticket.qtpl @@ -30,7 +30,7 @@ type="url" name="subject" inputmode="url" - placeholder="https://bob.example.org" + placeholder="https://bob.example.org/" required> diff --git a/web/ticket.qtpl.go b/web/ticket.qtpl.go index d579a88..78c90d6 100644 --- a/web/ticket.qtpl.go +++ b/web/ticket.qtpl.go @@ -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(`