Merge branch 'tagactors' into 'master'

Added in a staggered start of new instances

See merge request khanzf/fedilogue!16
This commit is contained in:
Fikrān Mutasā'il 2021-12-16 23:22:39 +00:00
commit 858a6e856e
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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 (