[feature] Add instance-stats-randomize config option (#3718)

* [feature] Add `instance-stats-randomize` config option

* don't use cache (overkill)
This commit is contained in:
tobi
2025-01-31 19:27:18 +01:00
committed by GitHub
parent c47b9bd1d1
commit a55bd6d2bd
13 changed files with 183 additions and 10 deletions

View File

@@ -17,7 +17,10 @@
package model
import "mime/multipart"
import (
"mime/multipart"
"time"
)
// InstanceSettingsUpdateRequest models an instance update request.
//
@@ -148,3 +151,11 @@ type InstanceConfigurationEmojis struct {
// example: 51200
EmojiSizeLimit int `json:"emoji_size_limit"`
}
// swagger:ignore
type RandomStats struct {
Statuses int64
TotalUsers int64
MonthlyActiveUsers int64
Generated time.Time
}

View File

@@ -110,6 +110,13 @@ type InstanceV1 struct {
Terms string `json:"terms,omitempty"`
// Raw (unparsed) version of terms.
TermsRaw string `json:"terms_text,omitempty"`
// Random stats generated for the instance.
// Only used if `instance-stats-randomize` is true.
// Not serialized to the frontend.
//
// swagger:ignore
RandomStats `json:"-"`
}
// InstanceV1URLs models instance-relevant URLs for client application consumption.

View File

@@ -74,6 +74,13 @@ type InstanceV2 struct {
Terms string `json:"terms,omitempty"`
// Raw (unparsed) version of terms.
TermsText string `json:"terms_text,omitempty"`
// Random stats generated for the instance.
// Only used if `instance-stats-randomize` is true.
// Not serialized to the frontend.
//
// swagger:ignore
RandomStats `json:"-"`
}
// Usage data for this instance.