From 7c33d3965c03282958b50d0c3e0b03a07a633e8d Mon Sep 17 00:00:00 2001 From: benoit74 Date: Mon, 1 Jul 2024 09:03:44 +0000 Subject: [PATCH] Adapt mwoffliner configuration for 1.14 --- .../common/schemas/offliners/mwoffliner.py | 28 ++++++++++++++++++- .../unit/routes/test_schedules_validators.py | 4 +-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/dispatcher/backend/src/common/schemas/offliners/mwoffliner.py b/dispatcher/backend/src/common/schemas/offliners/mwoffliner.py index aa69209f3..7a756295f 100644 --- a/dispatcher/backend/src/common/schemas/offliners/mwoffliner.py +++ b/dispatcher/backend/src/common/schemas/offliners/mwoffliner.py @@ -182,12 +182,18 @@ class Meta: "description": "Mediawiki wiki base path. Otherwise `/wiki/`.", } ) - mwApiPath = String( + mwActionApiPath = String( metadata={ "label": "API Path", "description": "Mediawiki API path. Otherwise `/w/api.php`.", } ) + mwRestApiPath = String( + metadata={ + "label": "REST API Path", + "description": "Mediawiki REST API path. Otherwise `/w/rest.php`.", + } + ) mwModulePath = String( metadata={ "label": "Module Path", @@ -270,3 +276,23 @@ class Meta: "description": "Convert images to Webp", }, ) + + forceRender = String( + metadata={ + "label": "Force Render", + "description": "Force the usage of a specific API end-point/render, " + "automatically chosen otherwise", + }, + validate=validate.OneOf( + ["VisualEditor", "WikimediaDesktop", "WikimediaMobile"] + ), + ) + + insecure = fields.Boolean( + truthy=[True], + falsy=[False], + metadata={ + "label": "Insecure", + "description": "Skip HTTPS server authenticity verification step", + }, + ) diff --git a/dispatcher/backend/src/tests/unit/routes/test_schedules_validators.py b/dispatcher/backend/src/tests/unit/routes/test_schedules_validators.py index ca8c6f46d..3538aca09 100644 --- a/dispatcher/backend/src/tests/unit/routes/test_schedules_validators.py +++ b/dispatcher/backend/src/tests/unit/routes/test_schedules_validators.py @@ -72,7 +72,7 @@ def test_valid(self): "format": ["nopic", "novid", "nodet,nopic"], "keepEmptyParagraphs": False, "mwWikiPath": "/wiki", - "mwApiPath": "/w/api.php", + "mwActionApiPath": "/w/api.php", "mwModulePath": "/w/load.php", "mwDomain": "en.wikipedia.org", "mwUsername": "ausername", @@ -122,7 +122,7 @@ def test_extra_key(self): {"format": ["pic", 123]}, {"keepEmptyParagraphs": "True"}, {"mwWikiPath": 123}, - {"mwApiPath": 123}, + {"mwActionApiPath": 123}, {"mwModulePath": 123}, {"mwDomain": 123}, {"mwUsername": 123},