Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute and expose hash values for mod files #648

Open
rpdelaney opened this issue Sep 4, 2024 · 0 comments
Open

Compute and expose hash values for mod files #648

rpdelaney opened this issue Sep 4, 2024 · 0 comments

Comments

@rpdelaney
Copy link

rpdelaney commented Sep 4, 2024

Vocabulary

mod

A "mod" is a collection of one or more files.

file

A "file" is a regular file that can be added to the steamapps/common/devildaggers/mods directory to change game assets on load.

What

  1. Compute a hash value for each file available for download on the website.
  2. Update the /api/mods/{id} endpoint to include the computed hash value in its response.
  3. Add a new endpoint /api/mods/by-hash to allow searching for mods by their hash value.

Why

Including a hash value for each file ensures data integrity and allows users to identify authorship of files that have been renamed locally. Additionally, providing a search endpoint by hash value enhances the usability of the API by enabling users to quickly locate specific files based on their hash.

Acceptance Criteria

  1. Hash Computation:

    • A hash value (e.g., MD5, SHA-1) is computed for each file available for download.
    • The hash value is computed and stored at the time of file upload or when the file is first made available for download.
    • The implementation handles existing files and ensure that their hash values are computed and stored without requiring re-upload.
  2. API Endpoint Update:

    • The /api/mods/{id} endpoint includes the computed hash value in its JSON response.

    • Example response:

      {
          "name": "Outlines",
          "htmlDescription": "This mod adds a subtle highlight of objects on the black background. It makes DD look brighter and softer overall and might help you spotting enemies in the dark. There're two variants in the folder and both demonstrated on the screenshots below",
          "url": "",
          "trailerUrl": null,
          "authors": [
              "Stephanstein"
          ],
          "lastUpdated": "2024-06-05T15:42:29.473178",
          "modTypes": 8,
          "isHosted": true,
          "containsProhibitedAssets": false,
          "modArchive": {
              "fileSize": 3065,
              "fileSizeExtracted": 8816,
              "binaries": [
                  {
                      "name": "dd-Outlines-a_outline",
                      "size": 4408,
                      "modBinaryType": 1,
                      "containsProhibitedAssets": false,
                      "assets": [
                          {
                              "type": 16,
                              "name": "post_combine",
                              "size": 4367,
                              "isProhibited": false
                          }
                      ],
                      "modifiedLoudness": null,
                      "md5": "cde684c1343231202c4473f8a9911e85"
                  },
                  {
                      "name": "dd-Outlines-a_outline_softer",
                      "size": 4408,
                      "modBinaryType": 1,
                      "containsProhibitedAssets": false,
                      "assets": [
                          {
                              "type": 16,
                              "name": "post_combine",
                              "size": 4367,
                              "isProhibited": false
                          }
                      ],
                      "modifiedLoudness": null,
                      "md5": "e18882f3afb618d523c4668a95e281bb"
                  }
              ]
          },
          "screenshotFileNames": [
              "00.png",
              "01.png",
              "02.png"
          ]
      }
  3. New Search Endpoint:

    • A new endpoint /api/mods/by-hash is created.
    • The endpoint accepts a query parameter hash and returns a list with the details for any mod including a file with the specified hash exists.
    • Example request: GET /api/mods/by-hash?hash=abc123def4567890abc123def4567890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant