SMAPI icon indicating copy to clipboard operation
SMAPI copied to clipboard

Add `UpdateManifest` update keys

Open jltaylor-us opened this issue 3 years ago • 0 comments

Allows for reading update metadata from arbitrary URLs.

See example update manifest file here.

Invoking a local build of SMAPI.Web with the following test data:

{
    "mods": [
        {
            "id": "jltaylor-us.JsonProcessor",
            "updateKeys": ["UpdateManifest:https://raw.githubusercontent.com/jltaylor-us/StardewJsonProcessor/default/update-manifest.json@jp"],
            "installedVersion": "0.4.0"
        },
        {
            "id": "jltaylor-us.ContentPatcherJsonProcessor",
            "updateKeys": ["UpdateManifest:https://raw.githubusercontent.com/jltaylor-us/StardewJsonProcessor/default/update-manifest.json@cpjp"],
            "installedVersion": "0.4.5"
        }
    ],
    "apiVersion": "3.15.1"
}

yields the expected update suggestions:

$ curl -H "Content-Type: application/json" -X POST --data @$HOME/Desktop/mod-test2.json https://localhost:5001/api/v3.0/mods
[
  {
    "id": "jltaylor-us.JsonProcessor",
    "suggestedUpdate": {
      "version": "0.5.0",
      "url": "https://github.com/jltaylor-us/StardewJsonProcessor/releases/download/v0.5.0/JsonProcessor.0.5.0.zip"
    },
    "errors": [
      "The Nexus client is currently disabled due to the configuration."
    ]
  },
  {
    "id": "jltaylor-us.ContentPatcherJsonProcessor",
    "suggestedUpdate": {
      "version": "0.5.0",
      "url": "https://github.com/jltaylor-us/StardewJsonProcessor/releases/download/v0.5.0/ContentPatcherJsonProcessor.0.5.0.zip"
    },
    "errors": [
      "The Nexus client is currently disabled due to the configuration."
    ]
  }
]

(see individual commit comments for details about what changed in the implementation)

Future work:

  • actually do something with the ManifestVersion field (e.g., validate it)
  • add a JSON schema for the JSON validator.

jltaylor-us avatar Oct 02 '22 01:10 jltaylor-us