delete explicit mentions to njump.me and use s.CanonicalHost

This commit is contained in:
fiatjaf
2023-09-24 13:51:19 -03:00
parent 4e89a2125e
commit a082efc45d
10 changed files with 57 additions and 42 deletions

View File

@@ -431,7 +431,7 @@ func render(w http.ResponseWriter, r *http.Request) {
"lastNotes": data.renderableLastNotes,
"parentNevent": data.parentNevent,
"authorRelays": data.authorRelays,
"CanonicalHost": s.CanonicalHost,
"s": s,
}
// if a mapping is not found fallback to raw

View File

@@ -86,7 +86,7 @@ func renderArchive(w http.ResponseWriter, r *http.Request) {
"paginationUrl": area,
"nextPage": fmt.Sprint(nextPage),
"prevPage": fmt.Sprint(prevPage),
"CanonicalHost": s.CanonicalHost,
"s": s,
}
if len(data) != 0 {

View File

@@ -37,6 +37,7 @@ func renderHomepage(w http.ResponseWriter, r *http.Request) {
}
params := map[string]any{
"s": s,
"npubs": npubs,
"lastNotes": lastNotes,
}

View File

@@ -68,13 +68,13 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
"clients": []ClientReference{
{Name: "Coracle", URL: "https://coracle.social/relays/" + hostname},
},
"type": "relay",
"info": info,
"hostname": hostname,
"proxy": "https://" + hostname + "/njump/proxy?src=",
"lastNotes": renderableLastNotes,
"modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"),
"CanonicalHost": s.CanonicalHost,
"type": "relay",
"info": info,
"hostname": hostname,
"proxy": "https://" + hostname + "/njump/proxy?src=",
"lastNotes": renderableLastNotes,
"modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"),
"s": s,
}
if len(renderableLastNotes) != 0 {

View File

@@ -9,7 +9,7 @@ func renderRobots(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "max-age=3600")
params := map[string]any{
"CanonicalHost": s.CanonicalHost,
"s": s,
}
if err := tmpl.ExecuteTemplate(w, templateMapping[typ], params); err != nil {

View File

@@ -26,31 +26,33 @@
(yet) working.
</p>
<p>
<i>njump</i> currently lives under njump.me, you can reach it
appending a nostr (<a
<i>njump</i> currently lives under {{ .s.CanonicalHost }}, you can
reach it appending a Nostr (<a
href="https://github.com/nostr-protocol/nips/blob/master/19.md"
>NIP-19</a
>) entity (<code>npub</code>, <code>nevent</code>,
<code>naddr</code>, etc) after the domain:
<span class="exampleUrl">njump.me/&lt;nip-19-entity&gt;</span>.
<span class="exampleUrl"
>{{ .s.CanonicalHost }}/&lt;nip-19-entity&gt;</span
>.
</p>
<p>
For example, here's
<a
href="https://njump.me/npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6"
href="/npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6"
>a user</a
>
<a
href="https://njump.me/npub10000003zmk89narqpczy4ff6rnuht2wu05na7kpnh3mak7z2tqzsv8vwqk"
href="/npub10000003zmk89narqpczy4ff6rnuht2wu05na7kpnh3mak7z2tqzsv8vwqk"
>profile</a
>,
<a
href="https://njump.me/nevent1qqs860kwt3m500hfnve6vxdpagkfqkm6hq03dnn2n7u8dev580kd2uszyztuwzjyxe4x2dwpgken87tna2rdlhpd02va5cvvgrrywpddnr3jydc2w4t"
href="/nevent1qqs860kwt3m500hfnve6vxdpagkfqkm6hq03dnn2n7u8dev580kd2uszyztuwzjyxe4x2dwpgken87tna2rdlhpd02va5cvvgrrywpddnr3jydc2w4t"
>a note</a
>
and a
<a
href="https://njump.me/naddr1qqxnzd3cxqmrzv3exgmr2wfeqy08wumn8ghj7mn0wd68yttsw43zuam9d3kx7unyv4ezumn9wshszyrhwden5te0dehhxarj9ekk7mf0qy88wumn8ghj7mn0wvhxcmmv9uq3zamnwvaz7tmwdaehgu3wwa5kuef0qy2hwumn8ghj7un9d3shjtnwdaehgu3wvfnj7q3qdergggklka99wwrs92yz8wdjs952h2ux2ha2ed598ngwu9w7a6fsxpqqqp65wy2vhhv"
href="/naddr1qqxnzd3cxqmrzv3exgmr2wfeqy08wumn8ghj7mn0wd68yttsw43zuam9d3kx7unyv4ezumn9wshszyrhwden5te0dehhxarj9ekk7mf0qy88wumn8ghj7mn0wvhxcmmv9uq3zamnwvaz7tmwdaehgu3wwa5kuef0qy2hwumn8ghj7un9d3shjtnwdaehgu3wvfnj7q3qdergggklka99wwrs92yz8wdjs952h2ux2ha2ed598ngwu9w7a6fsxpqqqp65wy2vhhv"
>long blog post</a
>.
</p>
@@ -60,7 +62,7 @@
<div class="try">
<form action="/try" method="POST">
<div class="tryForm">
<div>njump.me/</div>
<div>{{ .s.CanonicalHost }}/</div>
<input
id="nip19entity"
name="nip19entity"
@@ -138,11 +140,11 @@
>NIP-05</a
>
inspired permalink:
<span class="exampleUrl">njump.me/&lt;nip-5&gt;</span>, for
example:
<a href="https://njump.me/nvk.org">https://njump.me/nvk.org</a> or
<a href="https://njump.me/mike@mikedilger.com"
>https://njump.me/mike@mikedilger.com</a
<span class="exampleUrl">{{ .s.CanonicalHost }}/&lt;nip-5&gt;</span
>, for example:
<a href="/nvk.org">https://{{ .s.CanonicalHost }}/nvk.org</a> or
<a href="/mike@mikedilger.com"
>https://{{ .s.CanonicalHost }}/mike@mikedilger.com</a
>.
</p>
<p>
@@ -153,10 +155,11 @@
<h2>Bonus 2: Relays view</h2>
<p>
You can have a view of the last content posted to a relay using
<span class="exampleUrl">njump.me/r/&lt;relay-host&gt;</span>, for
example:
<a href="https://njump.me/r/nostr.wine"
>https://njump.me/r/nostr.wine</a
<span class="exampleUrl"
>{{ .s.CanonicalHost }}/r/&lt;relay-host&gt;</span
>, for example:
<a href="/r/nostr.wine"
>https://{{ .s.CanonicalHost }}/r/nostr.wine</a
>
</p>
<p>

View File

@@ -40,7 +40,7 @@
<link
rel="canonical"
href="https://{{.CanonicalHost}}/{{.nevent | escapeString }}"
href="https://{{.s.CanonicalHost}}/{{.nevent | escapeString }}"
/>
{{template "head_common.html"}}

View File

@@ -2,8 +2,14 @@
<html class="theme--default">
<meta charset="UTF-8" />
<head>
<title>{{.metadata.Name | escapeString}} / {{.metadata.DisplayName | escapeString}} is on nostr</title>
<meta name="description" content="{{.npub | escapeString}} is {{.metadata.Name | escapeString}} / {{.metadata.DisplayName | escapeString}} public key on nostr" >
<title>
{{.metadata.Name | escapeString}} / {{.metadata.DisplayName |
escapeString}} is on nostr
</title>
<meta
name="description"
content="{{.npub | escapeString}} is {{.metadata.Name | escapeString}} / {{.metadata.DisplayName | escapeString}} public key on nostr"
/>
<meta property="og:title" content="{{.title | escapeString}}" />
<meta property="og:site_name" content="{{.npub | escapeString}}" />
{{ if .metadata.Picture }}
@@ -20,7 +26,10 @@
{{end}}
<meta property="twitter:card" content="summary" />
<link rel="canonical" href="https://{{.CanonicalHost}}/{{.npub | escapeString }}" />
<link
rel="canonical"
href="https://{{.s.CanonicalHost}}/{{.npub | escapeString }}"
/>
<link
rel="sitemap"
type="application/xml"
@@ -39,8 +48,8 @@
<header class="column columnA">
<div class="info-wrapper">
<div class="name">
{{.metadata.Name | escapeString}}
{{if not (eq .metadata.Name .metadata.DisplayName)}}
{{.metadata.Name | escapeString}} {{if not (eq .metadata.Name
.metadata.DisplayName)}}
<span class="display"
>{{.metadata.DisplayName | escapeString}}</span
>
@@ -59,8 +68,8 @@
<div class="column column_content">
<header class="field info-wrapper">
<h1 id="profile_name" class="name">
{{.metadata.Name | escapeString}}
{{if not (eq .metadata.Name .metadata.DisplayName)}}
{{.metadata.Name | escapeString}} {{if not (eq .metadata.Name
.metadata.DisplayName)}}
<span class="display"
>{{.metadata.DisplayName | escapeString}}</span
>
@@ -130,7 +139,9 @@
<div class="is_reply">- reply</div>
{{end}}
</div>
<div class="content">{{.Content | escapeString | previewNotesFormatting}}</div>
<div class="content">
{{.Content | escapeString | previewNotesFormatting}}
</div>
</a>
{{end}}
</nav>

View File

@@ -1,5 +1,5 @@
User-agent: *
Allow: /
Sitemap: https://{{.CanonicalHost}}/npubs-archive.xml
Sitemap: https://{{.CanonicalHost}}/relays-archive.xml
Sitemap: https://{{.s.CanonicalHost}}/npubs-archive.xml
Sitemap: https://{{.s.CanonicalHost}}/relays-archive.xml

View File

@@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{if .npub}}
<url>
<loc>https://{{.CanonicalHost}}/{{.npub | escapeString}}</loc>
<loc>https://{{.s.CanonicalHost}}/{{.npub | escapeString}}</loc>
<lastmod>{{.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
@@ -10,7 +10,7 @@
{{end}}
{{if .hostname}}
<url>
<loc>https://{{.CanonicalHost}}/r/{{.hostname | escapeString}}</loc>
<loc>https://{{.s.CanonicalHost}}/r/{{.hostname | escapeString}}</loc>
<lastmod>{{.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
@@ -19,7 +19,7 @@
{{if .lastNotes}}
{{range .lastNotes}}
<url>
<loc>https://{{$.CanonicalHost}}/{{.Nevent | escapeString}}</loc>
<loc>https://{{.s.CanonicalHost}}/{{.Nevent | escapeString}}</loc>
<lastmod>{{.ModifiedAt | escapeString}}</lastmod>
<changefreq>never</changefreq>
<priority>0.5</priority>
@@ -29,7 +29,7 @@
{{if .data}}
{{range $element := .data }}
<url>
<loc>https://{{$.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}}</loc>
<loc>https://{{.s.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}}</loc>
<lastmod>{{$.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>