diff --git a/pkgs/clan-app/bin/clan-app b/pkgs/clan-app/bin/clan-app
index 167616d6a..a3d8c4acf 100755
--- a/pkgs/clan-app/bin/clan-app
+++ b/pkgs/clan-app/bin/clan-app
@@ -4,6 +4,7 @@ from pathlib import Path
module_path = Path(__file__).parent.parent.absolute()
+
sys.path.insert(0, str(module_path))
sys.path.insert(0, str(module_path.parent / "clan_cli"))
diff --git a/pkgs/clan-app/clan_app/__init__.py b/pkgs/clan-app/clan_app/__init__.py
index 03647b16b..a0dd3c33e 100644
--- a/pkgs/clan-app/clan_app/__init__.py
+++ b/pkgs/clan-app/clan_app/__init__.py
@@ -1,18 +1,28 @@
import logging
import sys
-# Remove working directory from sys.path
-if "" in sys.path:
- sys.path.remove("")
-
from clan_cli.profiler import profile
from clan_app.app import MainApplication
log = logging.getLogger(__name__)
+from urllib.parse import quote
+
+from clan_app.deps.webview.webview import Webview
+
@profile
def main(argv: list[str] = sys.argv) -> int:
+ html = """
+
+
+ Hello from Python Webview!
+
+
+ """
+ webview = Webview()
+ webview.navigate(f"data:text/html,{quote(html)}")
+ webview.run()
app = MainApplication()
return app.run(argv)
diff --git a/pkgs/clan-app/clan_app/deps/webview/_dummy_holder.pyx b/pkgs/clan-app/clan_app/deps/__init__.py
similarity index 100%
rename from pkgs/clan-app/clan_app/deps/webview/_dummy_holder.pyx
rename to pkgs/clan-app/clan_app/deps/__init__.py
diff --git a/pkgs/clan-app/clan_app/deps/webview/_webview_ffi.py b/pkgs/clan-app/clan_app/deps/webview/_webview_ffi.py
index 9295f5816..3101b38ca 100644
--- a/pkgs/clan-app/clan_app/deps/webview/_webview_ffi.py
+++ b/pkgs/clan-app/clan_app/deps/webview/_webview_ffi.py
@@ -32,12 +32,6 @@ def _get_lib_names():
else: # linux
return ["libwebview.so"]
-def _get_download_urls():
- """Get the appropriate download URLs based on the platform."""
- version = _get_webview_version()
- return [f"https://github.com/webview/webview_deno/releases/download/{version}/{lib_name}"
- for lib_name in _get_lib_names()]
-
def _be_sure_libraries():
"""Ensure libraries exist and return paths."""
if getattr(sys, 'frozen', False):
@@ -47,38 +41,20 @@ def _be_sure_libraries():
base_dir = Path(sys.executable).parent / '_internal'
else:
base_dir = Path(__file__).parent
-
- lib_dir = base_dir / "lib"
+ from ctypes.util import find_library
+
+ lib_dir = os.environ.get("WEBVIEW_LIB_DIR")
+ if not lib_dir:
+ raise RuntimeError("WEBVIEW_LIB_DIR environment variable is not set")
+ lib_dir = Path(lib_dir)
lib_names = _get_lib_names()
lib_paths = [lib_dir / lib_name for lib_name in lib_names]
-
+
# Check if any library is missing
missing_libs = [path for path in lib_paths if not path.exists()]
if not missing_libs:
return lib_paths
- # Download missing libraries
- download_urls = _get_download_urls()
- system = platform.system().lower()
-
- lib_dir.mkdir(parents=True, exist_ok=True)
-
- for url, lib_path in zip(download_urls, lib_paths):
- if lib_path.exists():
- continue
-
- print(f"Downloading library from {url}")
- try:
- req = urllib.request.Request(
- url,
- headers={'User-Agent': 'Mozilla/5.0'}
- )
- with urllib.request.urlopen(req) as response, open(lib_path, 'wb') as out_file:
- out_file.write(response.read())
- except Exception as e:
- raise RuntimeError(f"Failed to download library: {e}")
-
- return lib_paths
class _WebviewLibrary:
def __init__(self):
diff --git a/pkgs/clan-app/pyproject.toml b/pkgs/clan-app/pyproject.toml
index 55a04543d..33c8654cf 100644
--- a/pkgs/clan-app/pyproject.toml
+++ b/pkgs/clan-app/pyproject.toml
@@ -9,7 +9,7 @@ description = "clan app"
dynamic = ["version"]
scripts = { clan-app = "clan_app:main" }
-[project.urls]
+[project.urls]
Homepage = "https://clan.lol/"
Documentation = "https://docs.clan.lol/"
Repository = "https://git.clan.lol/clan/clan-core"
diff --git a/pkgs/clan-app/shell.nix b/pkgs/clan-app/shell.nix
index d8ea8fc34..9f3bed655 100644
--- a/pkgs/clan-app/shell.nix
+++ b/pkgs/clan-app/shell.nix
@@ -66,5 +66,7 @@ mkShell {
export XDG_DATA_DIRS=${gtk4}/share/gsettings-schemas/gtk4-4.14.4:$XDG_DATA_DIRS
export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-46.0:$XDG_DATA_DIRS
+
+ export WEBVIEW_LIB_DIR=${webview-wrapper}/lib
'';
}