summaryrefslogtreecommitdiff
path: root/py_modules
diff options
context:
space:
mode:
authorxXJsonDeruloXx <danielhimebauch@gmail.com>2025-10-21 22:10:05 -0400
committerxXJsonDeruloXx <danielhimebauch@gmail.com>2025-10-21 22:10:05 -0400
commit6a4cb63fa3de3af111245fe5dd476d70775cd74f (patch)
treeabaec124ecf0c036c542f14a04bee7c769d7b49d /py_modules
parent450e70a16310b18ae62ec4cb74a11b23197bb529 (diff)
downloaddecky-lsfg-vk-6a4cb63fa3de3af111245fe5dd476d70775cd74f.tar.gz
decky-lsfg-vk-6a4cb63fa3de3af111245fe5dd476d70775cd74f.zip
rm unused plugin update methods
Diffstat (limited to 'py_modules')
-rw-r--r--py_modules/lsfg_vk/plugin.py179
1 files changed, 0 insertions, 179 deletions
diff --git a/py_modules/lsfg_vk/plugin.py b/py_modules/lsfg_vk/plugin.py
index 09128a1..60916dd 100644
--- a/py_modules/lsfg_vk/plugin.py
+++ b/py_modules/lsfg_vk/plugin.py
@@ -6,10 +6,7 @@ Vulkan layer for frame generation on Steam Deck.
"""
import os
-import json
import subprocess
-import urllib.request
-import ssl
import hashlib
from typing import Dict, Any
from pathlib import Path
@@ -293,182 +290,6 @@ class Plugin:
return self.configuration_service.update_profile_config(profile_name, validated_config)
- async def check_for_plugin_update(self) -> Dict[str, Any]:
- """Check for plugin updates by comparing current version with most recent GitHub release
-
- Checks for the most recent release including pre-releases, not just the latest stable.
-
- Returns:
- Dict containing update information:
- {
- "update_available": bool,
- "current_version": str,
- "latest_version": str,
- "release_notes": str,
- "release_date": str,
- "download_url": str,
- "error": str (if error occurred)
- }
- """
- try:
- package_json_path = Path(decky.DECKY_PLUGIN_DIR) / "package.json"
- current_version = "0.0.0"
-
- if package_json_path.exists():
- try:
- with open(package_json_path, 'r', encoding='utf-8') as f:
- package_data = json.load(f)
- current_version = package_data.get('version', '0.0.0')
- except Exception as e:
- decky.logger.warning(f"Failed to read package.json: {e}")
-
- api_url = "https://api.github.com/repos/xXJSONDeruloXx/decky-lsfg-vk/releases"
-
- try:
- ssl_context = ssl.create_default_context()
- ssl_context.check_hostname = False
- ssl_context.verify_mode = ssl.CERT_NONE
-
- with urllib.request.urlopen(api_url, context=ssl_context) as response:
- releases_data = json.loads(response.read().decode('utf-8'))
-
- if not releases_data:
- raise Exception("No releases found")
-
- release_data = releases_data[0]
-
- latest_version = release_data.get('tag_name', '').lstrip('v')
- release_notes = release_data.get('body', '')
- release_date = release_data.get('published_at', '')
-
- download_url = ""
- for asset in release_data.get('assets', []):
- if asset.get('name', '').endswith('.zip'):
- download_url = asset.get('browser_download_url', '')
- break
-
- update_available = self._compare_versions(current_version, latest_version)
-
- return {
- "success": True,
- "update_available": update_available,
- "current_version": current_version,
- "latest_version": latest_version,
- "release_notes": release_notes,
- "release_date": release_date,
- "download_url": download_url
- }
-
- except Exception as e:
- decky.logger.error(f"Failed to fetch release info: {e}")
- return {
- "success": False,
- "error": f"Failed to check for updates: {str(e)}"
- }
-
- except Exception as e:
- return {
- "success": False,
- "error": f"Update check failed: {str(e)}"
- }
-
- async def download_plugin_update(self, download_url: str) -> Dict[str, Any]:
- """Download the plugin update zip file to ~/Downloads
-
- Args:
- download_url: URL to download the plugin zip from
-
- Returns:
- Dict containing download result:
- {
- "success": bool,
- "download_path": str,
- "error": str (if error occurred)
- }
- """
- try:
- downloads_dir = Path.home() / "Downloads"
- downloads_dir.mkdir(exist_ok=True)
- download_path = downloads_dir / "decky-lsfg-vk.zip"
-
- if download_path.exists():
- download_path.unlink()
-
- decky.logger.info(f"Downloading plugin update from {download_url}")
-
- try:
- ssl_context = ssl.create_default_context()
- ssl_context.check_hostname = False
- ssl_context.verify_mode = ssl.CERT_NONE
-
- with urllib.request.urlopen(download_url, context=ssl_context) as response:
- with open(download_path, 'wb') as f:
- f.write(response.read())
-
- if download_path.exists() and download_path.stat().st_size > 0:
- decky.logger.info(f"Plugin update downloaded successfully to {download_path}")
- return {
- "success": True,
- "download_path": str(download_path)
- }
- else:
- return {
- "success": False,
- "error": "Download completed but file is empty or missing"
- }
-
- except Exception as e:
- decky.logger.error(f"Download failed: {e}")
- return {
- "success": False,
- "error": f"Download failed: {str(e)}"
- }
-
- except Exception as e:
- return {
- "success": False,
- "error": f"Download preparation failed: {str(e)}"
- }
-
- def _compare_versions(self, current: str, latest: str) -> bool:
- """Compare two version strings to determine if an update is available
-
- Args:
- current: Current version string (e.g., "1.2.3")
- latest: Latest version string (e.g., "1.2.4")
-
- Returns:
- True if latest version is newer than current version
- """
- try:
- current_parts = current.lstrip('v').split('.')
- latest_parts = latest.lstrip('v').split('.')
-
- max_len = max(len(current_parts), len(latest_parts))
- current_parts.extend(['0'] * (max_len - len(current_parts)))
- latest_parts.extend(['0'] * (max_len - len(latest_parts)))
-
- for i in range(max_len):
- try:
- current_num = int(current_parts[i])
- latest_num = int(latest_parts[i])
-
- if latest_num > current_num:
- return True
- elif latest_num < current_num:
- return False
- except ValueError:
- if latest_parts[i] > current_parts[i]:
- return True
- elif latest_parts[i] < current_parts[i]:
- return False
-
- return False
-
- except (IndexError, AttributeError, TypeError) as e:
- self.configuration_service.log.warning(f"Version comparison failed: {e}")
- return False
-
async def get_launch_option(self) -> Dict[str, Any]:
"""Get the launch option that users need to set for their games