diff --git a/CHANGELOG.md b/CHANGELOG.md index ec545590..1dd18d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later # Changelog +# 4.44.2 + +* Allow trusted users to also create styles +* Fix styles always returning 1 image + # 4.44.1 * Various fixes around styles diff --git a/horde/apis/v2/kobold.py b/horde/apis/v2/kobold.py index c3081314..7f87dd96 100644 --- a/horde/apis/v2/kobold.py +++ b/horde/apis/v2/kobold.py @@ -204,7 +204,9 @@ def apply_style(self): # We need to use defaultdict to avoid getting keyerrors in case the style author added # Erroneous keys in the string self.prompt = self.existing_style.prompt.format_map(defaultdict(str, p=self.args.prompt)) + requested_n = self.params.get("n", 1) self.params = self.existing_style.params + self.params["n"] = requested_n self.nsfw = self.existing_style.nsfw self.existing_style.use_count += 1 self.existing_style.user.record_style(2, "text") @@ -541,9 +543,9 @@ def post(self): self.user = database.find_user_by_api_key(self.args["apikey"]) if not self.user: raise e.InvalidAPIKey("TextStyle POST") - if not self.user.customizer: + if not self.user.customizer and not self.user.trusted: raise e.Forbidden( - "Only customizers can create new styles. You can request this role in our channels.", + "Only customizers and trusted users can create new styles. You can request the customizer role in our channels.", rc="StylesRequiresCustomizer", ) if self.user.is_anon(): diff --git a/horde/apis/v2/stable.py b/horde/apis/v2/stable.py index 6796fcac..c0679c6f 100644 --- a/horde/apis/v2/stable.py +++ b/horde/apis/v2/stable.py @@ -383,7 +383,9 @@ def apply_style(self): # We need to use defaultdict to avoid getting keyerrors in case the style author added # Erroneous keys in the string self.prompt = self.existing_style.prompt.format_map(defaultdict(str, p=self.args.prompt, np=self.negprompt)) + requested_n = self.params.get("n", 1) self.params = self.existing_style.params + self.params["n"] = requested_n self.nsfw = self.existing_style.nsfw self.existing_style.use_count += 1 self.existing_style.user.record_style(2, "image") @@ -1417,9 +1419,9 @@ def post(self): self.user = database.find_user_by_api_key(self.args["apikey"]) if not self.user: raise e.InvalidAPIKey("ImageStyle POST") - if not self.user.customizer: + if not self.user.customizer and not self.user.trusted: raise e.Forbidden( - "Only customizers can create new styles. You can request this role in our channels.", + "Only customizers and trusted users can create new styles. You can request the customizer role in our channels.", rc="StylesRequiresCustomizer", ) if self.user.is_anon(): diff --git a/horde/consts.py b/horde/consts.py index fe54318b..939c8de5 100644 --- a/horde/consts.py +++ b/horde/consts.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: AGPL-3.0-or-later -HORDE_VERSION = "4.44.1" +HORDE_VERSION = "4.44.2" HORDE_API_VERSION = "2.5" WHITELISTED_SERVICE_IPS = {