Browse Source
* [chore] Refactor HTML templates and CSS * eslint * ignore "Local" * rss tests * fiddle with OG just a tiny bit * dick around with polls a bit more so SR stops saying "clickable" * remove break * oh lord * don't lazy load avatar * fix ogmeta tests * clean up some cruft * catch remaining calls to c.HTML * fix error rendering + stack overflow in tag * allow templating attributes * fix indent * set aria-hidden on status complementary content, since it's already present in the label anyway * tidy up templating calls a little * try to make styling a bit more consistent + readable * fix up some remaining CSS issues * fix up reportspull/2481/head
77 changed files with 3250 additions and 1724 deletions
@ -0,0 +1,135 @@
|
||||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package util |
||||
|
||||
import ( |
||||
"net/http" |
||||
|
||||
"github.com/gin-gonic/gin" |
||||
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" |
||||
) |
||||
|
||||
// WebPage encapsulates variables for
|
||||
// rendering an HTML template within
|
||||
// a standard GtS "page" template.
|
||||
type WebPage struct { |
||||
// Name of the template for rendering
|
||||
// the page. Eg., "example.tmpl".
|
||||
Template string |
||||
|
||||
// Instance model for rendering header,
|
||||
// footer, and "about" information.
|
||||
Instance *apimodel.InstanceV1 |
||||
|
||||
// OGMeta for rendering page
|
||||
// "meta:og*" tags. Can be nil.
|
||||
OGMeta *OGMeta |
||||
|
||||
// Paths to CSS files to add to
|
||||
// the page as "stylesheet" entries.
|
||||
// Can be nil.
|
||||
Stylesheets []string |
||||
|
||||
// Paths to JS files to add to
|
||||
// the page as "script" entries.
|
||||
// Can be nil.
|
||||
Javascript []string |
||||
|
||||
// Extra parameters to pass to
|
||||
// the template for rendering,
|
||||
// eg., "account": *Account etc.
|
||||
// Can be nil.
|
||||
Extra map[string]any |
||||
} |
||||
|
||||
// TemplateWebPage renders the given HTML template and
|
||||
// page params within the standard GtS "page" template.
|
||||
//
|
||||
// ogMeta, stylesheets, javascript, and any extra
|
||||
// properties will be provided to the template if
|
||||
// set, but can all be nil.
|
||||
func TemplateWebPage( |
||||
c *gin.Context, |
||||
page WebPage, |
||||
) { |
||||
obj := map[string]any{ |
||||
"instance": page.Instance, |
||||
"ogMeta": page.OGMeta, |
||||
"stylesheets": page.Stylesheets, |
||||
"javascript": page.Javascript, |
||||
} |
||||
|
||||
for k, v := range page.Extra { |
||||
obj[k] = v |
||||
} |
||||
|
||||
templatePage(c, page.Template, http.StatusOK, obj) |
||||
} |
||||
|
||||
// templateErrorPage renders the given
|
||||
// HTTP code, error, and request ID
|
||||
// within the standard error template.
|
||||
func templateErrorPage( |
||||
c *gin.Context, |
||||
instance *apimodel.InstanceV1, |
||||
code int, |
||||
err string, |
||||
requestID string, |
||||
) { |
||||
const errorTmpl = "error.tmpl" |
||||
|
||||
obj := map[string]any{ |
||||
"instance": instance, |
||||
"code": code, |
||||
"error": err, |
||||
"requestID": requestID, |
||||
} |
||||
|
||||
templatePage(c, errorTmpl, code, obj) |
||||
} |
||||
|
||||
// template404Page renders
|
||||
// a standard 404 page.
|
||||
func template404Page( |
||||
c *gin.Context, |
||||
instance *apimodel.InstanceV1, |
||||
requestID string, |
||||
) { |
||||
const notFoundTmpl = "404.tmpl" |
||||
|
||||
obj := map[string]any{ |
||||
"instance": instance, |
||||
"requestID": requestID, |
||||
} |
||||
|
||||
templatePage(c, notFoundTmpl, http.StatusNotFound, obj) |
||||
} |
||||
|
||||
// render the given template inside
|
||||
// "page.tmpl" with the provided
|
||||
// code and template object.
|
||||
func templatePage( |
||||
c *gin.Context, |
||||
template string, |
||||
code int, |
||||
obj map[string]any, |
||||
) { |
||||
const pageTmpl = "page.tmpl" |
||||
obj["pageContent"] = template |
||||
c.HTML(code, pageTmpl, obj) |
||||
} |
||||
@ -0,0 +1,204 @@
|
||||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package router |
||||
|
||||
import ( |
||||
"html/template" |
||||
"testing" |
||||
) |
||||
|
||||
func TestOutdentPre(t *testing.T) { |
||||
const html = template.HTML(` |
||||
<div class="text"> |
||||
<div class="content" lang="en">
|
||||
<p>Here's a bunch of HTML, read it and weep, weep then!</p> |
||||
<pre><code class="language-html"><section class="about-user"> |
||||
<div class="col-header"> |
||||
<h2>About</h2> |
||||
</div>
|
||||
<div class="fields"> |
||||
<h3 class="sr-only">Fields</h3> |
||||
<dl> |
||||
<div class="field"> |
||||
<dt>should you follow me?</dt> |
||||
<dd>maybe!</dd> |
||||
</div> |
||||
<div class="field"> |
||||
<dt>age</dt> |
||||
<dd>120</dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
<div class="bio"> |
||||
<h3 class="sr-only">Bio</h3> |
||||
<p>i post about things that concern me</p> |
||||
</div> |
||||
<div class="sr-only" role="group"> |
||||
<h3 class="sr-only">Stats</h3> |
||||
<span>Joined in Jun, 2022.</span> |
||||
<span>8 posts.</span> |
||||
<span>Followed by 1.</span> |
||||
<span>Following 1.</span> |
||||
</div> |
||||
<div class="accountstats" aria-hidden="true"> |
||||
<b>Joined</b><time datetime="2022-06-04T13:12:00.000Z">Jun, 2022</time> |
||||
<b>Posts</b><span>8</span> |
||||
<b>Followed by</b><span>1</span> |
||||
<b>Following</b><span>1</span> |
||||
</div> |
||||
</section> |
||||
</code></pre> |
||||
<p>There, hope you liked that!</p> |
||||
</div> |
||||
</div> |
||||
<div class="text"> |
||||
<div class="content" lang="en">
|
||||
<p>Here's a bunch of HTML, read it and weep, weep then!</p> |
||||
<pre><code class="language-html"><section class="about-user"> |
||||
<div class="col-header"> |
||||
<h2>About</h2> |
||||
</div>
|
||||
<div class="fields"> |
||||
<h3 class="sr-only">Fields</h3> |
||||
<dl> |
||||
<div class="field"> |
||||
<dt>should you follow me?</dt> |
||||
<dd>maybe!</dd> |
||||
</div> |
||||
<div class="field"> |
||||
<dt>age</dt> |
||||
<dd>120</dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
<div class="bio"> |
||||
<h3 class="sr-only">Bio</h3> |
||||
<p>i post about things that concern me</p> |
||||
</div> |
||||
<div class="sr-only" role="group"> |
||||
<h3 class="sr-only">Stats</h3> |
||||
<span>Joined in Jun, 2022.</span> |
||||
<span>8 posts.</span> |
||||
<span>Followed by 1.</span> |
||||
<span>Following 1.</span> |
||||
</div> |
||||
<div class="accountstats" aria-hidden="true"> |
||||
<b>Joined</b><time datetime="2022-06-04T13:12:00.000Z">Jun, 2022</time> |
||||
<b>Posts</b><span>8</span> |
||||
<b>Followed by</b><span>1</span> |
||||
<b>Following</b><span>1</span> |
||||
</div> |
||||
</section> |
||||
</code></pre> |
||||
<p>There, hope you liked that!</p> |
||||
</div> |
||||
</div> |
||||
`) |
||||
|
||||
const expected = template.HTML(` |
||||
<div class="text"> |
||||
<div class="content" lang="en">
|
||||
<p>Here's a bunch of HTML, read it and weep, weep then!</p> |
||||
<pre><code class="language-html"><section class="about-user"> |
||||
<div class="col-header"> |
||||
<h2>About</h2> |
||||
</div>
|
||||
<div class="fields"> |
||||
<h3 class="sr-only">Fields</h3> |
||||
<dl> |
||||
<div class="field"> |
||||
<dt>should you follow me?</dt> |
||||
<dd>maybe!</dd> |
||||
</div> |
||||
<div class="field"> |
||||
<dt>age</dt> |
||||
<dd>120</dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
<div class="bio"> |
||||
<h3 class="sr-only">Bio</h3> |
||||
<p>i post about things that concern me</p> |
||||
</div> |
||||
<div class="sr-only" role="group"> |
||||
<h3 class="sr-only">Stats</h3> |
||||
<span>Joined in Jun, 2022.</span> |
||||
<span>8 posts.</span> |
||||
<span>Followed by 1.</span> |
||||
<span>Following 1.</span> |
||||
</div> |
||||
<div class="accountstats" aria-hidden="true"> |
||||
<b>Joined</b><time datetime="2022-06-04T13:12:00.000Z">Jun, 2022</time> |
||||
<b>Posts</b><span>8</span> |
||||
<b>Followed by</b><span>1</span> |
||||
<b>Following</b><span>1</span> |
||||
</div> |
||||
</section> |
||||
</code></pre> |
||||
<p>There, hope you liked that!</p> |
||||
</div> |
||||
</div> |
||||
<div class="text"> |
||||
<div class="content" lang="en">
|
||||
<p>Here's a bunch of HTML, read it and weep, weep then!</p> |
||||
<pre><code class="language-html"><section class="about-user"> |
||||
<div class="col-header"> |
||||
<h2>About</h2> |
||||
</div>
|
||||
<div class="fields"> |
||||
<h3 class="sr-only">Fields</h3> |
||||
<dl> |
||||
<div class="field"> |
||||
<dt>should you follow me?</dt> |
||||
<dd>maybe!</dd> |
||||
</div> |
||||
<div class="field"> |
||||
<dt>age</dt> |
||||
<dd>120</dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
<div class="bio"> |
||||
<h3 class="sr-only">Bio</h3> |
||||
<p>i post about things that concern me</p> |
||||
</div> |
||||
<div class="sr-only" role="group"> |
||||
<h3 class="sr-only">Stats</h3> |
||||
<span>Joined in Jun, 2022.</span> |
||||
<span>8 posts.</span> |
||||
<span>Followed by 1.</span> |
||||
<span>Following 1.</span> |
||||
</div> |
||||
<div class="accountstats" aria-hidden="true"> |
||||
<b>Joined</b><time datetime="2022-06-04T13:12:00.000Z">Jun, 2022</time> |
||||
<b>Posts</b><span>8</span> |
||||
<b>Followed by</b><span>1</span> |
||||
<b>Following</b><span>1</span> |
||||
</div> |
||||
</section> |
||||
</code></pre> |
||||
<p>There, hope you liked that!</p> |
||||
</div> |
||||
</div> |
||||
`) |
||||
|
||||
out := outdentPre(html) |
||||
if out != expected { |
||||
t.Fatalf("unexpected output:\n`%s`\n", out) |
||||
} |
||||
} |
||||
@ -1 +1,3 @@
|
||||
node_modules |
||||
node_modules |
||||
prism.js |
||||
prism.css |
||||
@ -0,0 +1,39 @@
|
||||
/* |
||||
GoToSocial |
||||
Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Affero General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Affero General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Affero General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ |
||||
|
||||
.about { |
||||
display: flex; |
||||
flex-direction: column; |
||||
gap: 2rem; |
||||
padding: 2rem; |
||||
|
||||
background: $bg-accent; |
||||
box-shadow: $boxshadow; |
||||
border: $boxshadow-border; |
||||
border-radius: $br; |
||||
|
||||
.about-section { |
||||
ul, ol { |
||||
margin-top: 0; |
||||
} |
||||
|
||||
h3, h4 { |
||||
margin-top: 0; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,107 @@
|
||||
/* |
||||
GoToSocial |
||||
Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Affero General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Affero General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Affero General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ |
||||
|
||||
.page { |
||||
display: grid; |
||||
min-height: 100vh; |
||||
|
||||
grid-template-columns: 1fr minmax(auto, 50rem) 1fr; |
||||
grid-template-columns: 1fr min(92%, 50rem) 1fr; |
||||
grid-template-rows: auto 1fr auto; |
||||
} |
||||
|
||||
.page-header, .page-footer { |
||||
grid-column: 1 / span 3; |
||||
} |
||||
|
||||
.page-content { |
||||
grid-column: 2; |
||||
align-self: start; |
||||
} |
||||
|
||||
.page-header { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
padding: 1.5rem; |
||||
gap: 1rem; |
||||
|
||||
a { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
gap: 1rem; |
||||
justify-content: center; |
||||
|
||||
img { |
||||
align-self: center; |
||||
} |
||||
|
||||
h1 { |
||||
align-self: center; |
||||
text-align: center; |
||||
|
||||
font-size: 1.5rem; |
||||
line-height: 1.5rem; |
||||
word-wrap: anywhere; |
||||
color: $fg; |
||||
} |
||||
} |
||||
|
||||
aside { |
||||
margin: 0; |
||||
font-style: italic; |
||||
font-weight: normal; |
||||
text-align: center; |
||||
font-size: 1.2rem; |
||||
|
||||
.count { |
||||
font-weight: bold; |
||||
color: $fg-accent; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.page-footer { |
||||
align-self: end; |
||||
|
||||
nav ul { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
justify-content: space-around; |
||||
|
||||
/* Override list styling */ |
||||
list-style-type: none; |
||||
padding-left: 0; |
||||
|
||||
li { |
||||
text-align: center; |
||||
padding: 1rem; |
||||
flex-grow: 1; |
||||
|
||||
a { |
||||
font-weight: bold; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@media screen and (max-width: 600px) { |
||||
.page-header { |
||||
text-align: center; |
||||
} |
||||
} |
||||
@ -0,0 +1,5 @@
|
||||
/* PrismJS 1.29.0 |
||||
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+bash+c+csharp+cpp+docker+elixir+erlang+go+go-module+ini+java+json+kotlin+lua+makefile+markup-templating+nginx+nix+perl+php+promql+python+r+jsx+tsx+ruby+rust+scala+sql+swift+typescript&plugins=show-invisibles+show-language+toolbar+copy-to-clipboard */ |
||||
code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green} |
||||
.token.cr,.token.lf,.token.space,.token.tab:not(:empty){position:relative}.token.cr:before,.token.lf:before,.token.space:before,.token.tab:not(:empty):before{color:grey;opacity:.6;position:absolute}.token.tab:not(:empty):before{content:'\21E5'}.token.cr:before{content:'\240D'}.token.crlf:before{content:'\240D\240A'}.token.lf:before{content:'\240A'}.token.space:before{content:'\00B7'} |
||||
div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none} |
||||
@ -0,0 +1,56 @@
|
||||
/* |
||||
GoToSocial |
||||
Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Affero General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Affero General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Affero General Public License |
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ |
||||
|
||||
.thread { |
||||
display: flex; |
||||
flex-direction: column; |
||||
gap: 0.4rem; |
||||
|
||||
/* |
||||
This column header might contain |
||||
quite some info, so let it wrap. |
||||
*/ |
||||
.col-header { |
||||
display: flex; |
||||
flex-direction: row; |
||||
flex-wrap: wrap; |
||||
column-gap: 1rem; |
||||
row-gap: 0.5rem; |
||||
|
||||
box-shadow: $boxshadow; |
||||
border: $boxshadow-border; |
||||
|
||||
h2 { |
||||
margin-right: auto; |
||||
} |
||||
} |
||||
|
||||
.status { |
||||
border-radius: 0; |
||||
|
||||
&:last-child { |
||||
border-bottom-left-radius: $br; |
||||
border-bottom-right-radius: $br; |
||||
|
||||
.status-info { |
||||
border-bottom-left-radius: $br; |
||||
border-bottom-right-radius: $br; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because one or more lines are too long
@ -1,122 +0,0 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
|
||||
{{- /* |
||||
NESTED TEMPLATE DECLARATIONS |
||||
If some if/else macro is used multiple times, declare it once here instead. |
||||
When invoking these nested templates, remember to pass in the values passed |
||||
to the executing template, ie., use '{{ template "example" . }}' not |
||||
'{{ template "example" }}', otherwise you'll end up with empty variables. |
||||
*/ -}} |
||||
{{ define "thumbnailType" }}{{ if .instance.ThumbnailType }}{{ .instance.ThumbnailType }}{{ else }}image/png{{ end }}{{ end }} |
||||
{{ define "instanceTitle" }}{{ if .ogMeta }}{{ .ogMeta.Title }}{{ else }}{{ .instance.Title }} - GoToSocial{{ end }}{{ end }} |
||||
|
||||
{{- /* |
||||
BOILERPLATE GOES HERE |
||||
*/ -}} |
||||
<!DOCTYPE html> |
||||
<!-- header.tmpl --> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
{{- /* |
||||
ROBOTS META TAGS |
||||
If this template was provided with a specific robots meta policy, use that. |
||||
Otherwise, fall back to a default restrictive policy. |
||||
See: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag |
||||
*/ -}} |
||||
<meta name="robots" content="{{ if .robotsMeta }}{{ .robotsMeta }}{{ else }}noindex, nofollow{{ end }}"> |
||||
|
||||
{{- /* |
||||
OPEN GRAPH META TAGS |
||||
To enable fancy previews of links to GtS posts/profiles shared via instant |
||||
messaging, or other social media, parse out provided Open Graph meta tags. |
||||
*/ -}} |
||||
{{ if .ogMeta -}} |
||||
{{ if .ogMeta.Locale }}<meta name="og:locale" content="{{ .ogMeta.Locale }}">{{ end }} |
||||
<meta property="og:type" content="{{ .ogMeta.Type }}"> |
||||
<meta property="og:title" content="{{ .ogMeta.Title }}"> |
||||
<meta property="og:url" content="{{ .ogMeta.URL }}"> |
||||
<meta property="og:site_name" content="{{ .ogMeta.SiteName }}"> |
||||
<meta property="og:description" {{ .ogMeta.Description | noescapeAttr }}> |
||||
{{ if .ogMeta.ArticlePublisher }} |
||||
<meta property="og:article:publisher" content="{{ .ogMeta.ArticlePublisher }}"> |
||||
<meta property="og:article:author" content="{{ .ogMeta.ArticleAuthor }}"> |
||||
<meta property="og:article:modified_time" content="{{ .ogMeta.ArticleModifiedTime }}"> |
||||
<meta property="og:article:published_time" content="{{ .ogMeta.ArticlePublishedTime }}"> |
||||
{{ end }} |
||||
{{ if .ogMeta.ProfileUsername }}<meta property="og:profile:username" content="{{ .ogMeta.ProfileUsername }}">{{ end }} |
||||
<meta property="og:image" content="{{ .ogMeta.Image }}"> |
||||
{{ if .ogMeta.ImageAlt }}<meta property="og:image:alt" content="{{ .ogMeta.ImageAlt }}">{{ end }} |
||||
{{ if .ogMeta.ImageWidth }} |
||||
<meta property="og:image:width" content="{{ .ogMeta.ImageWidth }}"> |
||||
<meta property="og:image:height" content="{{ .ogMeta.ImageHeight }}"> |
||||
{{ end }} |
||||
{{- end }} |
||||
|
||||
{{- /* |
||||
ICON |
||||
For icon, provide a link to the instance thumbnail. If the instance admin has |
||||
set a custom thumbnail, use the type they uploaded, else assume image/png. |
||||
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#icon |
||||
*/ -}} |
||||
<link rel="icon" href="{{ .instance.Thumbnail }}" type="{{ template "thumbnailType" . }}"> |
||||
<link rel="apple-touch-icon" href="{{ .instance.Thumbnail }}" type="{{ template "thumbnailType" . }}"> |
||||
<link rel="apple-touch-startup-image" href="{{ .instance.Thumbnail }}" type="{{ template "thumbnailType" . }}"> |
||||
|
||||
{{- /* |
||||
RSS FEED |
||||
To enable automatic rss feed discovery for feed readers, provide the 'alternate' |
||||
link only if rss is enabled. |
||||
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#alternate |
||||
*/ -}} |
||||
{{ if .rssFeed -}} |
||||
<link rel="alternate" type="application/rss+xml" href="{{ .rssFeed }}" title="{{ template "instanceTitle" . }}"> |
||||
{{- end }} |
||||
|
||||
{{- /* |
||||
STYLESHEET STUFF |
||||
To try to speed up rendering a little bit, offer a preload for each stylesheet. |
||||
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload. |
||||
*/ -}} |
||||
<link rel="preload" href="/assets/dist/_colors.css" as="style"> |
||||
<link rel="preload" href="/assets/dist/base.css" as="style"> |
||||
{{ range .stylesheets }}<link rel="preload" href="{{ . }}" as="style">{{ end }} |
||||
<link rel="stylesheet" href="/assets/dist/_colors.css"> |
||||
<link rel="stylesheet" href="/assets/dist/base.css"> |
||||
{{ range .stylesheets }}<link rel="stylesheet" href="{{ . }}">{{ end }} |
||||
<title>{{ template "instanceTitle" . }}</title> |
||||
</head> |
||||
|
||||
<body> |
||||
<div class="page"> |
||||
<header> |
||||
<a aria-label="{{ .instance.Title }}. Go to instance homepage" href="/" class="nounderline header"> |
||||
<img src="{{ .instance.Thumbnail }}" |
||||
alt="{{ if .instance.ThumbnailDescription }}{{ .instance.ThumbnailDescription }}{{ else }}Instance Logo{{ end }}" /> |
||||
<h1> |
||||
{{ .instance.Title }} |
||||
</h1> |
||||
</a> |
||||
</header> |
||||
<div class="content"> |
||||
@ -0,0 +1,115 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- with . }} |
||||
<section role="region" class="about-section apps" aria-labelledby="apps"> |
||||
<h3 id="apps">Client applications</h3> |
||||
<p> |
||||
GoToSocial does not provide its own webclient, but implements the Mastodon client API. |
||||
You can use this server through a variety of other clients: |
||||
</p> |
||||
<ul class="applist nodot" role="group"> |
||||
<li class="applist-entry"> |
||||
<div class="applist-text"> |
||||
<p><strong>Semaphore</strong> is a web client designed for speed and simplicity.</p> |
||||
<a |
||||
href="https://semaphore.social/" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
Use Semaphore |
||||
</a> |
||||
</div> |
||||
<svg |
||||
role="img" |
||||
aria-labelledby="semaphore-title semaphore-desc" |
||||
class="applist-logo redraw" |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
viewBox="0 0 146 120" |
||||
width="100" |
||||
height="100" |
||||
> |
||||
<title id="semaphore-title">The Semaphore logo</title> |
||||
<desc id="semaphore-desc">A waving flag</desc> |
||||
<path d="M68.13 0C53.94 0 42.81 20 13.9 27.1l-2.23-5.29a6.5 6.5 0 0 0-5.17-10.4 6.5 6.5 0 0 0-.81 12.95L46.2 120l5.99-2.5-14.42-33.33c22.8-6.86 32.51-22.16 49.83-20.58 9.9.9 4.87 19.56 8.11 17.93 16.22-8.15 32.44-11.41 50.29-11.41-7.96-9.78-17.38-20.55-22.71-31.74L120.8 32c-2.32-7.33-2.56-14.75.87-22.22-9.74-3.26-21.1 0-32.45 4.9C82.2 9.77 79.5 0 68.13 0zM15.26 30.42c8.95 6.63 13.63 13.86 16.07 20.94l1.62 6.32c1.24 6.58 1.07 12.8 1.27 18.03z"></path> |
||||
</svg> |
||||
</li> |
||||
<li class="applist-entry"> |
||||
<div class="applist-text"> |
||||
<p><strong>Tusky</strong> is a lightweight mobile client for Android.</p> |
||||
<a |
||||
href="https://tusky.app" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
Get Tusky |
||||
</a> |
||||
</div> |
||||
<img |
||||
class="applist-logo" |
||||
src="/assets/tusky.svg" |
||||
alt="The Tusky mascot, a cartoon elephant tooting happily" |
||||
title="The Tusky mascot, a cartoon elephant tooting happily" |
||||
width="100" |
||||
height="100" |
||||
/> |
||||
</li> |
||||
<li class="applist-entry"> |
||||
<div class="applist-text"> |
||||
<p><strong>Feditext</strong> (beta) is a beautiful client for iOS, iPadOS and macOS.</p> |
||||
<a |
||||
href="https://fedi.software/@Feditext" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
Get Feditext |
||||
</a> |
||||
</div> |
||||
<img |
||||
class="applist-logo" |
||||
src="/assets/feditext.svg" |
||||
alt="The Feditext logo, the characters 'ft' at a slight angle" |
||||
title="The Feditext logo, the characters 'ft' at a slight angle" |
||||
width="100" |
||||
height="100" |
||||
/> |
||||
</li> |
||||
<li class="applist-entry"> |
||||
<div class="applist-text"> |
||||
<p>Or try one of the <strong>Mastodon clients</strong> listed on the official Mastodon page.</p> |
||||
<a |
||||
href="https://joinmastodon.org/apps" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
Get Mastodon apps |
||||
</a> |
||||
</div> |
||||
<img |
||||
class="applist-logo" |
||||
src="/assets/mastodon.svg" |
||||
alt="The Mastodon logo, the character 'M' in a speech bubble" |
||||
title="The Mastodon logo, the character 'M' in a speech bubble" |
||||
width="100" |
||||
height="100" |
||||
/> |
||||
</li> |
||||
</ul> |
||||
</section> |
||||
{{- end }} |
||||
@ -0,0 +1,85 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- /* |
||||
NESTED TEMPLATE DECLARATIONS |
||||
If some if/else macro is used multiple times, declare it once here instead. |
||||
When invoking these nested templates, remember to pass in the values passed |
||||
to the executing template, ie., use '{{ template "example" . }}' not |
||||
'{{ template "example" }}', otherwise you'll end up with empty variables. |
||||
*/ -}} |
||||
|
||||
{{- define "thumbnailType" -}} |
||||
{{- if .instance.ThumbnailType -}} |
||||
{{- .instance.ThumbnailType -}} |
||||
{{- else -}} |
||||
image/png |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- define "instanceTitle" -}} |
||||
{{- if .ogMeta -}} |
||||
{{- demojify .ogMeta.Title | noescape -}} |
||||
{{- else -}} |
||||
{{- .instance.Title }} - GoToSocial |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<meta name="robots" content="{{- if .robotsMeta -}}{{- .robotsMeta -}}{{- else -}}noindex, nofollow{{- end -}}"> |
||||
{{- if .ogMeta }} |
||||
{{- include "page_ogmeta.tmpl" . | indent 2 }} |
||||
{{- else }} |
||||
{{- end }} |
||||
{{- if .rssFeed }} |
||||
<link rel="alternate" type="application/rss+xml" href="{{- .rssFeed -}}" title="{{- template "instanceTitle" . -}}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
{{- if .account }} |
||||
<link rel="alternate" type="application/activity+json" href="/users/{{- .account.Username -}}"> |
||||
{{- else if .status }} |
||||
<link rel="alternate" type="application/activity+json" href="/users/{{- .status.Account.Username -}}/statuses/{{- .status.ID -}}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
<link rel="icon" href="{{- .instance.Thumbnail -}}" type="{{- template "thumbnailType" . -}}"> |
||||
<link rel="apple-touch-icon" href="{{- .instance.Thumbnail -}}" type="{{- template "thumbnailType" . -}}"> |
||||
<link rel="apple-touch-startup-image" href="{{- .instance.Thumbnail -}}" type="{{- template "thumbnailType" . -}}"> |
||||
{{- include "page_stylesheets.tmpl" . | indent 2 }} |
||||
{{- range .javascript }} |
||||
<script type="text/javascript" src="{{- . -}}" async="" defer=""></script> |
||||
{{- end }} |
||||
<title>{{- template "instanceTitle" . -}}</title> |
||||
</head> |
||||
<body class="page"> |
||||
<header class="page-header"> |
||||
{{- include "page_header.tmpl" . | indent 3 }} |
||||
</header> |
||||
<div class="page-content"> |
||||
{{- include .pageContent . | indent 3 | outdentPre }} |
||||
</div> |
||||
<footer class="page-footer"> |
||||
{{- include "page_footer.tmpl" . | indent 3 }} |
||||
</footer> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,67 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- with . }} |
||||
<nav> |
||||
<ul class="nodot"> |
||||
<li id="about"> |
||||
<a |
||||
href="/about" |
||||
class="nounderline" |
||||
> |
||||
About {{ .instance.Title }} |
||||
</a> |
||||
</li> |
||||
<li id="version"> |
||||
<a |
||||
href="https://github.com/superseriousbusiness/gotosocial" |
||||
class="nounderline" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
<span aria-hidden="true">🦥</span> |
||||
Source - GoToSocial {{ .instance.Version }} |
||||
<span aria-hidden="true">🦥</span> |
||||
</a> |
||||
</li> |
||||
{{- if .instance.ContactAccount }} |
||||
<li id="contact"> |
||||
<a |
||||
href="/@{{- .instance.ContactAccount.Username -}}" |
||||
class="nounderline" |
||||
> |
||||
Contact account - {{ .instance.ContactAccount.Username }} |
||||
</a> |
||||
</li> |
||||
{{- end }} |
||||
{{- if .instance.Email }} |
||||
<li id="email"> |
||||
<a |
||||
href="mailto:{{- .instance.Email -}}" |
||||
class="nounderline" |
||||
rel="nofollow noreferrer noopener" |
||||
target="_blank" |
||||
> |
||||
Email - {{ .instance.Email }} |
||||
</a> |
||||
</li> |
||||
{{- end }} |
||||
</ul> |
||||
</nav> |
||||
{{- end }} |
||||
@ -0,0 +1,72 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- define "thumbnailDescription" -}} |
||||
{{- if .instance.ThumbnailDescription -}} |
||||
{{- .instance.ThumbnailDescription -}} |
||||
{{- else -}} |
||||
Instance Logo |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- define "strapUsers" -}} |
||||
{{- with .instance.Stats.user_count -}} |
||||
{{- if eq . 1 -}} |
||||
<span class="count">{{- . -}}</span> user |
||||
{{- else -}} |
||||
<span class="count">{{- . -}}</span> users |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- define "strapPosts" -}} |
||||
{{- with .instance.Stats.status_count -}} |
||||
{{- if eq . 1 -}} |
||||
<span class="count">{{- . -}}</span> post |
||||
{{- else -}} |
||||
<span class="count">{{- . -}}</span> posts |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- define "strapInstances" -}} |
||||
{{- with .instance.Stats.domain_count -}} |
||||
{{- if eq . 1 -}} |
||||
<span class="count">{{- . -}}</span> other instance |
||||
{{- else -}} |
||||
<span class="count">{{- . -}}</span> other instances |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- with . }} |
||||
<a aria-label="{{- .instance.Title -}}. Go to instance homepage" href="/" class="nounderline"> |
||||
<img |
||||
src="{{- .instance.Thumbnail -}}" |
||||
alt="{{- template "thumbnailDescription" . -}}" |
||||
title="{{- template "thumbnailDescription" . -}}" |
||||
width="100" |
||||
height="100" |
||||
/> |
||||
<h1>{{- .instance.Title -}}</h1> |
||||
</a> |
||||
{{- if .showStrap }} |
||||
<aside>home to {{ template "strapUsers" . }} who wrote {{ template "strapPosts" . }}, federating with {{ template "strapInstances" . }}</aside> |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,57 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- /* |
||||
OPEN GRAPH META TAGS |
||||
To enable fancy previews of links to GtS posts/profiles shared via instant |
||||
messaging, or other social media, parse out provided Open Graph meta tags. |
||||
*/ -}} |
||||
|
||||
{{- with .ogMeta }} |
||||
{{- if .Locale }} |
||||
<meta name="og:locale" content="{{- .Locale -}}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
<meta property="og:type" content="{{- .Type -}}"> |
||||
<meta property="og:title" content="{{- demojify .Title | noescape -}}"> |
||||
<meta property="og:url" content="{{- .URL -}}"> |
||||
<meta property="og:site_name" content="{{- .SiteName -}}"> |
||||
<meta property="og:description" {{ demojify .Description | noescapeAttr -}}> |
||||
{{- if .ArticlePublisher }} |
||||
<meta property="og:article:publisher" content="{{ .ArticlePublisher }}"> |
||||
<meta property="og:article:author" content="{{ .ArticleAuthor }}"> |
||||
<meta property="og:article:modified_time" content="{{ .ArticleModifiedTime }}"> |
||||
<meta property="og:article:published_time" content="{{ .ArticlePublishedTime }}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
{{- if .ProfileUsername }} |
||||
<meta property="og:profile:username" content="{{- .ProfileUsername -}}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
<meta property="og:image" content="{{- .Image -}}"> |
||||
{{- if .ImageAlt }} |
||||
<meta property="og:image:alt" content="{{- .ImageAlt -}}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
{{- if .ImageWidth }} |
||||
<meta property="og:image:width" content="{{ .ImageWidth }}"> |
||||
<meta property="og:image:height" content="{{ .ImageHeight }}"> |
||||
{{- else }} |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,41 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- /* |
||||
Order of stylesheet loading is important: _colors and base should always be loaded |
||||
before any other provided sheets, since the latter cascade from the former. |
||||
|
||||
To try to speed up rendering a little bit, offer a preload for each stylesheet. |
||||
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload. |
||||
*/ -}} |
||||
|
||||
{{- with . }} |
||||
<link rel="preload" href="/assets/dist/_colors.css" as="style"> |
||||
<link rel="preload" href="/assets/dist/base.css" as="style"> |
||||
<link rel="preload" href="/assets/dist/page.css" as="style"> |
||||
{{- range .stylesheets }} |
||||
<link rel="preload" href="{{- . -}}" as="style"> |
||||
{{- end }} |
||||
<link rel="stylesheet" href="/assets/dist/_colors.css"> |
||||
<link rel="stylesheet" href="/assets/dist/base.css"> |
||||
<link rel="stylesheet" href="/assets/dist/page.css"> |
||||
{{- range .stylesheets }} |
||||
<link rel="stylesheet" href="{{- . -}}"> |
||||
{{- end }} |
||||
{{- end }} |
||||
@ -0,0 +1,55 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- define "ariaLabel" -}} |
||||
@{{ .Account.Acct -}}, {{ timestamp .CreatedAt -}} |
||||
{{- if .LanguageTag -}} |
||||
, language {{ .LanguageTag.DisplayStr -}} |
||||
{{- end -}} |
||||
{{- if .MediaAttachments -}} |
||||
, has media |
||||
{{- end -}} |
||||
{{- if .RepliesCount -}} |
||||
{{- if eq .RepliesCount 1 -}} |
||||
, 1 reply |
||||
{{- else -}} |
||||
, {{ .RepliesCount }} replies |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- if .FavouritesCount -}} |
||||
{{- if eq .FavouritesCount 1 -}} |
||||
, 1 favourite |
||||
{{- else -}} |
||||
, {{ .FavouritesCount }} favourites |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- if .ReblogsCount -}} |
||||
{{- if eq .ReblogsCount 1 -}} |
||||
, 1 boost |
||||
{{- else -}} |
||||
, {{ .ReblogsCount }} boosts |
||||
{{- end -}} |
||||
{{- end -}} |
||||
{{- end -}} |
||||
|
||||
{{- with . }} |
||||
id="{{- .ID -}}{{- if .Pinned -}}-pinned{{- end -}}" |
||||
role="region" |
||||
aria-label="{{- template "ariaLabel" . -}}" |
||||
{{- end }} |
||||
@ -0,0 +1,56 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- with .Account }} |
||||
<address> |
||||
{{- if $.Local }} |
||||
<a |
||||
href="{{- .URL -}}" |
||||
rel="author" |
||||
title="Open profile" |
||||
> |
||||
{{- else }} |
||||
<a |
||||
href="{{- .URL -}}" |
||||
rel="author nofollow noreferrer noopener" target="_blank" |
||||
title="Open remote profile (opens in a new window)" |
||||
> |
||||
{{- end }} |
||||
<img |
||||
class="avatar" |
||||
aria-hidden="true" |
||||
src="{{- .Avatar -}}" |
||||
alt="Avatar for {{ .Username -}}" |
||||
title="Avatar for {{ .Username -}}" |
||||
> |
||||
<div class="author-strap"> |
||||
<span class="displayname text-cutoff"> |
||||
{{- if .DisplayName -}} |
||||
{{- emojify .Emojis (escape .DisplayName) -}} |
||||
{{- else -}} |
||||
{{- .Username -}} |
||||
{{- end -}} |
||||
</span> |
||||
<span class="sr-only">,</span> |
||||
<span class="username text-cutoff">@{{- .Acct -}}</span> |
||||
</div> |
||||
<span class="sr-only">(open profile)</span> |
||||
</a> |
||||
</address> |
||||
{{- end }} |
||||
@ -0,0 +1,74 @@
|
||||
{{- /* |
||||
// GoToSocial |
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org |
||||
// SPDX-License-Identifier: AGPL-3.0-or-later |
||||
// |
||||
// This program is free software: you can redistribute it and/or modify |
||||
// it under the terms of the GNU Affero General Public License as published by |
||||
// the Free Software Foundation, either version 3 of the License, or |
||||
// (at your option) any later version. |
||||
// |
||||
// This program is distributed in the hope that it will be useful, |
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
// GNU Affero General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Affero General Public License |
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
*/ -}} |
||||
|
||||
{{- with . }} |
||||
<dl class="status-stats"> |
||||
<div class="stats-grouping"> |
||||
<div class="stats-item published-at text-cutoff"> |
||||
<dt class="sr-only">Published</dt> |
||||
<dd> |
||||
<time datetime="{{- .CreatedAt -}}">{{- .CreatedAt | timestampPrecise -}}</time> |
||||
</dd> |
||||
</div> |
||||
<div class="stats-grouping"> |
||||
<div class="stats-item" title="Replies"> |
||||
<dt> |
||||
<span class="sr-only">Replies</span> |
||||
<i class="fa fa-reply-all" aria-hidden="true"></i> |
||||
</dt> |
||||
<dd>{{- .RepliesCount -}}</dd> |
||||
</div> |
||||
<div class="stats-item" title="Faves"> |
||||
<dt> |
||||
<span class="sr-only">Favourites</span> |
||||
<i class="fa fa-star" aria-hidden="true"></i> |
||||
</dt> |
||||
<dd>{{- .FavouritesCount -}}</dd> |
||||
</div> |
||||
<div class="stats-item" title="Boosts"> |
||||
<dt> |
||||
<span class="sr-only">Reblogs</span> |
||||
<i class="fa fa-retweet" aria-hidden="true"></i> |
||||
</dt> |
||||
<dd>{{- .ReblogsCount -}}</dd> |
||||
</div> |
||||
{{- if .Pinned }} |
||||
<div class="stats-item" title="Pinned"> |
||||
<dt> |
||||
<span class="sr-only">Pinned</span> |
||||
<i class="fa fa-thumb-tack" aria-hidden="true"></i> |
||||
</dt> |
||||
<dd class="sr-only">{{- .Pinned -}}</dd> |
||||
</div> |
||||
{{- else }} |
||||
{{- end }} |
||||
</div> |
||||
</div> |
||||
{{- if .LanguageTag.DisplayStr }} |
||||
<div class="stats-item language" title="{{ .LanguageTag.DisplayStr }}"> |
||||
<dt class="sr-only">Language</dt> |
||||
<dd> |
||||
<span class="sr-only">{{ .LanguageTag.DisplayStr }}</span> |
||||
<span aria-hidden="true">{{- .LanguageTag.TagStr -}}</span> |
||||
</dd> |
||||
</div> |
||||
{{- else }} |
||||
{{- end }} |
||||
</dl> |
||||
{{- end }} |
||||
Loading…
Reference in new issue