Skip to content

Move dependency cache to Cache/SystemTools; add startup dependency checks and cleanup; simplify NextClass component#39

Merged
Programmer-MrWang merged 4 commits into
mainfrom
codex/update-dependency-download-locations
Mar 21, 2026
Merged

Move dependency cache to Cache/SystemTools; add startup dependency checks and cleanup; simplify NextClass component#39
Programmer-MrWang merged 4 commits into
mainfrom
codex/update-dependency-download-locations

Conversation

@Programmer-MrWang

Copy link
Copy Markdown
Owner

Motivation

  • Move plugin-downloaded native/model dependencies out of Extensions/SystemTools into the global cache area so multiple plugins/installs share a predictable Cache/SystemTools path.
  • Prevent runtime errors and lockouts when optional features (FFmpeg, face-recognition) are enabled but required files are missing by disabling those features at startup and cleaning up stale references.
  • Simplify the 下节课是 component UI to a single-line layout and allow independent toggles for displaying the time range and teacher name.

Description

  • Change dependency root resolution in Shared/DependencyPaths.cs to use the app cache path ..\..\Cache\SystemTools and add helpers HasFfmpegDependency(), HasFaceRecognitionDependencies(), and GetFaceRecognitionRequiredPaths().
  • Add startup dependency enforcement in Plugin.cs via EnsureOptionalDependencyState() that will disable EnableFfmpegFeatures or EnableFaceRecognition if required files/folders are missing, and set flags used to emit startup warnings.
  • Add Shared/FaceRecognitionCredentialCleanup.cs to remove systemtools.authProviders.faceRecognition entries from ClassIsland management credential JSONs when face-recognition dependencies are not present to avoid blocking users.
  • Update settings and download logic to check the new dependency helpers (SettingsPage/SystemToolsSettingsViewModel.cs and SettingsPage/SystemToolsSettingsPage.axaml.cs) and adjust user-facing messages to require models + runtimes for face recognition.
  • Replace the NextClassDisplay component layout and settings: remove the embedded progress/lesson control, display Prefix / Subject / TimeRange / Teacher on a single centered line, add ShowTimeRange setting, and make the teacher field show only the name (no label). Files changed include Controls/Components/NextClassDisplayComponent.*, Models/ComponentSettings/NextClassDisplaySettings.cs, and its settings control XAML.
  • Ensure FFmpeg-dependent action registration and the utility menu consider the effective EnableFfmpegFeatures state after checks by gating menu/action registration accordingly.

Testing

  • Ran repository checks: git diff --check and git status --short with no code style errors reported.
  • Performed static code inspections and searches (multiple rg/sed) to verify updated call sites and settings usage succeeded.
  • Attempted to run dotnet build SystemTools.csproj -p:EnableWindowsTargeting=true but the environment does not have the dotnet SDK installed so a full build could not be executed in this session.
  • Committed the code changes after local verification of modified files and basic runtime-path logic via code review.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ee5c070ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Shared/DependencyPaths.cs
}

return Path.GetFullPath(Path.Combine(pluginFolder, "..", "..", ExtensionsFolderName, DependencyFolderName));
return Path.GetFullPath(Path.Combine(pluginFolder, "..", "..", CacheFolderName, DependencyFolderName));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate existing dependency downloads before switching cache root

GetDependencyRoot() now only resolves ../../Cache/SystemTools, but the previous DependencyPaths implementation stored ffmpeg.exe and the face-recognition pack under the old plugin-root path (../../Extensions/SystemTools, i.e. the plugin directory itself). On an in-place upgrade, EnsureOptionalDependencyState() will therefore see already-downloaded dependencies as missing on the first launch, disable EnableFfmpegFeatures/EnableFaceRecognition, and even run the face-recognition credential cleanup. Users who already had these optional features working will lose them until they manually re-download and re-enable everything, so this path switch needs a migration or fallback to the old location.

Useful? React with 👍 / 👎.

@Programmer-MrWang
Programmer-MrWang merged commit a1d05f3 into main Mar 21, 2026
1 check passed
@Programmer-MrWang
Programmer-MrWang deleted the codex/update-dependency-download-locations branch March 21, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant