diff --git a/_tests/test_createJson.py b/_tests/test_createJson.py index b6e9c0a..6b793d4 100644 --- a/_tests/test_createJson.py +++ b/_tests/test_createJson.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2022 Noelia Ruiz Martínez, NV Access Limited +# Copyright (C) 2022-2024 Noelia Ruiz Martínez, NV Access Limited # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html @@ -79,6 +79,7 @@ def _assertJsonFilesEqual(self, actualJsonPath: str, expectedJsonPath: str): del expectedJson["sha256-comment"] # remove explanatory comment with open(actualJsonPath) as actualFile: actualJson = json.load(actualFile) + del actualJson["submissionTime"] # remove submission time self.assertDictEqual(actualJson, expectedJson) diff --git a/_validate/addonVersion_schema.json b/_validate/addonVersion_schema.json index fccc7e1..a3b13eb 100644 --- a/_validate/addonVersion_schema.json +++ b/_validate/addonVersion_schema.json @@ -35,9 +35,9 @@ "description": "erleichtert das Durchführen von xyz" } ], - "reviewUrl": "https://github.com/nvaccess/addon-datastore/discussions/1942#discussioncomment-7453248" + "reviewUrl": "https://github.com/nvaccess/addon-datastore/discussions/1942#discussioncomment-7453248", + "submissionTime": 1723523492363 } - ], "title": "Root", "type": "object", @@ -266,6 +266,16 @@ "title": "Discussion comment URL", "type": "string" }, + "submissionTime": { + "$id": "#/properties/submissionTime", + "default": 0, + "description": "Timestamp in milliseconds, corresponding to the submission time of the add-on", + "examples": [ + 1723523492363 + ], + "title": "Submission time", + "type": "number" + }, "vtScanUrl": { "$id": "#/properties/vtScanUrl", "default": "", diff --git a/_validate/createJson.py b/_validate/createJson.py index 9687eca..d9112f1 100644 --- a/_validate/createJson.py +++ b/_validate/createJson.py @@ -1,8 +1,10 @@ #!/usr/bin/env python -# Copyright (C) 2022-2023 Noelia Ruiz Martínez, NV Access Limited +# Copyright (C) 2022-2024 Noelia Ruiz Martínez, NV Access Limited # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html + +from time import gmtime, mktime import dataclasses import json import argparse @@ -31,6 +33,10 @@ def getSha256(addonPath: str) -> str: return sha256Addon +def getCurrentTime() -> int: + return int(mktime(gmtime()) * 1000) # Milliseconds + + def generateJsonFile( manifest: AddonManifest, addonPath: str, @@ -121,6 +127,7 @@ def _createDictMatchingJsonSchema( addonData["homepage"] = homepage if licenseUrl: addonData["licenseURL"] = licenseUrl + addonData["submissionTime"] = getCurrentTime() addonData["translations"] = [] for langCode, manifest in getAddonManifestLocalizations(manifest):