Add account manager and the account page is now fully functional.

Fix "Missing javaVersion" error when launching legacy Minecraft.

Add settings page. (But is not fully implemented yet)
This commit is contained in:
wei
2026-08-03 00:16:12 +08:00
parent eff990f7e4
commit 6ab807356d
23 changed files with 3188 additions and 130 deletions
+23 -1
View File
@@ -1,4 +1,6 @@
from __future__ import annotations
import base64
import hashlib
import logging
import platform
@@ -304,4 +306,24 @@ def is_valid_zipfile(path: Path) -> bool:
try:
return zipfile.is_zipfile(path)
except OSError:
return False
return False
def bytes_to_data_url(image_data: bytes, mime_type: str = "image/png",) -> str:
"""
Convert raw image bytes to a Base64 Data URL.
:param image_data:
:param mime_type:
:return:
data_url: str
"""
if not isinstance(image_data, bytes):
raise TypeError("image_data must be bytes")
if not image_data:
raise ValueError("image_data cannot be empty")
if not isinstance(mime_type, str) or not mime_type.startswith("image/"):
raise ValueError("mime_type must be a valid image MIME type")
encoded = base64.b64encode(image_data).decode("ascii")
return f"data:{mime_type};base64,{encoded}"