4594cb9c00
Bake each file's "side" (client / server / both) into manifest.json at build time so both the launcher and the server filter deterministically and offline. This replaces the launcher's previous "download everything" default and lets the server short-circuit its runtime Modrinth lookup when a file already has an authoritative tag. Schema: - ManifestFile.Side: "client" | "server" | "both" (null = "both" for backward compat with manifests pre-dating this field) - Files marked "both" omit the field entirely to keep the JSON tight Code changes: - launcher Manifest.cs + ManifestSyncService: filter out "server" files in both the prune+download path and FindMissingFiles - server Manifest.cs + ManifestSync: drop "client" files outright; only fall back to the existing runtime Modrinth lookup for files with no explicit side (legacy/un-tagged mods stay protected) - server LockedMod: side field propagates into manifest at build time - scripts/Build-Pack.ps1: propagate side from lockfile to manifest - scripts/Bootstrap-Sides.ps1: one-off populator; queries Modrinth's client_side/server_side per project, conservatively marks restricted only when one side is "unsupported", leaves ambiguous cases as "both" - pack/pack.lock.json: bootstrap-populated sides (3 client, 5 server, rest both); CurseForge mods default to "both" pending manual review; version bumped 0.9.3 -> 0.10.0 since clients must re-sync Compatibility: - Old launcher + new manifest: ignores unknown "side", downloads all - New launcher + old manifest: side null -> "both", installs all - Old server + new manifest: same -- runtime Modrinth lookup still works - New server + old manifest: side null -> runtime lookup, same behaviour
120 lines
3.6 KiB
C#
120 lines
3.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace ModpackLauncher.Models;
|
|
|
|
public sealed class Manifest
|
|
{
|
|
[JsonPropertyName("name")]
|
|
public string? Name { get; set; }
|
|
|
|
[JsonPropertyName("version")]
|
|
public string? Version { get; set; }
|
|
|
|
[JsonPropertyName("minecraft")]
|
|
public MinecraftSpec Minecraft { get; set; } = new();
|
|
|
|
[JsonPropertyName("loader")]
|
|
public LoaderSpec? Loader { get; set; }
|
|
|
|
[JsonPropertyName("files")]
|
|
public List<ManifestFile> Files { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Optional. The launcher version that the modpack publisher expects clients
|
|
/// to be running. If a client's assembly version is lower than this, the launcher
|
|
/// surfaces a "newer version available" banner pointing at <see cref="LauncherUrl"/>.
|
|
/// </summary>
|
|
[JsonPropertyName("launcherVersion")]
|
|
public string? LauncherVersion { get; set; }
|
|
|
|
/// <summary>Public download URL for the latest launcher (shown in the banner).</summary>
|
|
[JsonPropertyName("launcherUrl")]
|
|
public string? LauncherUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional. If present, the launcher writes this entry into the player's
|
|
/// <c>servers.dat</c> on first install so the modpack's server appears in
|
|
/// the multiplayer list automatically -- no copy-paste needed.
|
|
/// </summary>
|
|
[JsonPropertyName("defaultServer")]
|
|
public DefaultServer? DefaultServer { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional. Filename (in shaderpacks/) of a shader pack to enable by default
|
|
/// for fresh installs. Existing installs with a different shader chosen are
|
|
/// left alone -- this is a default, not a forced override.
|
|
/// </summary>
|
|
[JsonPropertyName("defaultShader")]
|
|
public string? DefaultShader { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional. Public base URL of the brass-sigil-server admin panel (e.g.
|
|
/// https://bns-admin.sijbers.uk). The launcher uses this to send whitelist
|
|
/// requests on the player's behalf -- nothing else.
|
|
/// </summary>
|
|
[JsonPropertyName("panelUrl")]
|
|
public string? PanelUrl { get; set; }
|
|
}
|
|
|
|
public sealed class DefaultServer
|
|
{
|
|
[JsonPropertyName("name")]
|
|
public string Name { get; set; } = "";
|
|
|
|
[JsonPropertyName("ip")]
|
|
public string Ip { get; set; } = "";
|
|
}
|
|
|
|
public sealed class MinecraftSpec
|
|
{
|
|
[JsonPropertyName("version")]
|
|
public string Version { get; set; } = "";
|
|
}
|
|
|
|
public sealed class LoaderSpec
|
|
{
|
|
/// <summary>"forge" | "fabric" | "neoforge" | "vanilla" (or null)</summary>
|
|
[JsonPropertyName("type")]
|
|
public string Type { get; set; } = "vanilla";
|
|
|
|
[JsonPropertyName("version")]
|
|
public string Version { get; set; } = "";
|
|
}
|
|
|
|
public sealed class ManifestFile
|
|
{
|
|
[JsonPropertyName("path")]
|
|
public string Path { get; set; } = "";
|
|
|
|
[JsonPropertyName("url")]
|
|
public string Url { get; set; } = "";
|
|
|
|
[JsonPropertyName("sha1")]
|
|
public string? Sha1 { get; set; }
|
|
|
|
[JsonPropertyName("size")]
|
|
public long? Size { get; set; }
|
|
|
|
/// <summary>
|
|
/// "both" (default), "client", or "server". The launcher skips files
|
|
/// marked "server"; the server-tool skips files marked "client".
|
|
/// Null/missing/unknown = treated as "both" so manifests pre-dating
|
|
/// this field stay fully compatible.
|
|
/// </summary>
|
|
[JsonPropertyName("side")]
|
|
public string? Side { get; set; }
|
|
}
|
|
|
|
public sealed class PackVersionRecord
|
|
{
|
|
[JsonPropertyName("name")]
|
|
public string? Name { get; set; }
|
|
|
|
[JsonPropertyName("version")]
|
|
public string? Version { get; set; }
|
|
|
|
[JsonPropertyName("syncedAt")]
|
|
public string? SyncedAt { get; set; }
|
|
}
|