aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-06-17 00:21:07 -0700
committerFChannel <>2021-06-17 00:21:07 -0700
commitcc24155859b65653495747bd0b38be9bcef33298 (patch)
treec46e5b7273534e9626d746855b3b036ee06c1006
parentbf23a5c30ace0525e2ad67a979916af5ebab3001 (diff)
added html meta data as well as basic hover effect on links
-rw-r--r--client.go13
-rw-r--r--static/index.html15
-rw-r--r--static/js/posts.js39
-rw-r--r--static/main.html7
-rw-r--r--static/ncatalog.html12
-rw-r--r--static/npost.html17
-rw-r--r--static/nposts.html11
-rw-r--r--static/posts.html11
-rw-r--r--static/sensative.pngbin0 -> 3737 bytes
9 files changed, 115 insertions, 10 deletions
diff --git a/client.go b/client.go
index e9ecd80..1c3ae93 100644
--- a/client.go
+++ b/client.go
@@ -47,6 +47,8 @@ type PageData struct {
Boards []Board
Posts []ObjectBase
Key string
+ PostId string
+ Instance Actor
}
type AdminPage struct {
@@ -158,8 +160,10 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
returnData.Board.Restricted = actor.Restricted
returnData.Key = *Key
- returnData.Board.Post.Actor = actor
+ returnData.Board.Post.Actor = actor
+ returnData.Instance = GetActorFromDB(db, Domain)
+
returnData.Board.Captcha = Domain + "/" + GetRandomCaptcha(db)
returnData.Board.CaptchaCode = GetCaptchaCode(returnData.Board.Captcha)
@@ -196,6 +200,8 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
returnData.Board.Captcha = Domain + "/" + GetRandomCaptcha(db)
returnData.Board.CaptchaCode = GetCaptchaCode(returnData.Board.Captcha)
+ returnData.Instance = GetActorFromDB(db, Domain)
+
returnData.Title = "/" + returnData.Board.Name + "/ - " + returnData.Board.PrefName
returnData.Key = *Key
@@ -212,7 +218,6 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
if len(followCollection.OrderedItems) > 0 {
returnData.Board.InReplyTo = followCollection.OrderedItems[0].Id
returnData.Posts = append(returnData.Posts, followCollection.OrderedItems[0])
-
var actor Actor
actor = FingerActor(returnData.Board.InReplyTo)
returnData.Board.Post.Actor = &actor
@@ -228,6 +233,10 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
}
}
+ if len(returnData.Posts) > 0 {
+ returnData.PostId = shortURL(returnData.Board.To, returnData.Posts[0].Id)
+ }
+
t.ExecuteTemplate(w, "layout", returnData)
}
diff --git a/static/index.html b/static/index.html
index 2840a83..1cd206b 100644
--- a/static/index.html
+++ b/static/index.html
@@ -1,4 +1,19 @@
{{ define "header" }}
+<title>{{ .Title }}</title>
+<meta name="description" content="{{ .Message }}">
+
+<meta property="og:locale" content="en_US" />
+<meta property="og:type" content="website" />
+<meta property="og:url" content="{{ .Board.Domain }}">
+<meta property="og:site_name" content="{{ .Board.Actor.PreferredUsername }}" />
+
+<meta property="og:title" content="{{ .Title }}">
+<meta property="og:description" content="{{ .Message }}">
+
+<meta name="twitter:title" content="{{ .Title }}">
+<meta name="twitter:description" content="{{ .Message }}">
+<meta name="twitter:card" content="summary_large_image">
+
{{ end }}
{{ define "top" }}{{ end }}
diff --git a/static/js/posts.js b/static/js/posts.js
index 077b654..5be272a 100644
--- a/static/js/posts.js
+++ b/static/js/posts.js
@@ -124,8 +124,14 @@ function convertContent(actorName, content, opid)
{
isOP = " (OP)";
}
-
- newContent = newContent.replace(quote, '<a class="reply" title="' + link + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>');
+
+ var q = link
+
+ if(document.getElementById(link + "-content") != null) {
+ q = document.getElementById(link + "-content").innerText;
+ }
+
+ newContent = newContent.replace(quote, '<a class="reply" title="' + q + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>');
})
}
@@ -143,6 +149,35 @@ function convertContent(actorName, content, opid)
return newContent
}
+function convertContentNoLink(actorName, content, opid)
+{
+ var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm;
+ var match = content.match(re);
+ var newContent = content;
+ if(match)
+ {
+ match.forEach(function(quote, i){
+ var link = quote.replace('>>', '')
+ var isOP = ""
+ if(link == opid)
+ {
+ isOP = " (OP)";
+ }
+
+ var q = link
+
+ if(document.getElementById(link + "-content") != null) {
+ q = document.getElementById(link + "-content").innerText;
+ }
+
+ newContent = newContent.replace(quote, '>>>' + shortURL(actorName, link) + isOP);
+
+ })
+ }
+
+ return newContent
+}
+
function closeReply()
{
document.getElementById("reply-box").style.display = "none";
diff --git a/static/main.html b/static/main.html
index 1cd2aff..172f90b 100644
--- a/static/main.html
+++ b/static/main.html
@@ -1,10 +1,13 @@
{{ define "layout" }}
<!DOCTYPE html>
<html>
- <meta name="viewport" content="width=device-width, initial-scale=1">
<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="keywords" content="Federated Imageboard based on Activtypub">
+ <meta property="og:locale" content="en_US" />
+ <meta property="og:type" content="website" />
<link rel="icon" type="image/png" href="/static/favicon.png">
- <title>{{ .Title }}</title>
<style>
a, a:link, a:visited, a:hover, a:active {
text-decoration: none
diff --git a/static/ncatalog.html b/static/ncatalog.html
index 43fd6fd..027a938 100644
--- a/static/ncatalog.html
+++ b/static/ncatalog.html
@@ -1,4 +1,16 @@
{{ define "header" }}
+<title>/{{ .Board.Name }}/ - catalog</title>
+<meta name="description" content="{{ .Board.Summary }}">
+<meta property="og:url" content="{{ .Board.Actor.Id }}">
+<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" />
+
+<meta property="og:title" content="{{ .Title }}">
+<meta property="og:description" content="{{ .Board.Summary }}">
+
+<meta name="twitter:title" content="{{ .Title }}">
+<meta name="twitter:description" content="{{ .Board.Summary }}">
+<meta name="twitter:card" content="summary_large_image">
+
<script src="/static/js/posts.js"></script>
{{ end }}
diff --git a/static/npost.html b/static/npost.html
index b91b795..740018b 100644
--- a/static/npost.html
+++ b/static/npost.html
@@ -1,4 +1,21 @@
{{ define "header" }}
+<title>/{{ .Board.Name }}/ - {{ .PostId }}</title>
+<meta name="description" content="{{ (index .Posts 0).Content }}">
+<meta property="og:url" content="{{ (index .Posts 0).Id }}">
+<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" />
+
+<meta property="og:title" content="{{ (index .Posts 0).Name }}">
+<meta property="og:description" content="{{ (index .Posts 0).Content }}">
+
+<meta name="twitter:title" content="{{ (index .Posts 0).Name }}">
+<meta name="twitter:description" content="{{ (index .Posts 0).Content }}">
+<meta name="twitter:card" content="summary_large_image">
+
+{{ if (index .Posts 0).Preview }}
+<meta property="og:image" content="{{ (index .Posts 0).Preview.Href }}" />
+<meta name="twitter:image" content="{{ (index .Posts 0).Preview.Href }}" />
+{{ end }}
+
<script src="/static/js/posts.js"></script>
{{ end }}
diff --git a/static/nposts.html b/static/nposts.html
index 173f175..d106f74 100644
--- a/static/nposts.html
+++ b/static/nposts.html
@@ -1,4 +1,15 @@
{{ define "header" }}
+<title>{{ .Title }}</title>
+<meta name="description" content="{{ .Board.Summary }}">
+<meta property="og:url" content="{{ .Board.Actor.Id }}">
+<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" />
+
+<meta property="og:title" content="{{ .Title }}">
+<meta property="og:description" content="{{ .Board.Summary }}">
+
+<meta name="twitter:title" content="{{ .Title }}">
+<meta name="twitter:description" content="{{ .Board.Summary }}">
+<meta name="twitter:card" content="summary_large_image">
<script src="/static/js/posts.js"></script>
{{ end }}
diff --git a/static/posts.html b/static/posts.html
index ee71faf..bfcc84b 100644
--- a/static/posts.html
+++ b/static/posts.html
@@ -131,10 +131,13 @@
{{ if .Replies.OrderedItems }}
{{ range .Replies.OrderedItems }}
<span id="{{$parentId}}-replyto-{{.Id}}"></span>
- <script>document.getElementById("{{ $parentId }}-replyto-{{.Id}}").innerHTML = "<a title='{{ .Id }}' href='/{{ $board.Name }}/" + shortURL("{{ $board.Actor.Id }}", "{{ $opId }}") + "#" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "'>>>" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "</a>";</script>
- {{ end }}
- {{ end }}
- <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{.Content}}</p>
+ <script>
+ var content = convertContentNoLink('{{$board.Actor.Id}}', '{{ .Content }}', '{{ $opId }}')
+ document.getElementById("{{ $parentId }}-replyto-{{.Id}}").innerHTML = "<a title='" + content +"' href='/{{ $board.Name }}/" + shortURL("{{ $board.Actor.Id }}", "{{ $opId }}") + "#" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "'>>>" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "</a>";
+ </script>
+ {{ end }}
+ {{ end }}
+ <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{.Content}}</p>
</div>
</div>
</div>
diff --git a/static/sensative.png b/static/sensative.png
new file mode 100644
index 0000000..ea706c8
--- /dev/null
+++ b/static/sensative.png
Binary files differ