Changes

→‎Advanced: + Custom update manifest in SMAPI 4.0.0
Line 89: Line 89:  
# update keys from the mod compatibility list (in the order Nexus, ModDrop, CurseForge, and Chucklefish);
 
# update keys from the mod compatibility list (in the order Nexus, ModDrop, CurseForge, and Chucklefish);
 
# update key overrides from the mod compatibility list.
 
# update key overrides from the mod compatibility list.
 +
 +
===Custom update manifest===
 +
{{SMAPI upcoming|4.0.0}}
 +
'''This is highly specialized''' and supports specific edge cases (like mods which only exist in a shared GitHub repository or custom website). Most mods should use normal update keys instead.
 +
 +
An ''update manifest'' is a JSON file hosted on a website, which the SMAPI servers can download to get info about mods which aren't available on a more usual site like Nexus. For example, this manifest shows info about a mod which is only hosted on a custom website:
 +
<syntaxhighlight lang="js">
 +
{
 +
    "Format": "4.0.0",
 +
    "Mods": {
 +
        "ExampleMod": {
 +
            "Name": "Example Mod",
 +
            "ModPageUrl": "https://example.org/mods/example-mod",
 +
            "Versions": [
 +
                { "Version": "1.0.0" }
 +
            ]
 +
        }
 +
    }
 +
}
 +
</syntaxhighlight>
 +
 +
Here are the expected fields (all required unless noted otherwise):
 +
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! usage
 +
|-
 +
| <samp>Format</samp>
 +
| The version of the manifest format (currently <samp>4.0.0</samp>). This is used to parse older manifests correctly if later versions of SMAPI change the format.
 +
|-
 +
| <samp>Mods</samp>
 +
| The mods for which info is provided. Any number of mods can be listed.
 +
 +
This consists of a string → model lookup, where...
 +
* The key is the update subkey (see details below the table).
 +
* The value is a model with the fields listed below.
 +
 +
Each mod has these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! usage
 +
|-
 +
| <samp>Name</samp>
 +
| The human-readable display name for the mod.
 +
|-
 +
| <samp>ModPageUrl</samp>
 +
| The URL of the page from which the player can download updates.
 +
|-
 +
| <samp>Versions</samp>
 +
| The versions available to download. Any number of versions can be listed, and they'll be compared to the player's installed version using the [[#Update check algorithm|usual update check algorithm]].
 +
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! usage
 +
|-
 +
| <samp>Version</samp>
 +
| The semantic version number.
 +
|-
 +
| <samp>ModPageUrl</samp>
 +
| ''(Optional)'' The URL of the page from which the player can download this update, if different from the <samp>ModPageUrl</samp> for the mod itself.
 +
|}
 +
|}
 +
|}
 +
 +
To use the manifest, a mod must add an [[#Enable update checks|update key]] in the form <samp>UpdateManifest:{{t|full URL to json file}}@{{t|mod key}}</samp>. If the example above was hosted at <samp><nowiki>https://example.org/mod-updates.json</nowiki></samp>, then its update key would look like this:
 +
<syntaxhighlight lang="js">
 +
"UpdateKeys": [ "UpdateManifest:https://example.org/mod-updates.json@ExampleMod" ]
 +
</syntaxhighlight>
translators
8,404

edits