Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
333f0dd
feat: shop-source UI, typed script config, mod compat warnings, FTB m…
000hen Jul 10, 2026
d409b76
feat: add server-less modpack shop
000hen Jul 11, 2026
04a06f2
docs: spec for FTB parallel downloads, modpack update and export
000hen Jul 11, 2026
2b4b7ef
docs: implementation plan for FTB parallel downloads, update and export
000hen Jul 11, 2026
40b6d97
feat(proto): provider_version + UpdateModpack/ExportModpack RPCs
000hen Jul 11, 2026
bd46e62
feat(engine): persist modpack pack identity on the server record
000hen Jul 11, 2026
509edd1
feat(engine): jhmc.download_all parallel batch download host function
000hen Jul 11, 2026
aadf4f2
feat(engine): parallel FTB modpack file downloads
000hen Jul 11, 2026
ef47ef5
feat(engine): optional update() provider entry point
000hen Jul 11, 2026
d2e4adb
feat(engine): ftb.lua manifest-diff update()
000hen Jul 11, 2026
48e0cb6
feat(engine): UpdateModpack RPC (manifest-diff modpack update)
000hen Jul 11, 2026
21c4dca
feat(engine): ExportModpack RPC (CurseForge client pack zip)
000hen Jul 12, 2026
9080dcd
feat(app): modpack update and export actions
000hen Jul 12, 2026
095952e
fix(engine): FTB API serves curseforge ids as strings
000hen Jul 12, 2026
66c2aa1
feat(proto): ImportModpack RPC
000hen Jul 13, 2026
2fee0f7
feat(engine): shared modpack Lua lib, unzip prefix, normalized manifest
000hen Jul 13, 2026
4246b09
feat(engine): export modpacks from persisted manifest
000hen Jul 13, 2026
bdec0a2
feat(engine): CurseForge modpack source (provider + shop)
000hen Jul 13, 2026
8f69a0a
feat(engine): Modrinth modpack source (provider + shop)
000hen Jul 13, 2026
061532f
feat(engine): ImportModpack RPC + local import provider
000hen Jul 13, 2026
9292be7
feat(app): import a local modpack file as a new server
000hen Jul 13, 2026
9785037
style(engine): gofmt modpack import/test files
000hen Jul 13, 2026
11898d7
fix(engine): UpdateModpack on an unsupported provider returns Unimple…
000hen Jul 13, 2026
5b94eb8
refactor: unify modpack sources and obfuscate baked key
000hen Jul 16, 2026
1d6fa90
fix: harden modpack integration after rebase
000hen Jul 18, 2026
599e582
fix: keep modpack operations active in tray
000hen Jul 18, 2026
9c27bcf
fix: preserve tray lifecycle for server work
000hen Jul 18, 2026
c91175a
refactor: use context for modpack browse mode
000hen Jul 20, 2026
3ecf9d0
fix: set project author when missing
000hen Jul 20, 2026
d7eb0b5
chore: wrap lines in ShopBrowsingContractTests
000hen Jul 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ jobs:
run: |
New-Item -ItemType Directory -Force ../build | Out-Null

. (Join-Path (Get-Location) '..\keycipher.ps1')
$ldflags = "-s -w -buildid="
if ($env:JHMC_CURSEFORGE_API_KEY) {
$ldflags += " -X main.defaultCurseForgeKey=$($env:JHMC_CURSEFORGE_API_KEY)"
$keyFragment = Get-CurseForgeKeyLdflagsFragment
Remove-Item Env:JHMC_CURSEFORGE_API_KEY -ErrorAction SilentlyContinue
if ($keyFragment) {
$ldflags += " $keyFragment"
}

go build -trimpath -buildvcs=false -mod=readonly `
Expand Down
34 changes: 27 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,33 @@ both sides, then implement the Go `*Service` and call it from a C# ViewModel.
`export.go`), and **mod-metadata parsers** (`ParserSet`, `LuaParser`,
`builtin_parsers/*.lua` — fabric/quilt/forge/neoforge/forge-legacy/bukkit; they
enrich `ModService.List` with icon/name/authors/version, cached per jar), and
**mod shops** (`ShopSet`, `LuaShop`, `builtin_shops/*.lua` — modrinth,
curseforge; the home/search/detail/versions/resolve_file contract behind
`ShopService` and the app's Mod Shop window. Shop HTTP goes through
`internal/httpcache` via `jhmc.http_cache` (disk ETag cache); keyed sources
declare `needs_key` and read `ctx.config.api_key`, resolved from settings
`shop_keys` then the `-X main.defaultCurseForgeKey` build default —
`build.ps1` injects env `JHMC_CURSEFORGE_API_KEY`).
**mod shops** (`ShopSet`, `LuaShop`; the home/search/detail/versions/resolve_file
contract behind `ShopService` and the app's Mod Shop window). The first-party
shops now ship as **multi-role source scripts** in `builtin_sources/*.lua`
(modrinth, curseforge, ftb): one file declaring a `shop` role table and a hidden
`provider` role table under one `meta.id`, loaded by `LoadBuiltinSources` into
both `ShopSet` and `Registry` and sharing one `shop-config.json` entry. Role
tables are optional/back-compat — legacy top-level-function scripts still work;
role-scoped `kinds`/`needs_key` (shop) and `hidden`/`mod_layout` (provider)
override the `meta`-level fields. `meta.aliases` redirects an old id (e.g.
`curseforge_modpacks`) to the canonical entry in both registries so existing
modpack servers keep resolving. Shop HTTP goes through `internal/httpcache` via
`jhmc.http_cache` (disk ETag cache); keyed sources declare `needs_key` and read
`ctx.config.api_key` — a stored config key wins, with the
`-X main.defaultCurseForgeKeyCipher` + `-X main.defaultCurseForgeKeyPad` build
default as fallback. The key + pad injection now applies to **every build path**
— `build.ps1` AND the dotnet/VS/MSIX build (via `app/Engine.targets`'
`BuildEngine` target, which is what Store/MSIX packaging uses, not `build.ps1`).
Both paths get the ldflags fragment from the single source of truth
`keycipher.ps1` at the repo root, which XOR-obfuscates + hex-encodes env
`JHMC_CURSEFORGE_API_KEY` and emits BOTH the cipher and the pad as `-X` flags
(`build.ps1` dot-sources it; `Engine.targets` executes it and folds the fragment
into the default `-ldflags`). The pad is generated fresh per keyed build — set
`JHMC_KEY_CIPHER_PAD` (hex, ≥32 bytes) for a reproducible build, otherwise each
keyed binary is unique. Neither pad nor cipher is committed.
`engine/cmd/engine/keycipher.go` decodes it at startup; a one-time startup
migration folds any legacy `settings.json` `shop_keys["curseforge"]` into the
shared shop config.
`GrantStore` (`grants.go`) persists per-script permission decisions
(`grants.json`, `script-grants.json`, `parser-grants.json`, `shop-grants.json`).
`ProviderService`/`ScriptService`/`ParserService`/`ShopService` are wired in
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ automatically runs `buf generate` when Go gRPC stubs are missing, then compiles
the Go engine before the C# build begins — no manual steps needed on a fresh
clone.

To bake the optional default CurseForge API key into `engine.exe`, set
`JHMC_CURSEFORGE_API_KEY` in the environment that starts the build. For
`build.ps1`, set it in the same PowerShell session. For Visual Studio, set the
environment variable before starting Visual Studio, then restart Visual Studio
after changing it. Do not put the key in `launchSettings.json`: launch profiles
apply only when the app starts, after MSBuild has already compiled the engine,
and the file is committed. Set `JHMC_KEY_CIPHER_PAD` to at least 32 bytes of hex
only when a reproducible keyed binary is required; otherwise each build creates
a fresh random pad. The XOR encoding keeps plaintext out of the binary and
normal build logs, but it is obfuscation rather than encryption because the
binary contains everything needed to decode the key.

The app uses the packaged MSIX model by default. Double-click
`Package.appxmanifest` in Solution Explorer to open Visual Studio's manifest
designer. See [MSIX packaging](docs/packaging.md) for command-line packaging,
Expand Down
28 changes: 26 additions & 2 deletions app/Engine.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
<RepoRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)..'))</RepoRoot>
<EngineSourceDir>$(RepoRoot)engine</EngineSourceDir>
<EngineExe>$(RepoRoot)build\engine.exe</EngineExe>
<!--
EngineGoBuildArgs is overridable: pass /p:EngineGoBuildArgs=... to take full
control of the go build flags. When you override it, injecting a baked
CurseForge key is YOUR responsibility — this file leaves a custom value
untouched (it never clobbers an override). When it is left at the default
below, the BuildEngine target delegates the default build to keycipher.ps1
so reversible key material never enters an MSBuild property or binlog. The
dotnet/VS/MSIX build path still bakes the key exactly like build.ps1 does.
-->
<_EngineGoBuildArgsIsDefault Condition="'$(EngineGoBuildArgs)' == ''">true</_EngineGoBuildArgsIsDefault>
<EngineGoBuildArgs Condition="'$(EngineGoBuildArgs)' == ''">-trimpath -buildvcs=false -mod=readonly -ldflags=&quot;-s -w -buildid=&quot;</EngineGoBuildArgs>
<EngineGoBuildEnvironment Condition="'$(EngineGoBuildEnvironment)' == ''">CGO_ENABLED=0</EngineGoBuildEnvironment>
<!-- Protobuf codegen: the sentinel file that proves stubs have been generated. -->
Expand Down Expand Up @@ -71,11 +81,25 @@
<Output TaskParameter="ExitCode" PropertyName="_GoExitCode" />
</Exec>

<MakeDir Condition="'$(_GoExitCode)' == '0' And !Exists('$(RepoRoot)build')"
Directories="$(RepoRoot)build" />

<!-- For default builds, keycipher.ps1 owns the complete go invocation. This
keeps the reversible cipher/pad inside the child PowerShell process;
neither half becomes an MSBuild property, task output, or binlog entry.
powershell.exe is Windows PowerShell 5.1 and the helper is 5.1-safe. -->
<Message Condition="'$(_GoExitCode)' == '0'" Importance="high"
Text="BuildEngine: $(_EngineBuildEnv) go build $(EngineGoBuildArgs) -&gt; $(EngineExe)" />
<Exec Condition="'$(_GoExitCode)' == '0'"
Text="BuildEngine: $(_EngineBuildEnv) go build -&gt; $(EngineExe)" />
<Exec Condition="'$(_GoExitCode)' == '0' And '$(_EngineGoBuildArgsIsDefault)' == 'true'"
EnvironmentVariables="$(_EngineBuildEnv)"
EchoOff="true"
Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File &quot;$(RepoRoot)keycipher.ps1&quot; -BuildEngine -EngineSourceDir &quot;$(EngineSourceDir)&quot; -EngineOutput &quot;$(EngineExe)&quot;" />

<!-- A custom EngineGoBuildArgs override remains the caller's responsibility. -->
<Exec Condition="'$(_GoExitCode)' == '0' And '$(_EngineGoBuildArgsIsDefault)' != 'true'"
WorkingDirectory="$(EngineSourceDir)"
EnvironmentVariables="$(_EngineBuildEnv)"
EchoOff="true"
Command="go build $(EngineGoBuildArgs) -o &quot;$(EngineExe)&quot; ./cmd/engine" />

<!-- Go missing: tolerate a prebuilt engine, but fail clearly if there is
Expand Down
25 changes: 20 additions & 5 deletions app/JustHostMC.App.ResourceTests/FeatureFiniteStateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,34 @@ public void SettingsFiniteLabelsUseSemanticStateAndXamlResources() {
var viewModel =
RepositoryLayout.ReadAppFile("ViewModels", "SettingsViewModel.cs");
var xaml = RepositoryLayout.ReadAppFile("Views", "SettingsPage.xaml");
var scriptsViewModel =
RepositoryLayout.ReadAppFile("ViewModels", "ScriptsViewModel.cs");
var scriptsXaml =
RepositoryLayout.ReadAppFile("Views", "ScriptsPage.xaml");

Assert.Contains("SettingsWorkflowStatus", viewModel,
StringComparison.Ordinal);
Assert.Contains("ShopKeyConfiguration", viewModel,
StringComparison.Ordinal);
Assert.Contains("BackendMode", viewModel, StringComparison.Ordinal);
Assert.DoesNotContain("ActiveModeText", viewModel,
StringComparison.Ordinal);
Assert.DoesNotContain("CurseForgeKeyStatus", viewModel,
StringComparison.Ordinal);
Assert.DoesNotContain("ShopKeyConfiguration", viewModel,
StringComparison.Ordinal);
Assert.DoesNotContain("SettingsShopKey", xaml,
StringComparison.Ordinal);
Assert.DoesNotContain("SettingsCurseForgeKey", xaml,
StringComparison.Ordinal);

Assert.Contains("GetConfigAsync", scriptsViewModel,
StringComparison.Ordinal);
Assert.Contains("ScriptConfigured=\"OnConfigureClick\"", scriptsXaml,
StringComparison.Ordinal);

foreach (var uid in new[] {
"SettingsBackendModeDocker",
"SettingsBackendModeOnMachine",
"SettingsDockerUnavailable",
"SettingsShopKeyNone",
"SettingsShopKeyUser",
"SettingsShopKeyBuiltin",
"SettingsStatusSaved",
"SettingsStatusSaveFailed",
}) {
Expand All @@ -62,6 +72,7 @@ public void ShopFiniteLabelsUseSemanticStateAndXamlResources() {
var window = RepositoryLayout.ReadAppFile("Views", "ShopWindow.xaml");
var detailXaml =
RepositoryLayout.ReadAppFile("Views", "ShopDetailPage.xaml");
var models = RepositoryLayout.ReadAppFile("Models", "ShopModels.cs");

Assert.Contains("HasLoadFailure", shop, StringComparison.Ordinal);
Assert.DoesNotContain("_localizer.Get(\"Shop_LoadFailed\")", shop,
Expand All @@ -75,6 +86,10 @@ public void ShopFiniteLabelsUseSemanticStateAndXamlResources() {
StringComparison.Ordinal);
Assert.Contains("x:Uid=\"ShopInstallActionText\"", detailXaml,
StringComparison.Ordinal);
Assert.Contains("x:Uid=\"ShopCreateServerActionText\"", detailXaml,
StringComparison.Ordinal);
Assert.Contains("CreateServerActionVisibility", models,
StringComparison.Ordinal);
Assert.Contains("x:Uid=\"ShopStatusInstallDone\"", detailXaml,
StringComparison.Ordinal);
}
Expand Down
24 changes: 24 additions & 0 deletions app/JustHostMC.App.ResourceTests/ShopBrowsingContractTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Xunit;

namespace JustHostMC.App.ResourceTests;

public sealed class ShopBrowsingContractTests {
[Fact]
public void BrowseModeComesFromContextRatherThanMergedSourceCapabilities() {
var shop =
RepositoryLayout.ReadAppFile("ViewModels", "ShopViewModel.cs");
var detail = RepositoryLayout.ReadAppFile("ViewModels",
"ShopDetailViewModel.cs");

Assert.Contains(
"public bool SelectedShopIsModpack => Context.Kind == ModKind.Modpack;",
shop, StringComparison.Ordinal);
Assert.DoesNotContain("SelectedShop?.Kinds.Contains(\"modpack\")", shop,
StringComparison.Ordinal);
Assert.Contains("IsModpack = shop.SelectedShopIsModpack;", detail,
StringComparison.Ordinal);
Assert.DoesNotContain(
"IsModpack = shopInfo?.Kinds.Contains(\"modpack\")", detail,
StringComparison.Ordinal);
}
}
121 changes: 121 additions & 0 deletions app/JustHostMC.App.ResourceTests/TrayLifecycleTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using Xunit;

namespace JustHostMC.App.ResourceTests;

public sealed class TrayLifecycleTests {
[Fact]
public void ServerStatePathsSynchronizePersistentBackgroundActivity() {
var source =
RepositoryLayout.ReadAppFile("ViewModels", "MainViewModel.cs");
var merge = MethodBetween(source, "private void MergeServers(",
"private void ApplyServerChange");
var apply = MethodBetween(source, "private void ApplyServerChange",
"private void UpsertServer");

AssertSynchronizesAfterStateUpdate(merge, "_serverState.Reconcile");
AssertSynchronizesAfterStateUpdate(apply, "_serverState.Apply");
Assert.Contains(
"_backgroundTasks.SynchronizeServers(_serverState.Servers)", source,
StringComparison.Ordinal);
}

[Fact]
public void InitialServerSynchronizationKeepsCloseProtectionActive() {
var source =
RepositoryLayout.ReadAppFile("ViewModels", "MainViewModel.cs");
var connect =
MethodBetween(source, "public async Task ConnectAsync",
"public async Task<string[]> GetVersionsAsync");
var merge = MethodBetween(source, "private void MergeServers(",
"private void ApplyServerChange");

AssertTracked(source, "public async Task ConnectAsync",
"public async Task<string[]> GetVersionsAsync",
"server-sync");
Assert.Contains("await _initialServerSync.Task", connect,
StringComparison.Ordinal);
var synchronize = merge.IndexOf("SynchronizeBackgroundTasks();",
StringComparison.Ordinal);
var ready = merge.IndexOf("_initialServerSync.TrySetResult();",
StringComparison.Ordinal);
Assert.True(ready > synchronize,
"initial synchronization must complete only after " +
"persistent server activity is registered");
}

[Fact]
public void ModpackOperationsRegisterWithBackgroundTaskService() {
var source =
RepositoryLayout.ReadAppFile("ViewModels", "MainViewModel.cs");
var update =
MethodBetween(source, "public async Task UpdateModpackAsync",
"public async Task ExportModpackAsync");
var export =
MethodBetween(source, "public async Task ExportModpackAsync",
"private void ApplyTrackerProgress");

Assert.Contains("_backgroundTasks.Begin(\"modpack-update\")", update,
StringComparison.Ordinal);
Assert.Contains("_backgroundTasks.Begin(\"modpack-export\")", export,
StringComparison.Ordinal);
}

[Fact]
public void LongRunningMutationsRegisterWithBackgroundTaskService() {
var main =
RepositoryLayout.ReadAppFile("ViewModels", "MainViewModel.cs");
var backups =
RepositoryLayout.ReadAppFile("ViewModels", "BackupsViewModel.cs");
var settings =
RepositoryLayout.ReadAppFile("ViewModels", "SettingsViewModel.cs");

AssertTracked(main, "public async Task<bool> UpdateServerAsync",
"public Task<bool> RenameServerAsync", "server-update");
AssertTracked(main, "private async Task DeleteServer",
"private void ApplyInstallProgress", "server-delete");
AssertTracked(backups, "private async Task CreateBackup",
"private async Task Restore", "backup-create");
AssertTracked(backups, "private async Task Restore",
"private async Task Delete", "backup-restore");
AssertTracked(backups, "private async Task Delete",
"private static string MapBackupError", "backup-delete");
AssertTracked(settings, "private async Task RemoveAllData",
"private async Task RemoveIncompleteInstallations",
"data-remove");
AssertTracked(
settings, "private async Task RemoveIncompleteInstallations",
"private static string FormatSize", "incomplete-install-remove");
}

private static void AssertSynchronizesAfterStateUpdate(
string method, string stateUpdateMarker) {
var update =
method.IndexOf(stateUpdateMarker, StringComparison.Ordinal);
Assert.True(update >= 0, $"Missing state update: {stateUpdateMarker}");
var synchronize = method.IndexOf("SynchronizeBackgroundTasks();",
StringComparison.Ordinal);
Assert.True(synchronize > update,
$"{stateUpdateMarker} must be followed by background " +
"server synchronization");
}

private static void AssertTracked(string source, string startMarker,
string endMarker, string category) {
var method = MethodBetween(source, startMarker, endMarker);
var begin = method.IndexOf($"BackgroundTasks.Begin(\"{category}\")",
StringComparison.OrdinalIgnoreCase);
Assert.True(begin >= 0, $"{startMarker} does not track {category}");
var firstAwait = method.IndexOf("await ", StringComparison.Ordinal);
Assert.True(firstAwait < 0 || begin < firstAwait,
$"{category} must be tracked before the first await");
}

private static string MethodBetween(string source, string startMarker,
string endMarker) {
var start = source.IndexOf(startMarker, StringComparison.Ordinal);
Assert.True(start >= 0, $"Missing method marker: {startMarker}");
var end = source.IndexOf(endMarker, start, StringComparison.Ordinal);
Assert.True(end > start, $"Missing method marker: {endMarker}");
return source[start..end];
}
}
16 changes: 13 additions & 3 deletions app/JustHostMC.App/Controls/ScriptEntryCard.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<StackPanel Spacing="8">
Expand Down Expand Up @@ -66,18 +67,27 @@
</ItemsControl>
</StackPanel>

<Button
x:Uid="ScriptsConfigureButton"
Grid.Column="1"
VerticalAlignment="Center"
Click="OnConfigureClick"
Visibility="{Binding Item.HasConfig, ElementName=Root, Converter={StaticResource BoolToVis}}">
<FontIcon FontSize="14" Glyph="&#xE713;" />
</Button>

<ToggleSwitch
x:Name="EnabledToggle"
x:Uid="ScriptsEnabledToggle"
Grid.Column="1"
Grid.Column="2"
VerticalAlignment="Center"
IsOn="{Binding Item.Enabled, ElementName=Root, Mode=OneWay}"
Toggled="OnEnabledToggled"
Visibility="{Binding Item.SupportsToggle, ElementName=Root, Converter={StaticResource BoolToVis}}" />

<Button
x:Uid="ScriptsRemoveButton"
Grid.Column="2"
Grid.Column="3"
VerticalAlignment="Center"
IsEnabled="{Binding Item.CanRemove, ElementName=Root}">
<Button.Flyout>
Expand All @@ -100,7 +110,7 @@

<Expander
Grid.Row="1"
Grid.ColumnSpan="3"
Grid.ColumnSpan="4"
Margin="0,8,0,0"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Expand Down
Loading