Skip to content

Commit 6dab050

Browse files
committed
fix versioning and demo detection
1 parent 50cd6a3 commit 6dab050

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

scripts/build_release.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,19 @@ try {
270270
Write-Warning "Failed to update file_version_info.txt: $_"
271271
}
272272

273+
# --- Update Source Versions (for runtime consistency) ---
274+
Write-Host "`nSyncing version to source files..." -ForegroundColor Gray
275+
try {
276+
if (Test-Path "$RepoRoot/src/switchcraft/__init__.py") {
277+
(Get-Content "$RepoRoot/src/switchcraft/__init__.py") -replace '__version__ = ".*"', "__version__ = `"$AppVersion`"" | Set-Content "$RepoRoot/src/switchcraft/__init__.py"
278+
}
279+
if (Test-Path $PyProjectFile) {
280+
(Get-Content $PyProjectFile) -replace 'version = ".*"', "version = `"$AppVersion`"" | Set-Content $PyProjectFile
281+
}
282+
} catch {
283+
Write-Warning "Failed to sync source versions: $_"
284+
}
285+
273286
# Setup Dist dir
274287
$DistDir = Join-Path $RepoRoot "dist"
275288
if (-not (Test-Path $DistDir)) {

src/switchcraft/gui_modern/app.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __init__(self, page: ft.Page, splash_proc=None):
115115
# The loading screen will be replaced in build_ui()
116116

117117
# Update Page Properties
118-
self.page.title = "SwitchCraft Web"
118+
self.page.title = "SwitchCraft Web" if self.page.web and sys.platform == "emscripten" else "SwitchCraft"
119119
if self.page.web:
120120
self.page.favicon = "favicon.png"
121121
elif not self.page.favicon:
@@ -554,7 +554,6 @@ def _clear_notifications(self, e, dlg):
554554
self.page.update()
555555

556556
def setup_page(self):
557-
self.page.title = "SwitchCraft Web"
558557
# self.page.title = f"SwitchCraft v{__version__}"
559558
# Parse theme
560559
theme_pref = SwitchCraftConfig.get_value("Theme", "System")
@@ -1207,9 +1206,12 @@ def nav_to_analyzer():
12071206

12081207

12091208
layout_controls = []
1210-
if self.banner_container:
1209+
if hasattr(self, "banner_container") and self.banner_container and self.banner_container.content:
12111210
layout_controls.append(self.banner_container)
12121211

1212+
if hasattr(self, "dev_banner_container") and self.dev_banner_container and self.dev_banner_container.content:
1213+
layout_controls.append(self.dev_banner_container)
1214+
12131215
layout_controls.append(self.sidebar)
12141216

12151217
# Replace loading screen with actual UI (like RDM - banner stays visible until app is ready)

src/switchcraft/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def legacy_show_snack(snack):
445445
# --- End Patching ---
446446

447447
# --- Page Configuration ---
448-
page.title = "SwitchCraft Web" if page.web else "SwitchCraft"
448+
page.title = "SwitchCraft Web" if page.web and sys.platform == "emscripten" else "SwitchCraft"
449449

450450
# Set favicon for web mode
451451
try:

tests/test_i18n_integrity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_codebase_keys_exist(self):
128128
'rule_type', 'output_json', 'target_version', 'search_query',
129129
'error_description', 'import_settings', 'created_at', 'export_settings', 'export_logs',
130130
'admin_password', 'config_path', 'admin_password_hash', 'first_run', 'demo_mode',
131-
'current_password', 'new_password', 'confirm_password', 'update_exe'
131+
'current_password', 'new_password', 'confirm_password', 'update_exe', 'banner_container'
132132
}
133133

134134
for k in found_keys:

tests/test_intune_service_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def test_download_tool_mock(self, mock_file, mock_chmod, mock_stat, mock_mkdir,
6363

6464
result = self.service.download_tool()
6565
self.assertTrue(result)
66-
mock_get.assert_called_once()
66+
# Check that the actual download URL was requested
67+
mock_get.assert_any_call(self.service.TOOL_URL, stream=True, timeout=30)
6768

6869
def test_create_intunewin_requires_tool(self):
6970
"""Test that create_intunewin requires the tool to be available."""

0 commit comments

Comments
 (0)