aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Database.go4
-rw-r--r--Follow.go8
-rw-r--r--OutboxPost.go4
-rw-r--r--client.go2
-rw-r--r--main.go4
-rw-r--r--outboxGet.go8
-rw-r--r--static/js/footerscript.js6
-rw-r--r--static/posts.html4
8 files changed, 25 insertions, 15 deletions
diff --git a/Database.go b/Database.go
index aac87c7..4f29026 100644
--- a/Database.go
+++ b/Database.go
@@ -389,13 +389,13 @@ func GetActivityFromDB(db *sql.DB, id string) Collection {
return nColl
}
-func GetObjectFromDB(db *sql.DB, actor Actor) Collection {
+func GetObjectFromDB(db *sql.DB, id string) Collection {
var nColl Collection
var result []ObjectBase
query := `select id, name, content, type, published, updated, attributedto, attachment, preview, actor from activitystream where actor=$1 and id in (select id from replies where inreplyto='') and type='Note' order by updated asc`
- rows, err := db.Query(query, actor.Id)
+ rows, err := db.Query(query, id)
CheckError(err, "error query object from db")
diff --git a/Follow.go b/Follow.go
index 5fa1a15..f672449 100644
--- a/Follow.go
+++ b/Follow.go
@@ -199,11 +199,15 @@ func SetActorFollowingDB(db *sql.DB, activity Activity) Activity {
if alreadyFollow {
query = `delete from following where id=$1 and following=$2`
activity.Summary = activity.Object.Actor.Id + " Unfollowing " + activity.Actor.Id
- go DeleteActorCache(db, activity.Actor.Id)
+ if !IsActorLocal(db, activity.Actor.Id) {
+ go DeleteActorCache(db, activity.Actor.Id)
+ }
} else {
query = `insert into following (id, following) values ($1, $2)`
activity.Summary = activity.Object.Actor.Id + " Following " + activity.Actor.Id
- go WriteActorToCache(db, activity.Actor.Id)
+ if !IsActorLocal(db, activity.Actor.Id) {
+ go WriteActorToCache(db, activity.Actor.Id)
+ }
}
_, err := db.Exec(query, activity.Object.Actor.Id, activity.Actor.Id)
diff --git a/OutboxPost.go b/OutboxPost.go
index 99f18d9..9b10ab7 100644
--- a/OutboxPost.go
+++ b/OutboxPost.go
@@ -507,7 +507,9 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) {
case "Create":
for _, e := range activity.To {
if IsActorLocal(db, e) {
- WriteObjectToCache(db, *activity.Object)
+ if !IsActorLocal(db, activity.Actor.Id) {
+ WriteObjectToCache(db, *activity.Object)
+ }
}
}
diff --git a/client.go b/client.go
index d84561e..beddcad 100644
--- a/client.go
+++ b/client.go
@@ -90,7 +90,7 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) {
var data PageData
data.Title = "Welcome to " + actor.PreferredUsername
- data.Message = fmt.Sprintf("This is the client for the image board %s. The current version of the code running the server and client is volatile, expect a bumpy ride for the time being. Get the server and client code here https://github.com/FChannel0", Domain)
+ data.Message = fmt.Sprintf("%s 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 here https://github.com/FChannel0", Domain)
data.Boards = boardCollection
data.Board.Name = ""
data.Key = *Key
diff --git a/main.go b/main.go
index 40428d2..b49d6d8 100644
--- a/main.go
+++ b/main.go
@@ -649,7 +649,7 @@ func main() {
http.SetCookie(w, &http.Cookie{
Name: "session_token",
Value: sessionToken.String(),
- Expires: time.Now().Add(60 * 60 * 24 * 7 * time.Second),
+ Expires: time.Now().Add(60 * 60 * 48 * time.Second),
})
http.Redirect(w, r, "/", http.StatusSeeOther)
@@ -1293,7 +1293,7 @@ func GetActorCollectionCache(db *sql.DB, actor Actor) Collection {
func GetActorCollectionDB(db *sql.DB, actor Actor) Collection {
var collection Collection
- collection.OrderedItems = GetObjectFromDB(db, actor).OrderedItems
+ collection.OrderedItems = GetObjectFromDB(db, actor.Id).OrderedItems
collection.Actor = &actor
diff --git a/outboxGet.go b/outboxGet.go
index 42fafd0..073a4bb 100644
--- a/outboxGet.go
+++ b/outboxGet.go
@@ -9,7 +9,7 @@ func GetActorOutbox(w http.ResponseWriter, r *http.Request, db *sql.DB) {
actor := GetActorFromPath(db, r.URL.Path, "/")
var collection Collection
- collection.OrderedItems = GetObjectFromDB(db, actor).OrderedItems
+ collection.OrderedItems = GetObjectFromDB(db, actor.Id).OrderedItems
collection.AtContext.Context = "https://www.w3.org/ns/activitystreams"
collection.Actor = &actor
@@ -28,7 +28,11 @@ func GetObjectsFromFollow(db *sql.DB, actor Actor) []ObjectBase {
followingCol = GetActorCollection(actor.Following)
for _, e := range followingCol.Items {
var followOutbox Collection
- followOutbox = GetObjectFromCache(db, e.Id)
+ if !IsActorLocal(db, e.Id) {
+ followOutbox = GetObjectFromCache(db, e.Id)
+ } else {
+ followOutbox = GetObjectFromDB(db, e.Id)
+ }
for _, e := range followOutbox.OrderedItems {
followObj = append(followObj, e)
}
diff --git a/static/js/footerscript.js b/static/js/footerscript.js
index bd36daa..b68c3b4 100644
--- a/static/js/footerscript.js
+++ b/static/js/footerscript.js
@@ -7,7 +7,7 @@ imgArray.forEach(function(img, i){
{
var attachment = img.getAttribute("attachment")
img.setAttribute("enlarge", "1");
- img.setAttribute("style", "float: left; margin-right: 10px; cursor: move;");
+ img.setAttribute("style", "float: left; margin-right: 10px; cursor: pointer;");
img.src = attachment
}
else
@@ -16,12 +16,12 @@ imgArray.forEach(function(img, i){
img.setAttribute("enlarge", "0");
if(img.getAttribute("main") == 1)
{
- img.setAttribute("style", "float: left; margin-right: 10px; max-width: 250px; max-height: 250px; cursor: move;");
+ img.setAttribute("style", "float: left; margin-right: 10px; max-width: 250px; max-height: 250px; cursor: pointer;");
img.src = preview
}
else
{
- img.setAttribute("style", "float: left; margin-right: 10px; max-width: 125px; max-height: 125px; cursor: move;");
+ img.setAttribute("style", "float: left; margin-right: 10px; max-width: 125px; max-height: 125px; cursor: pointer;");
img.src = preview
}
}
diff --git a/static/posts.html b/static/posts.html
index ab15aeb..9e3e8ce 100644
--- a/static/posts.html
+++ b/static/posts.html
@@ -21,7 +21,7 @@
media = document.getElementById("media-{{ .Id }}")
if(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");
- img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: move;"
+ img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: pointer;"
img.setAttribute("id", "img")
img.setAttribute("main", "1")
img.setAttribute("enlarge", "0")
@@ -85,7 +85,7 @@
media = document.getElementById("media-{{ .Id }}")
if(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");
- img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: move;"
+ img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: pointer;"
img.setAttribute("id", "img")
img.setAttribute("main", "1")
img.setAttribute("enlarge", "0")