From 7878fee6955ebb20d5925be24aadb69ab8251f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 07:11:39 +0200 Subject: [PATCH 1/7] Add timestamp to jsonschema --- _validate/addonVersion_schema.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/_validate/addonVersion_schema.json b/_validate/addonVersion_schema.json index fccc7e1..8a4bfe1 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", + "timestamp": 1723523492363.093 } - ], "title": "Root", "type": "object", @@ -266,6 +266,16 @@ "title": "Discussion comment URL", "type": "string" }, + "timestamp": { + "$id": "#/properties/timestamp", + "default": 0, + "description": "Timestamp in milliseconds, corresponding to the publication date of the add-on", + "examples": [ + 1723523492363.093 + ], + "title": "Timestamp in milliseconds", + "type": "number" + }, "vtScanUrl": { "$id": "#/properties/vtScanUrl", "default": "", From a2f8c00d58c6aaa75df2d30a352f31c38f572a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 07:52:52 +0200 Subject: [PATCH 2/7] Update _validate/addonVersion_schema.json Co-authored-by: Sean Budd --- _validate/addonVersion_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_validate/addonVersion_schema.json b/_validate/addonVersion_schema.json index 8a4bfe1..982badf 100644 --- a/_validate/addonVersion_schema.json +++ b/_validate/addonVersion_schema.json @@ -36,7 +36,7 @@ } ], "reviewUrl": "https://github.com/nvaccess/addon-datastore/discussions/1942#discussioncomment-7453248", - "timestamp": 1723523492363.093 + "submissionTime": 1723523492363.093 } ], "title": "Root", From f4dd6db502f0ab636a80c4d53b88ba68042050a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 07:56:45 +0200 Subject: [PATCH 3/7] Apply suggestions from review --- _validate/addonVersion_schema.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_validate/addonVersion_schema.json b/_validate/addonVersion_schema.json index 982badf..6aac0c6 100644 --- a/_validate/addonVersion_schema.json +++ b/_validate/addonVersion_schema.json @@ -266,14 +266,14 @@ "title": "Discussion comment URL", "type": "string" }, - "timestamp": { - "$id": "#/properties/timestamp", + "submissionTime": { + "$id": "#/properties/submissionTime", "default": 0, - "description": "Timestamp in milliseconds, corresponding to the publication date of the add-on", + "description": "Timestamp in milliseconds, corresponding to the submission time of the add-on", "examples": [ 1723523492363.093 ], - "title": "Timestamp in milliseconds", + "title": "Submission time", "type": "number" }, "vtScanUrl": { From edfb04ca6199f7de3cf3f7eefac448af4efeb31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 10:33:52 +0200 Subject: [PATCH 4/7] Add submission time to add-on metadata --- _tests/test_createJson.py | 1 + _validate/createJson.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/_tests/test_createJson.py b/_tests/test_createJson.py index b6e9c0a..b8cef56 100644 --- a/_tests/test_createJson.py +++ b/_tests/test_createJson.py @@ -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/createJson.py b/_validate/createJson.py index 9687eca..d4b84f4 100644 --- a/_validate/createJson.py +++ b/_validate/createJson.py @@ -3,6 +3,7 @@ # Copyright (C) 2022-2023 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 +import time import dataclasses import json import argparse @@ -31,6 +32,10 @@ def getSha256(addonPath: str) -> str: return sha256Addon +def getCurrentTime() -> float: + return time.time() * 1000 # Milliseconds + + def generateJsonFile( manifest: AddonManifest, addonPath: str, @@ -121,6 +126,7 @@ def _createDictMatchingJsonSchema( addonData["homepage"] = homepage if licenseUrl: addonData["licenseURL"] = licenseUrl + addonData["submissionTime"] = getCurrentTime() addonData["translations"] = [] for langCode, manifest in getAddonManifestLocalizations(manifest): From cd52fe62a9800e8b56d5f3859e91ddee6249b24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Tue, 13 Aug 2024 11:10:59 +0200 Subject: [PATCH 5/7] Update copyright years --- _tests/test_createJson.py | 2 +- _validate/createJson.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_tests/test_createJson.py b/_tests/test_createJson.py index b8cef56..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 diff --git a/_validate/createJson.py b/_validate/createJson.py index d4b84f4..5c038a0 100644 --- a/_validate/createJson.py +++ b/_validate/createJson.py @@ -1,6 +1,6 @@ #!/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 import time From 70b25a66cfcdd526862c0410b4b035a06eede759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Fri, 16 Aug 2024 05:22:48 +0200 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Sean Budd --- _validate/addonVersion_schema.json | 4 ++-- _validate/createJson.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/_validate/addonVersion_schema.json b/_validate/addonVersion_schema.json index 6aac0c6..a3b13eb 100644 --- a/_validate/addonVersion_schema.json +++ b/_validate/addonVersion_schema.json @@ -36,7 +36,7 @@ } ], "reviewUrl": "https://github.com/nvaccess/addon-datastore/discussions/1942#discussioncomment-7453248", - "submissionTime": 1723523492363.093 + "submissionTime": 1723523492363 } ], "title": "Root", @@ -271,7 +271,7 @@ "default": 0, "description": "Timestamp in milliseconds, corresponding to the submission time of the add-on", "examples": [ - 1723523492363.093 + 1723523492363 ], "title": "Submission time", "type": "number" diff --git a/_validate/createJson.py b/_validate/createJson.py index 5c038a0..16e6c9e 100644 --- a/_validate/createJson.py +++ b/_validate/createJson.py @@ -3,6 +3,7 @@ # 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 + import time import dataclasses import json @@ -32,8 +33,8 @@ def getSha256(addonPath: str) -> str: return sha256Addon -def getCurrentTime() -> float: - return time.time() * 1000 # Milliseconds +def getCurrentTime() -> int: + return int(time.gmtime() * 1000) # Milliseconds def generateJsonFile( From 3e6ab3522bb064a589774229a9d35a832e71cf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noelia=20Ruiz=20Mart=C3=ADnez?= Date: Fri, 16 Aug 2024 05:44:07 +0200 Subject: [PATCH 7/7] Fix submission time --- _validate/createJson.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_validate/createJson.py b/_validate/createJson.py index 16e6c9e..d9112f1 100644 --- a/_validate/createJson.py +++ b/_validate/createJson.py @@ -4,7 +4,7 @@ # 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 -import time +from time import gmtime, mktime import dataclasses import json import argparse @@ -34,7 +34,7 @@ def getSha256(addonPath: str) -> str: def getCurrentTime() -> int: - return int(time.gmtime() * 1000) # Milliseconds + return int(mktime(gmtime()) * 1000) # Milliseconds def generateJsonFile(