Login flow now uses the returned verification_uri;

to prefill the user_code on the activation page
This commit is contained in:
DevilXD committed 2025-02-03 21:31:06 +01:00
1 parent 689afdddbe
commit c4cfa5372f
3 files changed
+13 -11

No files matched your search

+7 -6
View File
@@ -21,7 +21,7 @@ from datetime import datetime, timezone
from collections import abc, OrderedDict
from typing import Any, Literal, Callable, Generic, Mapping, TypeVar, ParamSpec, cast
import yarl
from yarl import URL
from PIL.ImageTk import PhotoImage
from PIL import Image as Image_module
@@ -176,7 +176,7 @@ def _serialize(obj: Any) -> Any:
# NOTE: IntEnum cannot be used, as it will get serialized as a plain integer,
# then loaded back as an integer as well.
d = obj.value
elif isinstance(obj, yarl.URL):
elif isinstance(obj, URL):
d = str(obj)
else:
raise TypeError(obj)
@@ -190,7 +190,7 @@ def _serialize(obj: Any) -> Any:
_MISSING = object()
SERIALIZE_ENV: dict[str, Callable[[Any], object]] = {
"set": set,
"URL": yarl.URL,
"URL": URL,
"PriorityMode": PriorityMode,
"datetime": lambda d: datetime.fromtimestamp(d, timezone.utc),
}
@@ -254,7 +254,8 @@ def json_save(path: Path, contents: Mapping[Any, Any], *, sort: bool = False) ->
json.dump(contents, file, default=_serialize, sort_keys=sort, indent=4)
def webopen(url: str):
def webopen(url: URL | str):
url_str = str(url)
if IS_PACKAGED and sys.platform == "linux":
# https://pyinstaller.org/en/stable/
# runtime-information.html#ld-library-path-libpath-considerations
@@ -268,7 +269,7 @@ def webopen(url: str):
# pop current
os.environ.pop(ld_env)
webbrowser.open_new_tab(url)
webbrowser.open_new_tab(url_str)
if ld_path_curr is not None:
os.environ[ld_env] = ld_path_curr
@@ -276,7 +277,7 @@ def webopen(url: str):
# pop original
os.environ.pop(ld_env)
else:
webbrowser.open_new_tab(url)
webbrowser.open_new_tab(url_str)
class ExponentialBackoff: