diff --git a/fedilogue/retrieve.go b/fedilogue/retrieve.go index 04f9220..21905d4 100644 --- a/fedilogue/retrieve.go +++ b/fedilogue/retrieve.go @@ -241,7 +241,19 @@ func check_actor(uri string) int { return 406 // Unable to unmarshal body of message } - _, err = pool.Exec(context.Background(), "INSERT INTO actors (document, instance) VALUES($1, $2)", jsondocument, actorjson.instance) + var bot bool + if actorjson.Type == "Service" { + bot = true + } else { + bot = false + for _, botinstance := range settings.Alwaysbot { + if strings.Index(uri, "https://"+botinstance+"/") == 0 { + bot = true + } + } + } + + _, err = pool.Exec(context.Background(), "INSERT INTO actors (document, instance, bot) VALUES($1, $2, $3)", jsondocument, actorjson.instance, bot) if err != nil { logWarn("Error inserting %s into `actors`: "+uri, err) return 407 // Unable to insert actor diff --git a/fedilogue/tables.sql b/fedilogue/tables.sql index 9fae4f8..2399ad5 100644 --- a/fedilogue/tables.sql +++ b/fedilogue/tables.sql @@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS actors ( id SERIAL PRIMARY KEY, document JSONB, identifiedat TIMESTAMP with time zone DEFAULT now(), - instance VARCHAR(1000) NOT NULL + instance VARCHAR(1000) NOT NULL, + bot BOOL DEFAULT FALSE ); CREATE TABLE IF NOT EXISTS activities (