Update to v3.4.3

pull/245/head v3.4.3
BlafKing 2024-03-13 22:27:55 +01:00
parent c947679fa4
commit fbdbc336d5
No known key found for this signature in database
GPG Key ID: BFD6B0BCA6280F8B
4 changed files with 20 additions and 17 deletions

View File

@ -100,6 +100,12 @@ https://github.com/BlafKing/sd-civitai-browser-plus/assets/9644716/44c5c7a0-4854
# Changelog 📋
<h3>v3.4.3</h3>
* Bug fix: Hotfix for a change in the public API which broke searching.
* Bug fix: Fixed incorrect permission display on model page.
---
<h3>v3.4.2</h3>
* Feature: Ability to set-up a custom proxy for API requests and downloads.

View File

@ -11,8 +11,8 @@ import platform
from PIL import Image
from io import BytesIO
from collections import defaultdict
from datetime import datetime, timezone
from modules.images import read_info_from_image
from modules.shared import cmd_opts, opts
from modules.paths import models_path, extensions_dir, data_path
from html import escape
@ -218,30 +218,29 @@ def model_list_html(json_data):
hide_early_access = getattr(opts, "hide_early_access", True)
filtered_items = []
current_time = datetime.datetime.utcnow()
current_time = datetime.now(timezone.utc)
for item in json_data['items']:
versions_to_keep = []
for version in item['modelVersions']:
if not version['files']:
continue
if hide_early_access:
early_access_days = version['earlyAccessTimeFrame']
if early_access_days != 0:
published_at_str = version.get('publishedAt')
if published_at_str is not None:
published_at = datetime.datetime.strptime(version['publishedAt'], "%Y-%m-%dT%H:%M:%S.%fZ")
adjusted_date = published_at + datetime.timedelta(days=early_access_days)
if not current_time > adjusted_date or not published_at_str:
early_access_deadline_str = version.get('earlyAccessDeadline')
if early_access_deadline_str:
early_access_deadline = datetime.strptime(early_access_deadline_str, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
if current_time <= early_access_deadline:
continue
versions_to_keep.append(version)
if versions_to_keep:
item['modelVersions'] = versions_to_keep
filtered_items.append(item)
json_data['items'] = filtered_items
json_data['items'] = filtered_items
HTML = '<div class="column civmodellist">'
sorted_models = {}
@ -1280,6 +1279,7 @@ def request_civit_api(api_url=None):
try:
data = json.loads(response.text)
except json.JSONDecodeError:
print(response.text)
print("The CivitAI servers are currently offline. Please try again later.")
return "offline"
return data

View File

@ -68,10 +68,7 @@ def start_aria2_rpc():
try:
show_log = getattr(opts, "show_log", False)
aria2_flags = getattr(opts, "aria2_flags", "")
custom_proxy = getattr(opts, "custom_proxy", "")
if custom_proxy:
custom_proxy = f"--all-proxy={custom_proxy} "
cmd = f'"{aria2}" --enable-rpc --rpc-listen-all --rpc-listen-port=24000 --rpc-secret {rpc_secret} --check-certificate=false --ca-certificate=" " {custom_proxy}--file-allocation=none {aria2_flags}'
cmd = f'"{aria2}" --enable-rpc --rpc-listen-all --rpc-listen-port=24000 --rpc-secret {rpc_secret} --check-certificate=false --ca-certificate=" " --file-allocation=none {aria2_flags}'
subprocess_args = {'shell': True}
if not show_log:
subprocess_args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.DEVNULL})

View File

@ -1008,7 +1008,7 @@ def on_ui_settings():
"Download models using Aria2",
section=download,
**({'category_id': cat_id} if ver_bool else {})
).info("Disable this option if you're experiencing any issues with downloads.")
).info("Disable this option if you're experiencing any issues with downloads or if you want to use a proxy.")
)
shared.opts.add_option(
@ -1223,7 +1223,7 @@ def on_ui_settings():
{"placeholder": "socks4://0.0.0.0:00000 | socks5://0.0.0.0:00000"},
section=browser,
**({'category_id': cat_id} if ver_bool else {})
).info("Only works with proxies that support HTTPS, Requires UI reload for Aria2 compatibility")
).info("Only works with proxies that support HTTPS, turn Aria2 off for proxy downloads")
)
shared.opts.add_option(