Date: Sun, 6 Sep 2026 00:16:19 -0400
Subject: refactor: make Steam branch integration read-only
---
py_modules/lsfg_vk/plugin.py | 3 -
py_modules/lsfg_vk/steam_service.py | 106 ---------------------------------
py_modules/lsfg_vk/types.py | 5 --
scripts/generate_python_boilerplate.py | 2 +-
scripts/generate_ts_schema.py | 8 +--
src/api/lsfgApi.ts | 5 --
src/components/Content.tsx | 19 ------
src/components/StatusDisplay.tsx | 23 +------
src/hooks/useLsfgHooks.ts | 32 ----------
9 files changed, 7 insertions(+), 196 deletions(-)
diff --git a/py_modules/lsfg_vk/plugin.py b/py_modules/lsfg_vk/plugin.py
index 1676566..f764086 100644
--- a/py_modules/lsfg_vk/plugin.py
+++ b/py_modules/lsfg_vk/plugin.py
@@ -325,9 +325,6 @@ class Plugin:
async def get_lossless_scaling_branch_status(self) -> Dict[str, Any]:
return self.steam_service.get_branch_status()
- async def select_lossless_scaling_branch(self) -> Dict[str, Any]:
- return self.steam_service.select_branch()
-
async def set_flatpak_app_override(self, app_id: str) -> Dict[str, Any]:
"""Set lsfg-vk overrides for a Flatpak app
diff --git a/py_modules/lsfg_vk/steam_service.py b/py_modules/lsfg_vk/steam_service.py
index 3278f3c..867a135 100644
--- a/py_modules/lsfg_vk/steam_service.py
+++ b/py_modules/lsfg_vk/steam_service.py
@@ -1,6 +1,4 @@
-import os
import re
-import tempfile
from pathlib import Path
from typing import Dict, Optional, Tuple
@@ -101,42 +99,6 @@ class SteamService(BaseService):
return match.group("value")
return None
- @classmethod
- def _set_section_value(cls, content: str, section_name: str, key: str, value: str) -> str:
- bounds = cls._section_bounds(content, section_name)
- if bounds is None:
- if section_name != "UserConfig":
- raise ValueError(f"Steam manifest is missing the {section_name} section")
- app_state = cls._section_bounds(content, "AppState")
- if app_state is None:
- raise ValueError("Steam manifest is missing the AppState section")
- _, app_state_end, app_state_indent = app_state
- prefix = content[:app_state_end]
- if not prefix.endswith(("\n", "\r")):
- prefix += "\n"
- entry_indent = app_state_indent + "\t"
- section = (
- f'{entry_indent}"UserConfig"\n'
- f'{entry_indent}{{\n'
- f'{entry_indent}\t"{key}"\t"{value}"\n'
- f'{entry_indent}}}\n'
- )
- return prefix + section + content[app_state_end:]
-
- body_start, body_end, section_indent = bounds
- pattern = re.compile(
- rf'(?m)^[ \t]*"{re.escape(key)}"[ \t]+"(?P(?:\\.|[^"\\])*)"'
- )
- match = pattern.search(content, body_start, body_end)
- if match is not None:
- return content[: match.start("value")] + value + content[match.end("value") :]
-
- prefix = content[:body_end]
- if not prefix.endswith(("\n", "\r")):
- prefix += "\n"
- entry_indent = section_indent + "\t"
- return prefix + f'{entry_indent}"{key}"\t"{value}"\n' + content[body_end:]
-
@classmethod
def _branch_or_default(cls, branch: Optional[str]) -> str:
return branch or cls.DEFAULT_BRANCH
@@ -203,71 +165,3 @@ class SteamService(BaseService):
needs_switch=False,
restart_required=False,
)
-
- def select_branch(self) -> Dict[str, object]:
- try:
- manifest_path = self._manifest_path()
- if manifest_path is None:
- raise FileNotFoundError("Lossless Scaling is not installed through Steam")
-
- content = manifest_path.read_text(encoding="utf-8")
- fields = self._status_fields(manifest_path, content)
- if not fields["needs_switch"]:
- return self._success_response(
- dict,
- "Lossless Scaling is already using the lsfg-vk Steam branch",
- changed=False,
- **fields,
- )
-
- updated = self._set_section_value(
- content,
- "UserConfig",
- "BetaKey",
- STEAM_LOSSLESS_SCALING_BRANCH,
- )
- if updated != content:
- file_mode = manifest_path.stat().st_mode & 0o777
- temporary_path = None
- try:
- with tempfile.NamedTemporaryFile(
- mode="w",
- encoding="utf-8",
- dir=manifest_path.parent,
- prefix=f".{manifest_path.name}.",
- delete=False,
- ) as temporary_file:
- temporary_path = Path(temporary_file.name)
- temporary_file.write(updated)
- temporary_file.flush()
- os.fsync(temporary_file.fileno())
- temporary_path.chmod(file_mode)
- os.replace(temporary_path, manifest_path)
- except Exception:
- if temporary_path is not None:
- temporary_path.unlink(missing_ok=True)
- raise
-
- new_fields = dict(fields)
- new_fields["selected_branch"] = STEAM_LOSSLESS_SCALING_BRANCH
- new_fields["needs_switch"] = new_fields["current_branch"] != STEAM_LOSSLESS_SCALING_BRANCH
- new_fields["restart_required"] = new_fields["needs_switch"]
- return self._success_response(
- dict,
- "lsfg-vk selected for Lossless Scaling; restart Steam to download it",
- changed=updated != content,
- **new_fields,
- )
- except Exception as error:
- return self._error_response(
- dict,
- str(error),
- changed=False,
- installed=False,
- manifest_path=None,
- selected_branch=None,
- current_branch=None,
- target_branch=STEAM_LOSSLESS_SCALING_BRANCH,
- needs_switch=False,
- restart_required=False,
- )
diff --git a/py_modules/lsfg_vk/types.py b/py_modules/lsfg_vk/types.py
index 96ce23b..2c56a15 100644
--- a/py_modules/lsfg_vk/types.py
+++ b/py_modules/lsfg_vk/types.py
@@ -54,11 +54,6 @@ class SteamBranchStatusResponse(TypedDict):
needs_switch: bool
restart_required: bool
-
-class SteamBranchOperationResponse(SteamBranchStatusResponse):
- changed: bool
-
-
class ConfigurationResponse(BaseResponse):
"""Response for configuration operations"""
config: Optional[ConfigurationData]
diff --git a/scripts/generate_python_boilerplate.py b/scripts/generate_python_boilerplate.py
index a03aa2b..d134337 100644
--- a/scripts/generate_python_boilerplate.py
+++ b/scripts/generate_python_boilerplate.py
@@ -244,7 +244,7 @@ def main():
print(f"Generated {schema_file.relative_to(project_root)}")
except Exception as e:
- print(f"❌ Error generating Python files: {e}")
+ print(f"Error generating Python files: {e}")
sys.exit(1)
diff --git a/scripts/generate_ts_schema.py b/scripts/generate_ts_schema.py
index c4c0e8a..27969f1 100644
--- a/scripts/generate_ts_schema.py
+++ b/scripts/generate_ts_schema.py
@@ -132,11 +132,11 @@ def main():
target_file = project_root / "src" / "config" / "generatedConfigSchema.ts"
target_file.write_text(ts_content)
- print(f"✅ Generated {target_file} from shared_config.py")
+ print(f"Generated {target_file} from shared_config.py")
print(f" Fields: {len(CONFIG_SCHEMA_DEF)}")
# Also generate Python boilerplate
- print("\n🔄 Generating Python boilerplate...")
+ print("\nGenerating Python boilerplate...")
from pathlib import Path
import subprocess
@@ -147,10 +147,10 @@ def main():
if result.returncode == 0:
print(result.stdout)
else:
- print(f"⚠️ Python boilerplate generation had issues:\n{result.stderr}")
+ print(f"Warning: Python boilerplate generation had issues:\n{result.stderr}")
except Exception as e:
- print(f"❌ Error generating schema: {e}")
+ print(f"Error generating schema: {e}")
sys.exit(1)
diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts
index 64d43cb..c0d6528 100644
--- a/src/api/lsfgApi.ts
+++ b/src/api/lsfgApi.ts
@@ -29,10 +29,6 @@ export interface SteamBranchStatus {
restart_required: boolean;
}
-export interface SteamBranchOperationResult extends SteamBranchStatus {
- changed: boolean;
-}
-
// Use centralized configuration data type
export type LsfgConfig = ConfigurationData;
@@ -130,7 +126,6 @@ export const installLsfgVk = callable<[], InstallationResult>("install_lsfg_vk")
export const uninstallLsfgVk = callable<[], InstallationResult>("uninstall_lsfg_vk");
export const checkLsfgVkInstalled = callable<[], InstallationStatus>("check_lsfg_vk_installed");
export const getLosslessScalingBranchStatus = callable<[], SteamBranchStatus>("get_lossless_scaling_branch_status");
-export const selectLosslessScalingBranch = callable<[], SteamBranchOperationResult>("select_lossless_scaling_branch");
export const getLsfgConfig = callable<[], ConfigResult>("get_lsfg_config");
export const getConfigSchema = callable<[], ConfigSchemaResult>("get_config_schema");
export const getLaunchOption = callable<[], LaunchOptionResult>("get_launch_option");
diff --git a/src/components/Content.tsx b/src/components/Content.tsx
index 4e4e33a..01f94c9 100644
--- a/src/components/Content.tsx
+++ b/src/components/Content.tsx
@@ -15,7 +15,6 @@ import { NerdStuffModal } from "./NerdStuffModal";
import { FlatpaksModal } from "./FlatpaksModal";
import { ConfigurationData } from "../config/configSchema";
import t from '../i18n/i18n';
-import { showErrorToast, showSuccessToast } from "../utils/toastUtils";
export function Content() {
const {
@@ -26,8 +25,6 @@ export function Content() {
losslessScalingInstalled,
losslessScalingStatus,
steamBranchStatus,
- isSwitchingSteamBranch,
- selectLosslessScalingBranch,
checkInstallation
} = useInstallationStatus();
@@ -71,18 +68,6 @@ export function Content() {
handleUninstall(setIsInstalled, setInstallationStatus, checkInstallation);
};
- const onSelectLosslessScalingBranch = async () => {
- const result = await selectLosslessScalingBranch();
- if (result.success) {
- showSuccessToast("Steam branch selected", result.message);
- } else {
- showErrorToast(
- "Steam branch selection failed",
- result.error || "Unable to select the lsfg-vk Steam branch"
- );
- }
- };
-
const handleShowNerdStuff = () => {
showModal();
};
@@ -109,8 +94,6 @@ export function Content() {
losslessScalingInstalled={losslessScalingInstalled}
losslessScalingStatus={losslessScalingStatus}
steamBranchStatus={steamBranchStatus}
- isSwitchingSteamBranch={isSwitchingSteamBranch}
- onSelectLosslessScalingBranch={onSelectLosslessScalingBranch}
/>
>
)}
@@ -192,8 +175,6 @@ export function Content() {
losslessScalingInstalled={losslessScalingInstalled}
losslessScalingStatus={losslessScalingStatus}
steamBranchStatus={steamBranchStatus}
- isSwitchingSteamBranch={isSwitchingSteamBranch}
- onSelectLosslessScalingBranch={onSelectLosslessScalingBranch}
/>
void;
}
export function StatusDisplay({
@@ -16,9 +14,7 @@ export function StatusDisplay({
installationStatus,
losslessScalingInstalled,
losslessScalingStatus,
- steamBranchStatus,
- isSwitchingSteamBranch,
- onSelectLosslessScalingBranch
+ steamBranchStatus
}: StatusDisplayProps) {
const losslessScalingAppInstalled = losslessScalingInstalled || steamBranchStatus?.installed === true;
@@ -36,9 +32,6 @@ export function StatusDisplay({
gap: "6px"
}}
>
-
- {losslessScalingAppInstalled ? "✅" : "❌"}
-
{losslessScalingAppInstalled ? "Lossless Scaling Installed" : "Lossless Scaling Not Installed"}
{!losslessScalingAppInstalled && losslessScalingStatus && (
@@ -55,9 +48,6 @@ export function StatusDisplay({
gap: "6px"
}}
>
-
- {isInstalled ? "✅" : "❌"}
-
{installationStatus}