From 886059ae5ad18a5af49701791b3b01484610641e Mon Sep 17 00:00:00 2001 From: Marius Orcsik Date: Sat, 23 Mar 2024 20:15:01 +0100 Subject: [PATCH] Set object names when creating them --- cmd/main.go | 2 +- spammer.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 3e039a9..27bc0b8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -26,7 +26,7 @@ func main() { secret = fs.String("secret", "", "The application secret") serv = fs.String("url", spammy.ServiceIRI.String(), "The FedBOX url to connect to") cc = fs.String("cc", "", "CC all the activities that we generate to these IRIs") - actorCount = fs.Int("clients", DefaultActorCount, "How many actors to create") + actorCount = fs.Int("actors", DefaultActorCount, "How many actors to create") ) ff.Parse(fs, os.Args[1:]) diff --git a/spammer.go b/spammer.go index c660794..b512a62 100644 --- a/spammer.go +++ b/spammer.go @@ -218,13 +218,14 @@ func RandomObject(parent ap.Item) ap.Item { buf := make([]byte, base64.RawStdEncoding.EncodedLen(len(data))) base64.RawStdEncoding.Encode(buf, data) data = buf + ob.Name = ap.NaturalLanguageValues{ + {ap.NilLangRef, []byte(fmt.Sprintf("random %s", mime))}, + } } else { + ob.Name = getNameFromData(data, 5) ob.Summary = ap.NaturalLanguageValues{ {ap.NilLangRef, data[:bytes.Index(data, []byte{'.'})]}, } - if rr := rand.Int31n(4); rr > 1 { - ob.Name = getNameFromData(data, int(rr)) - } } ob.Content = ap.NaturalLanguageValues{ {ap.NilLangRef, data}, -- 2.45.2