diff --git a/README.md b/README.md index 74def556e..03535e50c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ This repository contains two primary packages. For detailed development informat - [Web Interface](apps/frontend/README.md) - [Desktop App](apps/app/README.md) +## Modrinth Plus + +Modrinth Plus adds a Connected Library for Git-hosted modpacks. A connected modpack repository must expose a public `modrinth-plus.json` manifest in the repository root. See [Connected Library documentation](docs/connected-library.md) and the [connected modpack template](templates/connected-modpack/README.md). + ## Contributing We welcome contributions! Before submitting any contributions, please read our [contributing guidelines](https://docs.modrinth.com/contributing/getting-started/). diff --git a/docs/connected-library.md b/docs/connected-library.md new file mode 100644 index 000000000..40dbed5a7 --- /dev/null +++ b/docs/connected-library.md @@ -0,0 +1,64 @@ +# Connected Library + +Connected Library tracks a `.mrpack` export through a small JSON manifest hosted in a Git repository. + +## Repository layout + +The manifest must be named `modrinth-plus.json` and must live in the repository root: + +```text +my-modpack-repo/ +|-- modrinth-plus.json +|-- CHANGELOG.md +|-- README.md +`-- exports/ + `-- MyModpack-1.0.0.mrpack +``` + +When a user enters a repository URL, Modrinth Plus checks these raw URLs: + +```text +https://host/owner/repo/raw/branch/main/modrinth-plus.json +https://host/owner/repo/raw/branch/master/modrinth-plus.json +``` + +You can also paste the raw `modrinth-plus.json` URL directly. + +## Manifest + +```json +{ + "schemaVersion": 1, + "name": "My Modpack", + "version": "1.0.0", + "versionId": "my-modpack-1.0.0", + "mrpackUrl": "https://git.example.com/owner/my-modpack/raw/branch/main/exports/MyModpack-1.0.0.mrpack", + "sha512": "replace-with-the-lowercase-sha512-of-the-mrpack", + "changelog": "Initial Connected Library release." +} +``` + +Fields: + +- `schemaVersion`: Must be `1`. +- `name`: Display name in Connected Library. +- `version`: Human-readable version label. +- `versionId`: Stable unique id for this release. Change it for every update. +- `mrpackUrl`: Public HTTPS raw URL to the `.mrpack` file. +- `sha512`: SHA-512 checksum of the `.mrpack` file. +- `changelog`: Optional short release note shown in the app. + +## Release workflow + +1. Export a new `.mrpack` from the Modrinth App. +2. Put it in `exports/` with a versioned filename. +3. Calculate its SHA-512 checksum. +4. Update `modrinth-plus.json` with the new `version`, `versionId`, `mrpackUrl`, `sha512`, and `changelog`. +5. Commit and push the changes. +6. In Modrinth Plus, click `Check for updates`. + +On Windows, calculate the checksum with: + +```powershell +Get-FileHash -Algorithm SHA512 exports\MyModpack-1.0.0.mrpack +``` diff --git a/packages/app-lib/src/api/connected_library.rs b/packages/app-lib/src/api/connected_library.rs index 11656c02a..e0225b415 100644 --- a/packages/app-lib/src/api/connected_library.rs +++ b/packages/app-lib/src/api/connected_library.rs @@ -399,7 +399,11 @@ async fn resolve_manifest( } Err(ErrorKind::InputError(format!( - "Could not fetch {MANIFEST_FILE_NAME}. Tried: {}", + concat!( + "Could not fetch {MANIFEST_FILE_NAME}. Make sure the file ", + "exists in the repository root or paste the raw manifest URL ", + "directly. Tried: {}" + ), errors.join("; ") )) .into()) diff --git a/templates/connected-modpack/CHANGELOG.md b/templates/connected-modpack/CHANGELOG.md new file mode 100644 index 000000000..2a6ad4f5c --- /dev/null +++ b/templates/connected-modpack/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 + +- Initial Connected Library release. diff --git a/templates/connected-modpack/README.md b/templates/connected-modpack/README.md new file mode 100644 index 000000000..bafcbb274 --- /dev/null +++ b/templates/connected-modpack/README.md @@ -0,0 +1,26 @@ +# Connected Modpack Template + +Use this layout for a modpack repository that should work with Modrinth Plus Connected Library. + +```text +. +|-- modrinth-plus.json +|-- CHANGELOG.md +|-- README.md +`-- exports/ + `-- YourPack-1.0.0.mrpack +``` + +Update `modrinth-plus.json` after every exported `.mrpack` release. The file must stay in the repository root. + +Connect with either the repository URL: + +```text +https://git.example.com/owner/your-pack +``` + +or the raw manifest URL: + +```text +https://git.example.com/owner/your-pack/raw/branch/main/modrinth-plus.json +``` diff --git a/templates/connected-modpack/exports/.gitkeep b/templates/connected-modpack/exports/.gitkeep new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/templates/connected-modpack/exports/.gitkeep @@ -0,0 +1 @@ + diff --git a/templates/connected-modpack/modrinth-plus.json b/templates/connected-modpack/modrinth-plus.json new file mode 100644 index 000000000..ab76f68be --- /dev/null +++ b/templates/connected-modpack/modrinth-plus.json @@ -0,0 +1,9 @@ +{ + "schemaVersion": 1, + "name": "Your Pack", + "version": "1.0.0", + "versionId": "your-pack-1.0.0", + "mrpackUrl": "https://git.example.com/owner/your-pack/raw/branch/main/exports/YourPack-1.0.0.mrpack", + "sha512": "replace-with-the-lowercase-sha512-of-the-mrpack", + "changelog": "Initial Connected Library release." +}