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, "lastNotes": data.renderableLastNotes,
"parentNevent": data.parentNevent, "parentNevent": data.parentNevent,
"authorRelays": data.authorRelays, "authorRelays": data.authorRelays,
"CanonicalHost": s.CanonicalHost, "s": s,
} }
// if a mapping is not found fallback to raw // 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, "paginationUrl": area,
"nextPage": fmt.Sprint(nextPage), "nextPage": fmt.Sprint(nextPage),
"prevPage": fmt.Sprint(prevPage), "prevPage": fmt.Sprint(prevPage),
"CanonicalHost": s.CanonicalHost, "s": s,
} }
if len(data) != 0 { if len(data) != 0 {

View File

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

View File

@@ -68,13 +68,13 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
"clients": []ClientReference{ "clients": []ClientReference{
{Name: "Coracle", URL: "https://coracle.social/relays/" + hostname}, {Name: "Coracle", URL: "https://coracle.social/relays/" + hostname},
}, },
"type": "relay", "type": "relay",
"info": info, "info": info,
"hostname": hostname, "hostname": hostname,
"proxy": "https://" + hostname + "/njump/proxy?src=", "proxy": "https://" + hostname + "/njump/proxy?src=",
"lastNotes": renderableLastNotes, "lastNotes": renderableLastNotes,
"modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"), "modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"),
"CanonicalHost": s.CanonicalHost, "s": s,
} }
if len(renderableLastNotes) != 0 { 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") w.Header().Set("Cache-Control", "max-age=3600")
params := map[string]any{ params := map[string]any{
"CanonicalHost": s.CanonicalHost, "s": s,
} }
if err := tmpl.ExecuteTemplate(w, templateMapping[typ], params); err != nil { if err := tmpl.ExecuteTemplate(w, templateMapping[typ], params); err != nil {

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
User-agent: * User-agent: *
Allow: / Allow: /
Sitemap: https://{{.CanonicalHost}}/npubs-archive.xml Sitemap: https://{{.s.CanonicalHost}}/npubs-archive.xml
Sitemap: https://{{.CanonicalHost}}/relays-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"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{if .npub}} {{if .npub}}
<url> <url>
<loc>https://{{.CanonicalHost}}/{{.npub | escapeString}}</loc> <loc>https://{{.s.CanonicalHost}}/{{.npub | escapeString}}</loc>
<lastmod>{{.modifiedAt | escapeString}}</lastmod> <lastmod>{{.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
@@ -10,7 +10,7 @@
{{end}} {{end}}
{{if .hostname}} {{if .hostname}}
<url> <url>
<loc>https://{{.CanonicalHost}}/r/{{.hostname | escapeString}}</loc> <loc>https://{{.s.CanonicalHost}}/r/{{.hostname | escapeString}}</loc>
<lastmod>{{.modifiedAt | escapeString}}</lastmod> <lastmod>{{.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
@@ -19,7 +19,7 @@
{{if .lastNotes}} {{if .lastNotes}}
{{range .lastNotes}} {{range .lastNotes}}
<url> <url>
<loc>https://{{$.CanonicalHost}}/{{.Nevent | escapeString}}</loc> <loc>https://{{.s.CanonicalHost}}/{{.Nevent | escapeString}}</loc>
<lastmod>{{.ModifiedAt | escapeString}}</lastmod> <lastmod>{{.ModifiedAt | escapeString}}</lastmod>
<changefreq>never</changefreq> <changefreq>never</changefreq>
<priority>0.5</priority> <priority>0.5</priority>
@@ -29,7 +29,7 @@
{{if .data}} {{if .data}}
{{range $element := .data }} {{range $element := .data }}
<url> <url>
<loc>https://{{$.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}}</loc> <loc>https://{{.s.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}}</loc>
<lastmod>{{$.modifiedAt | escapeString}}</lastmod> <lastmod>{{$.modifiedAt | escapeString}}</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
<priority>0.5</priority> <priority>0.5</priority>