From 02d55188670a599048486c36e896416d917e831c Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 3 Jul 2021 19:18:29 -0700 Subject: fixed error with CreatePublicKeyFromPrivate with empty actor --- database.go | 5 ++--- static/index.html | 4 +++- verification.go | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/database.go b/database.go index edab4f6..954ec0f 100644 --- a/database.go +++ b/database.go @@ -31,7 +31,7 @@ func GetActorFromDB(db *sql.DB, id string) Actor { } nActor.PublicKey = GetActorPemFromDB(db, publicKeyPem) - if nActor.PublicKey.PublicKeyPem == ""{ + if nActor.Id != "" && nActor.PublicKey.PublicKeyPem == ""{ err = CreatePublicKeyFromPrivate(db, &nActor, publicKeyPem) CheckError(err, "error creating public key from private") } @@ -57,8 +57,7 @@ func GetActorByNameFromDB(db *sql.DB, name string) Actor { CheckError(err, "error with actor from db scan ") } - nActor.PublicKey = GetActorPemFromDB(db, publicKeyPem) - if nActor.PublicKey.PublicKeyPem == ""{ + if nActor.Id != "" && nActor.PublicKey.PublicKeyPem == ""{ err = CreatePublicKeyFromPrivate(db, &nActor, publicKeyPem) CheckError(err, "error creating public key from private") } diff --git a/static/index.html b/static/index.html index 520829e..bd90059 100644 --- a/static/index.html +++ b/static/index.html @@ -21,7 +21,8 @@

{{ .Title }}

{{ .PreferredUsername }} is a federated image board based on activitypub. The current version of the code running the server is still a work in progress, expect a bumpy ride for the time being. Get the server code at https://github.com/FChannel0.

- + + {{ if .Boards }}
Local boards
@@ -33,6 +34,7 @@ {{ end }}
+ {{ end }} {{ if .NewsItems }}