Tagging bots in actors table
This commit is contained in:
parent
f5b9285e44
commit
056e89beed
@ -241,7 +241,19 @@ func check_actor(uri string) int {
|
|||||||
return 406 // Unable to unmarshal body of message
|
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 {
|
if err != nil {
|
||||||
logWarn("Error inserting %s into `actors`: "+uri, err)
|
logWarn("Error inserting %s into `actors`: "+uri, err)
|
||||||
return 407 // Unable to insert actor
|
return 407 // Unable to insert actor
|
||||||
|
@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS actors (
|
|||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
document JSONB,
|
document JSONB,
|
||||||
identifiedat TIMESTAMP with time zone DEFAULT now(),
|
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 (
|
CREATE TABLE IF NOT EXISTS activities (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user