diff --git a/CHANGELOG.md b/CHANGELOG.md index 5986bbc9..3f8d314d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# 4.30.0 + +* Adds the `active_generations` privileged key on user info providing a list of all non-expired gens the user has active. + # 4.39.1 * Added news about transparent images diff --git a/horde/apis/models/v2.py b/horde/apis/models/v2.py index 099f84ff..e1127241 100644 --- a/horde/apis/models/v2.py +++ b/horde/apis/models/v2.py @@ -876,6 +876,30 @@ def __init__(self, api): }, ) + self.response_model_user_active_generations = api.model( + "UserActiveGenerations", + { + "text": fields.List( + fields.String( + description="(Privileged) The list of active text generation IDs requested by this user.", + example="00000000-0000-0000-0000-000000000000", + ), + ), + "image": fields.List( + fields.String( + description="(Privileged) The list of active image generation IDs requested by this user.", + example="00000000-0000-0000-0000-000000000000", + ), + ), + "alchemy": fields.List( + fields.String( + description="(Privileged) The list of active alchemy generation IDs requested by this user.", + example="00000000-0000-0000-0000-000000000000", + ), + ), + }, + ) + self.response_model_user_details = api.model( "UserDetails", { @@ -919,6 +943,7 @@ def __init__(self, api): example="00000000-0000-0000-0000-000000000000", ), ), + "active_generations": fields.Nested(self.response_model_user_active_generations, skip_none=True), "monthly_kudos": fields.Nested(self.response_model_monthly_kudos, skip_none=True), "trusted": fields.Boolean( example=False, diff --git a/horde/classes/base/user.py b/horde/classes/base/user.py index a11a8172..37777e9b 100644 --- a/horde/classes/base/user.py +++ b/horde/classes/base/user.py @@ -861,6 +861,11 @@ def get_details(self, details_privilege=0): for worker in self.workers: workers_array.append(str(worker.id)) ret_dict["worker_ids"] = workers_array + ret_dict["active_generations"] = {} + for wp in self.waiting_prompts: + if wp.wp_type not in ret_dict["active_generations"]: + ret_dict["active_generations"][wp.wp_type] = [] + ret_dict["active_generations"][wp.wp_type].append(str(wp.id)) if details_privilege >= 1: sharedkeys_array = [] for sk in self.sharedkeys: diff --git a/horde/consts.py b/horde/consts.py index a0f72d59..d9dde387 100644 --- a/horde/consts.py +++ b/horde/consts.py @@ -1,4 +1,4 @@ -HORDE_VERSION = "4.39.1" +HORDE_VERSION = "4.40.0" WHITELISTED_SERVICE_IPS = { "212.227.227.178", # Turing Bot