Skip to content

完善社区接入、模组翻译与商店打包 - #5

Merged
DZXH-TX merged 3 commits into
mainfrom
codex/community-auth-archive-store
Aug 21, 2026
Merged

完善社区接入、模组翻译与商店打包#5
DZXH-TX merged 3 commits into
mainfrom
codex/community-auth-archive-store

Conversation

@DZXH-TX

@DZXH-TX DZXH-TX commented Aug 21, 2026

Copy link
Copy Markdown
Owner

变更概要

  • 新增 LocaleSmith 社区页面、PAT 登录/安全凭据存储、公开读取、下载、论坛与统一举报能力。
  • 完善导航初始化、旧应用数据定位与迁移,并补齐五语言资源和契约测试。
  • 放宽 JAR/ZIP 翻译工作副本的处理能力,同时保留原件、事务提交、签名清理、逐字节 override 与静态结构门禁。
  • 为 App 与 MCP Host 启用 .NET 10 self-contained,声明 Windows App Runtime 与 VCLibs Store 框架依赖。
  • 更新中英文 README,准确区分预编译 JAR 静态验证与未实现的可信源码构建。

验证

  • dotnet test LocaleSmith.slnx -c Release --no-restore:651/651 通过
  • dotnet format LocaleSmith.slnx --verify-no-changes --no-restore:通过
  • cargo fmt --manifest-path native/localesmith_core/Cargo.toml --all -- --check:通过
  • cargo clippy --manifest-path native/localesmith_core/Cargo.toml --all-targets -- -D warnings:通过
  • cargo test --manifest-path native/localesmith_core/Cargo.toml --all-targets:28/28 通过
  • 最终 MSIX/WACK 与依赖闭包已在本地验证;测试包、CER、截图和其他构建产物未提交到 Git。

说明

此 PR 保持 Draft,等待人工审查后再合并;未启用自动合并。

Comment on lines +111 to +118
$$"""
{
"error": {
"code": "{{password}}",
"message": "{{password}}"
}
}
""",
@DZXH-TX

DZXH-TX commented Aug 21, 2026

Copy link
Copy Markdown
Owner Author

@copilot 检查一下 有关于 社区 Mod 这个 WinUI 是否存在崩溃

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

@DZXH-TX Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: acc79f3e-e151-473f-bd40-188b9dd4aebe

Sorry for the inconvenience!

Co-authored-by: DZXH-TX <132790617+DZXH-TX@users.noreply.github.com>

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

@copilot 检查一下 有关于 社区 Mod 这个 WinUI 是否存在崩溃

已排查并修复一个社区 Mod 页面的 WinUI 崩溃风险:在页面导航离开时,ContentDialog.Hide() 可能因对话框状态竞态抛异常导致崩溃。已在 da543a9 增加安全隐藏保护(TryHideDialog)避免该异常中断。并复测了社区相关 ViewModel 测试(42/42 通过)。

@DZXH-TX
DZXH-TX marked this pull request as ready for review August 21, 2026 16:39
Copilot AI lite review requested due to automatic review settings August 21, 2026 16:39
@DZXH-TX
DZXH-TX merged commit e7709b6 into main Aug 21, 2026
7 checks passed
@DZXH-TX
DZXH-TX deleted the codex/community-auth-archive-store branch August 21, 2026 16:40

Copilot AI 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.

Pull request overview

This PR expands LocaleSmith with a first-party “Mod community” experience (authenticated via PAT stored in the existing credential-backed secret store), strengthens archive packaging safety via layered static validation and explicit unsigned-copy behavior for signed JARs, and updates packaging/docs/contracts to match the new capabilities and Store identity.

Changes:

  • Add Mod Platform integration (models/contracts, credential services, endpoint policy, artifact downloader) and wire it into the WinUI app (Community page + navigation + DI).
  • Introduce layered archive static validation and unsigned-copy manifest sanitization (including signature/digest claim cleanup), with new/updated contract tests.
  • Update MSIX packaging identity/dependencies, publish profiles (self-contained), and expand five-language UI/package resources + README updates.

Reviewed changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/LocaleSmith.Archive.Tests/ModArtifactStaticValidationTests.cs New end-to-end tests covering static validation, unsigned copy, and tamper detection.
tests/LocaleSmith.Archive.Tests/ArchiveWorkspaceBackendTests.cs Updates signature/manifest cleanup expectations for unsigned copies.
tests/LocaleSmith.App.Tests/XamlThemeContractTests.cs New contract test ensuring Expander motion behavior isn’t tied to internal WinUI style keys.
tests/LocaleSmith.App.Tests/ShellNavigationMapTests.cs Adds Community section routing assertions.
tests/LocaleSmith.App.Tests/PipelineTranslationQueueServiceTests.cs Asserts queue defaults for unsigned-copy handling + hardcoded string mode.
tests/LocaleSmith.App.Tests/NavigationInitializationCoordinatorTests.cs New concurrency/behavior tests for navigation initialization coordination.
tests/LocaleSmith.App.Tests/LocalizationResourceContractTests.cs Adds Community page UI/resource contracts + Store manifest identity/capability contracts.
tests/LocaleSmith.App.Tests/LegacyAppDataMigratorTests.cs Adds migration coverage for previous LocaleSmith package identity roots.
tests/LocaleSmith.App.Tests/LegacyAppDataLocatorTests.cs Extends legacy root discovery/prioritization to include LocaleSmith.Desktop identity.
src/LocaleSmith.Presentation/Models/AppConfiguration.cs Adds ShellSection.Community.
src/LocaleSmith.McpHost/Properties/PublishProfiles/win-x64.pubxml Switches publish to self-contained output.
src/LocaleSmith.Infrastructure/ModPlatform/SecretStoreModPlatformCredentialService.cs New PAT persistence service backed by credential-backed secret store.
src/LocaleSmith.Infrastructure/ModPlatform/SecretStoreModPlatformAccessTokenProvider.cs New secret resolver wrapper for optional PAT lookup.
src/LocaleSmith.Infrastructure/ModPlatform/ModPlatformHttpClientFactory.cs Centralizes HTTP handler/timeouts for Mod Platform requests/transfers.
src/LocaleSmith.Infrastructure/ModPlatform/ModPlatformException.cs Adds stable service-error contract for Mod Platform failures.
src/LocaleSmith.Infrastructure/ModPlatform/ModPlatformEndpointPolicy.cs Pins production origin; allows loopback override only in Development with strict constraints.
src/LocaleSmith.Infrastructure/ModPlatform/ModPlatformArtifactDownloader.cs Implements resumable artifact download with same-origin + ETag + SHA-256 verification.
src/LocaleSmith.Infrastructure/ModPlatform/ModPlatformApiContract.cs Enforces transport-level API version invariants for /api/v1/ endpoints.
src/LocaleSmith.Core/Models/ModPlatformModels.cs Adds Mod Platform DTOs for meta/auth/mod/forum/report/upload/download flows.
src/LocaleSmith.Core/Abstractions/ModPlatformContracts.cs Adds Mod Platform client/downloader/token/provider/credential service abstractions.
src/LocaleSmith.Archive/LocaleSmith.Archive.csproj Exposes internals to Archive test project.
src/LocaleSmith.Archive/JarManifestDocument.cs New strict manifest parser/rewriter to remove signature/digest claims for unsigned copies.
src/LocaleSmith.Archive/ArchiveWorkspace.cs Adds unsigned manifest override generation + static validation + staged override byte verification.
src/LocaleSmith.Archive/ArchivePathSafety.cs Extends signature path detection to include SIG-*.
src/LocaleSmith.Application/Models/PipelineModels.cs Extends verification model with validation mode, compilation flag, completed checks, warnings.
src/LocaleSmith.App/Themes/Controls.xaml Removes Expander style dependency on internal WinUI key.
src/LocaleSmith.App/Strings/zh-CN/Resources.resw Adds Community UI strings and reporting strings (zh-CN).
src/LocaleSmith.App/Strings/ru-RU/Resources.resw Adds Community UI strings and reporting strings (ru-RU).
src/LocaleSmith.App/Strings/ja-JP/Resources.resw Adds Community UI strings and reporting strings (ja-JP).
src/LocaleSmith.App/Strings/fr-FR/Resources.resw Adds Community UI strings and reporting strings (fr-FR).
src/LocaleSmith.App/Strings/en-US/Resources.resw Adds Community UI strings and reporting strings (en-US).
src/LocaleSmith.App/ShellNavigationMap.cs Maps Community section to CommunityPage.
src/LocaleSmith.App/Services/PipelineTranslationQueueService.cs Changes default signed-archive behavior to “explicit unsigned copy”.
src/LocaleSmith.App/Services/NavigationInitializationCoordinator.cs New helper to serialize initialization across navigation cycles.
src/LocaleSmith.App/Services/LegacyAppDataMigrator.cs Adds migration path for previous LocaleSmith package identity configuration location.
src/LocaleSmith.App/Services/LegacyAppDataLocator.cs Adds LocaleSmith.Desktop identity discovery + priority ordering.
src/LocaleSmith.App/Properties/PublishProfiles/win-x64.pubxml Switches publish to self-contained output.
src/LocaleSmith.App/Pages/CommunityPage.xaml.cs New Community page code-behind: initialization, sign-in flow, and report dialogs.
src/LocaleSmith.App/MainWindow.xaml Adds Community navigation item.
src/LocaleSmith.App/Dialogs/CliConfirmationDialog.xaml Adds per-control Expander motion feedback property.
src/LocaleSmith.App/App.xaml.cs Registers Mod Platform services + CommunityViewModel in DI.
README.md Documents community feature, unsigned-copy behavior, Store identity, and updated test/resource baselines.
README.en.md English equivalent documentation updates for the same contracts/baselines.
packaging/LocaleSmith.Package/Strings/zh-CN/Resources.resw Updates PublisherDisplayName string.
packaging/LocaleSmith.Package/Strings/ru-RU/Resources.resw Updates PublisherDisplayName string.
packaging/LocaleSmith.Package/Strings/ja-JP/Resources.resw Updates PublisherDisplayName string.
packaging/LocaleSmith.Package/Strings/fr-FR/Resources.resw Updates PublisherDisplayName string.
packaging/LocaleSmith.Package/Strings/en-US/Resources.resw Updates PublisherDisplayName string.
packaging/LocaleSmith.Package/Package.appxmanifest Switches to Partner Center identity/version; adds VCLibs dependency; updates PublisherDisplayName.
native/localesmith_core/tests/archive_scan.rs Adds test for SIG-* signature-block detection.
native/localesmith_core/src/scanner.rs Updates signature scanning + repack warning text; includes SIG-* blocks.
native/localesmith_core/src/model.rs Updates signature block doc to include SIG-*.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +183 to +184
if (name.Length is 0 or > 70 || !char.IsAsciiLetterOrDigit(name[0]) ||
name.Any(static character => !char.IsAsciiLetterOrDigit(character) && character is not '_' and not '-'))
Comment on lines +416 to +421
if (!baseUri.IsAbsoluteUri
|| (!string.Equals(baseUri.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)
&& !(allowLoopbackHttp
&& baseUri.IsLoopback
&& string.Equals(baseUri.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase)))
|| !string.IsNullOrEmpty(baseUri.UserInfo)

@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: 83d0901550

ℹ️ 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 on lines +209 to +213
<Grid
x:Name="AuthenticatedCommunityContent"
Grid.Row="2"
ColumnSpacing="16"
Visibility="{Binding IsAuthenticated, Converter={StaticResource BooleanToVisibilityConverter}}">

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 Keep public community content visible when signed out

Remove the authentication-only visibility gate from the browsing surface. When no PAT is configured, IsAuthenticated is false, so this grid—and therefore every mod, thread, post, and pagination control—is collapsed and replaced by the sign-in form. This defeats the public read path already implemented with unauthenticated GetModsAsync, GetThreadsAsync, and GetPostsAsync calls, and prevents signed-out users from browsing the public community.

Useful? React with 👍 / 👎.

Comment on lines +187 to +189
builder.Services.AddSingleton(static _ => ModPlatformArtifactDownloader.CreateForApplication());
builder.Services.AddSingleton<IModPlatformArtifactDownloader>(static services =>
services.GetRequiredService<ModPlatformArtifactDownloader>());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Connect the artifact downloader to the community flow

Wire this downloader registration into a user-facing download action. A repository-wide search finds no production consumer of IModPlatformArtifactDownloader beyond this registration: CommunityViewModel does not inject it, and CommunityPage exposes no download command or handler. Consequently, users can see LatestVersion metadata but can never invoke the newly added resumable, hash-verified downloader.

Useful? React with 👍 / 👎.

Comment on lines +439 to +445
var normalizedUsername = username?.Trim() ?? string.Empty;
if (normalizedUsername.Length == 0 || password.IsEmpty || applicationToken.IsEmpty)
{
ErrorMessage = Text(
"CommunityApplicationLoginFieldsRequiredError",
"Enter the username, password, and application token.");
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow passwordless compatibility-mode sign-in

Require the password only when SupportsApplicationLogin is true. If the server omits application_login_v1, the branch below authenticates solely through VerifyApplicationTokenAsync and explicitly says the password is neither sent nor saved, but this unconditional check still rejects an empty password before reaching that branch. Users of the compatibility endpoint therefore cannot sign in with the username and PAT that the endpoint actually requires.

Useful? React with 👍 / 👎.

Comment on lines +193 to +198
if (containsSourceBuild)
{
AddIssue(
blockingErrors,
"source or Gradle/build entries were detected. The archive pipeline will not execute untrusted build scripts; " +
"compile this source in an explicitly trusted build workflow and translate the resulting artifact.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject source archives before invoking translation

Move this source/build-project gate ahead of the translation stage. TranslationPipeline calls the translation engine and applies its results before StagePackageAsync invokes this validator, so a source ZIP containing translatable language resources can consume model requests and complete all translation work only to be rejected here with no output. Detecting the same condition during inspection or extraction would fail unsupported source projects before users incur that time or API cost.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants