From 381d9b57875cbfce6515e5b3229386ff304296ac Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 5 Jul 2024 02:26:24 +0000 Subject: [PATCH 1/9] fix: add env variable to allow specifying the reliefweb host for the white label file proxy Refs: UNO-845 --- docker/Dockerfile | 2 +- docker/etc/nginx/custom/01_attachment_redirections.conf | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 10935842..6c65eba4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -44,7 +44,7 @@ LABEL info.humanitarianresponse.build.date=$BUILD_DATE \ RUN mkdir -p /etc/nginx/custom && \ # Permit nginx access to the MAPBX_SECRET env variable. - sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;/' /etc/nginx/nginx.conf + sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;\n\n## ReliefWeb host.\nenv RELIEFWEB_HOST;/' /etc/nginx/nginx.conf COPY --from=builder /srv/www/assets /srv/www/assets COPY --from=builder /srv/www/config /srv/www/config diff --git a/docker/etc/nginx/custom/01_attachment_redirections.conf b/docker/etc/nginx/custom/01_attachment_redirections.conf index 82e51de2..021ff0cf 100644 --- a/docker/etc/nginx/custom/01_attachment_redirections.conf +++ b/docker/etc/nginx/custom/01_attachment_redirections.conf @@ -44,9 +44,12 @@ location @reliefweb-file { ## Ensure the proxy host is in a variable, so nginx will not cache the IP ## indefinitely and cause 502 errors if the load balancer IPs change. - set $reliefweb_host "reliefweb.int"; + ## Retrieve the mapbox access token. + set_by_lua $reliefweb_host 'return os.getenv("RELIEFWEB_HOST") or "rwint-local.test"'; ## Pass the request to ReliefWeb. + proxy_ssl_server_name on; + proxy_set_header Host $reliefweb_host; proxy_pass https://$reliefweb_host; ## Override connection and buffer vars: do not attempt to buffer, just throw From f0edb99722ac07ccd4df8a47c88c43d3e2f90729 Mon Sep 17 00:00:00 2001 From: orakili Date: Fri, 5 Jul 2024 03:54:02 +0000 Subject: [PATCH 2/9] feat: add ocha_reliefweb module for integration with RW API Refs: RW-845 --- composer.json | 1 + composer.lock | 447 +++++++++++++++++- ...play.reliefweb_resource.report.default.yml | 27 ++ ...play.reliefweb_resource.report.default.yml | 37 ++ config/core.extension.yml | 2 + .../editor.editor.ocha_reliefweb_editor.yml | 48 ++ .../filter.format.ocha_reliefweb_editor.yml | 86 ++++ ...liefweb.reliefweb_resource_type.report.yml | 15 + config/ocha_reliefweb.settings.yml | 14 + config/user.role.anonymous.yml | 2 + config/user.role.editor.yml | 12 + 11 files changed, 685 insertions(+), 6 deletions(-) create mode 100644 config/core.entity_form_display.reliefweb_resource.report.default.yml create mode 100644 config/core.entity_view_display.reliefweb_resource.report.default.yml create mode 100644 config/editor.editor.ocha_reliefweb_editor.yml create mode 100644 config/filter.format.ocha_reliefweb_editor.yml create mode 100644 config/ocha_reliefweb.reliefweb_resource_type.report.yml create mode 100644 config/ocha_reliefweb.settings.yml diff --git a/composer.json b/composer.json index 04490351..f737efd6 100644 --- a/composer.json +++ b/composer.json @@ -79,6 +79,7 @@ "unocha/gtm_barebones": "^1.0", "unocha/ocha_key_figures": "^2.0", "unocha/ocha_monitoring": "^1.0", + "unocha/ocha_reliefweb": "dev-develop", "unocha/ocha_search": "^1.0", "unocha/un_date": "^2.0", "webflo/drupal-finder": "^1.2.2" diff --git a/composer.lock b/composer.lock index 9388b01d..60c4575d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f2af9523885580b0564f8d4520cad3ec", + "content-hash": "ba68dfb88cee96bdf18cfe0d0fc51992", "packages": [ { "name": "asm89/stack-cors", @@ -2323,7 +2323,7 @@ "shasum": "6a66e40a4249351a89afba529910e1e5e2f667aa" }, "require": { - "drupal/core": "^9.1 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -3998,7 +3998,7 @@ "shasum": "6139e7d5d5d5dd28bf51b15118c8c84d6ff91614" }, "require": { - "drupal/core": "^9 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -4050,7 +4050,7 @@ "shasum": "cc7cd2f029137e99a99deb90aee83b8bbf01c0d4" }, "require": { - "drupal/core": "^8 || ^9 || ^10", + "drupal/core": "^10", "drupal/imageapi_optimize": "*" }, "type": "drupal-module", @@ -4496,7 +4496,7 @@ "shasum": "fc8ea60619b6b4682bade340e13fb4565d3a7e0c" }, "require": { - "drupal/core": "^9.1 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -5419,6 +5419,54 @@ "source": "https://git.drupalcode.org/project/samples" } }, + { + "name": "drupal/select_a11y", + "version": "dev-3.0.x", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/select_a11y.git", + "reference": "ea4fd8a1264b6de77ff043863e951f5835ba9403" + }, + "require": { + "drupal/core": "^9.2 || ^10" + }, + "require-dev": { + "drupal/facets": "*" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-3.0.x": "3.0.x-dev" + }, + "drupal": { + "version": "3.0.x-dev", + "datestamp": "1719221682", + "security-coverage": { + "status": "not-covered", + "message": "Dev releases are not covered by Drupal security advisories." + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "attiks", + "homepage": "https://www.drupal.org/user/105002" + }, + { + "name": "lazysoundsystem", + "homepage": "https://www.drupal.org/user/568228" + } + ], + "description": "Provides a multiple select widget.", + "homepage": "https://www.drupal.org/project/select_a11y", + "support": { + "source": "https://git.drupalcode.org/project/select_a11y" + } + }, { "name": "drupal/simple_menu_permissions", "version": "2.1.0", @@ -8644,6 +8692,131 @@ }, "time": "2024-04-09T23:31:35+00:00" }, + { + "name": "opis/string", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/opis/string.git", + "reference": "9ebf1a1f873f502f6859d11210b25a4bf5d141e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/string/zipball/9ebf1a1f873f502f6859d11210b25a4bf5d141e7", + "reference": "9ebf1a1f873f502f6859d11210b25a4bf5d141e7", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\String\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "Multibyte strings as objects", + "homepage": "https://opis.io/string", + "keywords": [ + "multi-byte", + "opis", + "string", + "string manipulation", + "utf-8" + ], + "support": { + "issues": "https://github.com/opis/string/issues", + "source": "https://github.com/opis/string/tree/2.0.1" + }, + "time": "2022-01-14T15:42:23+00:00" + }, + { + "name": "opis/uri", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/opis/uri.git", + "reference": "0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/uri/zipball/0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a", + "reference": "0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a", + "shasum": "" + }, + "require": { + "opis/string": "^2.0", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Uri\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "Build, parse and validate URIs and URI-templates", + "homepage": "https://opis.io", + "keywords": [ + "URI Template", + "parse url", + "punycode", + "uri", + "uri components", + "url", + "validate uri" + ], + "support": { + "issues": "https://github.com/opis/uri/issues", + "source": "https://github.com/opis/uri/tree/1.1.0" + }, + "time": "2021-05-22T15:57:08+00:00" + }, { "name": "orakili/composer-drupal-info-file-patch-helper", "version": "1.0.1", @@ -14786,6 +14959,85 @@ ], "time": "2024-01-29T20:11:03+00:00" }, + { + "name": "symfony/polyfill-uuid", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-uuid.git", + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-uuid": "*" + }, + "suggest": { + "ext-uuid": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Uuid\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for uuid functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T15:07:36+00:00" + }, { "name": "symfony/process", "version": "v6.4.8", @@ -15358,6 +15610,80 @@ ], "time": "2024-04-18T09:32:20+00:00" }, + { + "name": "symfony/uid", + "version": "v6.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/uid.git", + "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/uid/zipball/35904eca37a84bb764c560cbfcac9f0ac2bcdbdf", + "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-uuid": "^1.15" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Uid\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to generate and represent UIDs", + "homepage": "https://symfony.com", + "keywords": [ + "UID", + "ulid", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/uid/tree/v6.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:49:08+00:00" + }, { "name": "symfony/validator", "version": "v6.4.8", @@ -15933,6 +16259,70 @@ }, "time": "2024-04-12T06:49:31+00:00" }, + { + "name": "unocha/json-schema", + "version": "v2.3.2", + "source": { + "type": "git", + "url": "https://github.com/UN-OCHA/json-schema.git", + "reference": "beb68fe9cca61f6fd3115545ea2400fd7307b4a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/UN-OCHA/json-schema/zipball/beb68fe9cca61f6fd3115545ea2400fd7307b4a7", + "reference": "beb68fe9cca61f6fd3115545ea2400fd7307b4a7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "opis/string": "^2.0", + "opis/uri": "^1.0", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "ext-bcmath": "*", + "ext-intl": "*", + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\JsonSchema\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + }, + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + } + ], + "description": "Json Schema Validator for PHP", + "homepage": "https://opis.io/json-schema", + "keywords": [ + "json", + "json-schema", + "schema", + "validation", + "validator" + ], + "support": { + "source": "https://github.com/UN-OCHA/json-schema/tree/v2.3.2" + }, + "time": "2024-07-04T09:29:47+00:00" + }, { "name": "unocha/ocha_key_figures", "version": "2.1.10", @@ -15992,6 +16382,50 @@ }, "time": "2024-06-03T11:11:14+00:00" }, + { + "name": "unocha/ocha_reliefweb", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/UN-OCHA/ocha_reliefweb.git", + "reference": "e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a", + "reference": "e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a", + "shasum": "" + }, + "require": { + "drupal/core": "^10", + "drupal/select_a11y": "^3.0.x-dev@dev", + "php": ">=8.2", + "symfony/uid": "^6.3", + "unocha/json-schema": "^2.3.2" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "drupal/coder": "^8.3", + "phpcompatibility/php-compatibility": "^9.3" + }, + "default-branch": true, + "type": "drupal-module", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "UNOCHA" + } + ], + "description": "OCHA ReliefWeb integration module", + "support": { + "issues": "https://github.com/UN-OCHA/ocha_reliefweb/issues", + "source": "https://github.com/UN-OCHA/ocha_reliefweb/tree/develop" + }, + "time": "2024-07-04T12:04:29+00:00" + }, { "name": "unocha/ocha_search", "version": "v1.0.8", @@ -17575,7 +18009,8 @@ "drupal/menu_breadcrumb": 15, "drupal/openid_connect_windows_aad": 10, "drupal/samples": 10, - "drupal/viewsreference": 10 + "drupal/viewsreference": 10, + "unocha/ocha_reliefweb": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/config/core.entity_form_display.reliefweb_resource.report.default.yml b/config/core.entity_form_display.reliefweb_resource.report.default.yml new file mode 100644 index 00000000..e7e26d3e --- /dev/null +++ b/config/core.entity_form_display.reliefweb_resource.report.default.yml @@ -0,0 +1,27 @@ +uuid: 20ad53d6-83e8-4fed-86fa-61e1813c9b55 +langcode: en +status: true +dependencies: + config: + - ocha_reliefweb.reliefweb_resource_type.report + module: + - ocha_reliefweb + enforced: + config: + - ocha_reliefweb.reliefweb_resource_type.report + module: + - ocha_reliefweb +_core: + default_config_hash: BPMN75-UGH3ck0k3qNt0Vvpea4Zd2HIK8RAJnzyW6TE +id: reliefweb_resource.report.default +targetEntityType: reliefweb_resource +bundle: report +mode: default +content: + content: + type: reliefweb_resource_content_report_widget + weight: 0 + region: content + settings: { } + third_party_settings: { } +hidden: { } diff --git a/config/core.entity_view_display.reliefweb_resource.report.default.yml b/config/core.entity_view_display.reliefweb_resource.report.default.yml new file mode 100644 index 00000000..64e4d8b7 --- /dev/null +++ b/config/core.entity_view_display.reliefweb_resource.report.default.yml @@ -0,0 +1,37 @@ +uuid: 99b9e86e-53c2-47e5-9b91-0ab12a53d610 +langcode: en +status: true +dependencies: + config: + - ocha_reliefweb.reliefweb_resource_type.report + module: + - ocha_reliefweb + enforced: + config: + - ocha_reliefweb.reliefweb_resource_type.report + module: + - ocha_reliefweb +_core: + default_config_hash: GXN0Olf4tl_nRrIEEVb-j-yQ1XkTi4i_cdQR30gky9s +id: reliefweb_resource.report.default +targetEntityType: reliefweb_resource +bundle: report +mode: default +content: + content: + type: reliefweb_resource_content_report_formatter + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + label: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + status: true diff --git a/config/core.extension.yml b/config/core.extension.yml index f0e0d706..a87b995c 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -69,6 +69,7 @@ module: ocha_datawrapper: 0 ocha_key_figures: 0 ocha_monitoring: 0 + ocha_reliefweb: 0 ocha_search: 0 oembed_providers: 0 options: 0 @@ -80,6 +81,7 @@ module: responsive_image: 0 samlauth: 0 samples: 0 + select_a11y: 0 serialization: 0 simple_menu_permissions: 0 social_api: 0 diff --git a/config/editor.editor.ocha_reliefweb_editor.yml b/config/editor.editor.ocha_reliefweb_editor.yml new file mode 100644 index 00000000..339d6b99 --- /dev/null +++ b/config/editor.editor.ocha_reliefweb_editor.yml @@ -0,0 +1,48 @@ +uuid: 54aa8662-b21b-453e-bf36-a4ebb1816950 +langcode: en +status: true +dependencies: + config: + - filter.format.ocha_reliefweb_editor + module: + - ckeditor5 + enforced: + module: + - ocha_reliefweb +_core: + default_config_hash: LNqyUvhZHO3hH53pH5_u9RBNIji-dKO5mV4srjfjb0E +format: ocha_reliefweb_editor +editor: ckeditor5 +settings: + toolbar: + items: + - bold + - italic + - heading + - '|' + - link + - blockQuote + - '|' + - bulletedList + - numberedList + - indent + - outdent + - '|' + - undo + - redo + - removeFormat + plugins: + ckeditor5_heading: + enabled_headings: + - heading2 + - heading3 + - heading4 + - heading5 + - heading6 + ckeditor5_list: + properties: + reversed: false + startIndex: false + multiBlock: true +image_upload: + status: false diff --git a/config/filter.format.ocha_reliefweb_editor.yml b/config/filter.format.ocha_reliefweb_editor.yml new file mode 100644 index 00000000..352785b0 --- /dev/null +++ b/config/filter.format.ocha_reliefweb_editor.yml @@ -0,0 +1,86 @@ +uuid: b353cd81-b5e5-4b33-a072-b4ff9dba7a06 +langcode: en +status: true +dependencies: + module: + - editor + - ocha_reliefweb + enforced: + module: + - ocha_reliefweb +_core: + default_config_hash: 8-JapH-_gQUVJFe16QpVF-aj_ivTwjhMstOOLzaZp6M +name: 'Ocha ReliefWeb Editor' +format: ocha_reliefweb_editor +weight: -10 +filters: + editor_file_reference: + id: editor_file_reference + provider: editor + status: false + weight: -44 + settings: { } + filter_align: + id: filter_align + provider: filter + status: false + weight: -43 + settings: { } + filter_autop: + id: filter_autop + provider: filter + status: false + weight: -42 + settings: { } + filter_caption: + id: filter_caption + provider: filter + status: false + weight: -41 + settings: { } + filter_html: + id: filter_html + provider: filter + status: true + weight: -49 + settings: + allowed_html: '

    1. ' + filter_html_help: false + filter_html_nofollow: true + filter_html_escape: + id: filter_html_escape + provider: filter + status: false + weight: -45 + settings: { } + filter_html_image_secure: + id: filter_html_image_secure + provider: filter + status: false + weight: -36 + settings: { } + filter_htmlcorrector: + id: filter_htmlcorrector + provider: filter + status: true + weight: -47 + settings: { } + filter_image_lazy_load: + id: filter_image_lazy_load + provider: filter + status: false + weight: -35 + settings: { } + filter_url: + id: filter_url + provider: filter + status: false + weight: -40 + settings: + filter_url_length: 72 + ocha_reliefweb_external_link_filter: + id: ocha_reliefweb_external_link_filter + provider: ocha_reliefweb + status: true + weight: -46 + settings: { } diff --git a/config/ocha_reliefweb.reliefweb_resource_type.report.yml b/config/ocha_reliefweb.reliefweb_resource_type.report.yml new file mode 100644 index 00000000..0adc0783 --- /dev/null +++ b/config/ocha_reliefweb.reliefweb_resource_type.report.yml @@ -0,0 +1,15 @@ +uuid: fdaaac6c-8399-4135-8423-3df6a61848b7 +langcode: en +status: true +dependencies: + enforced: + module: + - ocha_reliefweb +settings: + disable_page_title: true + preview_warning: + value: '

      This is a preview. The document is not yet published.

      The URLs (document, files and images) are not publicly accessible so do not share them.

      ' + format: ocha_reliefweb_editor +id: report +label: Report +description: 'ReliefWeb report' diff --git a/config/ocha_reliefweb.settings.yml b/config/ocha_reliefweb.settings.yml new file mode 100644 index 00000000..d3292201 --- /dev/null +++ b/config/ocha_reliefweb.settings.yml @@ -0,0 +1,14 @@ +reliefweb_api_url: 'https://api.reliefweb.int/v1' +reliefweb_api_appname: unocha.org +reliefweb_api_cache_enabled: true +reliefweb_api_cache_lifetime: 300 +reliefweb_api_cache_namespace: 'reliefweb:api' +reliefweb_api_verify_ssl: true +reliefweb_website: 'https://reliefweb.int' +reliefweb_document_not_found_max_age: 600 +reliefweb_api_converter: 'https://reliefweb.int/search/converter/json' +reliefweb_api_use_redirects: true +reliefweb_api_post_api_schema_url: 'https://reliefweb.int/post-api-schemas/v2/' +reliefweb_api_submission_base_url: /reliefweb-submissions +reliefweb_api_submission_file_base_uri: 'public://reliefweb-submissions' +template_class_prefix: ocha-reliefweb diff --git a/config/user.role.anonymous.yml b/config/user.role.anonymous.yml index e8e00301..247cfaa5 100644 --- a/config/user.role.anonymous.yml +++ b/config/user.role.anonymous.yml @@ -5,6 +5,7 @@ dependencies: module: - contact - media + - ocha_reliefweb - system _core: default_config_hash: j5zLMOdJBqC0bMvSdth5UebkprJB8g_2FXHqhfpJzow @@ -14,5 +15,6 @@ weight: 0 is_admin: false permissions: - 'access content' + - 'access reliefweb resource update webhook' - 'access site-wide contact form' - 'view media' diff --git a/config/user.role.editor.yml b/config/user.role.editor.yml index e288ba21..e7b80c92 100644 --- a/config/user.role.editor.yml +++ b/config/user.role.editor.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - filter.format.ckeditor + - filter.format.ocha_reliefweb_editor - filter.format.text_editor_simple - media.type.image - media.type.video @@ -15,6 +16,7 @@ dependencies: - node.type.resource - node.type.response - node.type.story + - ocha_reliefweb.reliefweb_resource_type.report - taxonomy.vocabulary.contacts - taxonomy.vocabulary.country - taxonomy.vocabulary.event_type @@ -31,6 +33,7 @@ dependencies: - node - ocha_datawrapper - ocha_key_figures + - ocha_reliefweb - paragraphs - path - redirect @@ -49,6 +52,8 @@ permissions: - 'access content overview' - 'access content samples' - 'access media overview' + - 'access reliefweb resource preview files' + - 'access reliefweb resource update webhook' - 'access stories entity browser pages' - 'access taxonomy overview' - 'access toolbar' @@ -65,6 +70,7 @@ permissions: - 'administer ocha presences' - 'administer redirects' - 'administer reliefweb breadcrumbs' + - 'administer reliefweb resources' - 'administer taxonomy' - 'create basic content' - 'create content translations' @@ -74,6 +80,7 @@ permissions: - 'create media' - 'create media_collection content' - 'create region content' + - 'create report content' - 'create resource content' - 'create response content' - 'create story content' @@ -85,12 +92,15 @@ permissions: - 'create terms in theme' - 'create url aliases' - 'create video media' + - 'delete any report content' + - 'delete own report content' - 'edit any basic content' - 'edit any event content' - 'edit any image media' - 'edit any leader content' - 'edit any media_collection content' - 'edit any region content' + - 'edit any report content' - 'edit any resource content' - 'edit any response content' - 'edit any story content' @@ -112,6 +122,7 @@ permissions: - 'edit own leader content' - 'edit own media_collection content' - 'edit own region content' + - 'edit own report content' - 'edit own resource content' - 'edit own response content' - 'edit own story content' @@ -158,6 +169,7 @@ permissions: - 'update content translations' - 'update media' - 'use text format ckeditor' + - 'use text format ocha_reliefweb_editor' - 'use text format text_editor_simple' - 'view all media revisions' - 'view all revisions' From 1910dd6b31dc3f781a58986b55fffbcd217ec673 Mon Sep 17 00:00:00 2001 From: orakili Date: Sun, 7 Jul 2024 22:59:44 +0000 Subject: [PATCH 3/9] chore: change env variable for RW proxying --- docker/Dockerfile | 2 +- docker/etc/nginx/custom/01_attachment_redirections.conf | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6c65eba4..c7ccc722 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -44,7 +44,7 @@ LABEL info.humanitarianresponse.build.date=$BUILD_DATE \ RUN mkdir -p /etc/nginx/custom && \ # Permit nginx access to the MAPBX_SECRET env variable. - sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;\n\n## ReliefWeb host.\nenv RELIEFWEB_HOST;/' /etc/nginx/nginx.conf + sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;\n\n## ReliefWeb site.\nenv RELIEFWEB_SITE;/' /etc/nginx/nginx.conf COPY --from=builder /srv/www/assets /srv/www/assets COPY --from=builder /srv/www/config /srv/www/config diff --git a/docker/etc/nginx/custom/01_attachment_redirections.conf b/docker/etc/nginx/custom/01_attachment_redirections.conf index 021ff0cf..4a300fe1 100644 --- a/docker/etc/nginx/custom/01_attachment_redirections.conf +++ b/docker/etc/nginx/custom/01_attachment_redirections.conf @@ -45,12 +45,11 @@ location @reliefweb-file { ## Ensure the proxy host is in a variable, so nginx will not cache the IP ## indefinitely and cause 502 errors if the load balancer IPs change. ## Retrieve the mapbox access token. - set_by_lua $reliefweb_host 'return os.getenv("RELIEFWEB_HOST") or "rwint-local.test"'; + set_by_lua $reliefweb_site 'return os.getenv("RELIEFWEB_SITE") or "https://reliefweb.int"'; ## Pass the request to ReliefWeb. proxy_ssl_server_name on; - proxy_set_header Host $reliefweb_host; - proxy_pass https://$reliefweb_host; + proxy_pass $reliefweb_site; ## Override connection and buffer vars: do not attempt to buffer, just throw ## the data out right away and close the docstore connection when done. From 125e7e6ee336d9255e7a1fdffd96195f2b735eb2 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 8 Jul 2024 02:56:00 +0000 Subject: [PATCH 4/9] feat: select OCHA as default source when creating RW content Refs: UNO-845 --- .../unocha_reliefweb/unocha_reliefweb.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module index 7ba6dc24..8b558d17 100644 --- a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module +++ b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module @@ -5,6 +5,8 @@ * Module file for the ReliefWeb integration. */ +use Drupal\Core\Form\FormStateInterface; + /** * Implements hook_theme(). */ @@ -187,3 +189,15 @@ function unocha_reliefweb_theme() { return $themes; } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function unocha_reliefweb_form_reliefweb_resource_report_add_form_alter(array &$form, FormStateInterface $form_state, string $form_id) { + // Set OCHA as the default source. + if (isset($form['content']['widget'][0]['value']['source'])) { + if (empty($form['content']['widget'][0]['value']['source']['#default_value'])) { + $form['content']['widget'][0]['value']['source']['#default_value'] = [1503]; + } + } +} From fe214655ad67095bab0677d7ce4689fca22ef6bc Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 8 Jul 2024 03:03:47 +0000 Subject: [PATCH 5/9] chore: update ocha_reliefweb module --- composer.lock | 92 ++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 53 deletions(-) diff --git a/composer.lock b/composer.lock index 60c4575d..fab98bae 100644 --- a/composer.lock +++ b/composer.lock @@ -5419,54 +5419,6 @@ "source": "https://git.drupalcode.org/project/samples" } }, - { - "name": "drupal/select_a11y", - "version": "dev-3.0.x", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/select_a11y.git", - "reference": "ea4fd8a1264b6de77ff043863e951f5835ba9403" - }, - "require": { - "drupal/core": "^9.2 || ^10" - }, - "require-dev": { - "drupal/facets": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-3.0.x": "3.0.x-dev" - }, - "drupal": { - "version": "3.0.x-dev", - "datestamp": "1719221682", - "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "attiks", - "homepage": "https://www.drupal.org/user/105002" - }, - { - "name": "lazysoundsystem", - "homepage": "https://www.drupal.org/user/568228" - } - ], - "description": "Provides a multiple select widget.", - "homepage": "https://www.drupal.org/project/select_a11y", - "support": { - "source": "https://git.drupalcode.org/project/select_a11y" - } - }, { "name": "drupal/simple_menu_permissions", "version": "2.1.0", @@ -11235,6 +11187,40 @@ ], "time": "2024-05-24T10:39:05+00:00" }, + { + "name": "reliefweb/simple-autocomplete", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/UN-OCHA/rwint-simple-autocomplete.git", + "reference": "5d7b6236b3c680946a501da0c1aff1803853046f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/UN-OCHA/rwint-simple-autocomplete/zipball/5d7b6236b3c680946a501da0c1aff1803853046f", + "reference": "5d7b6236b3c680946a501da0c1aff1803853046f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "drupal/coder": "8.3.*", + "phpunit/phpunit": "8.3.*" + }, + "type": "drupal-library", + "notification-url": "https://packagist.org/downloads/", + "description": "Simple standalone autocomplete javascript library", + "keywords": [ + "javascript", + "php", + "reliefweb" + ], + "support": { + "source": "https://github.com/UN-OCHA/rwint-simple-autocomplete/tree/v1.3.2" + }, + "time": "2022-10-25T05:01:03+00:00" + }, { "name": "robrichards/xmlseclibs", "version": "3.1.1", @@ -16388,18 +16374,18 @@ "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_reliefweb.git", - "reference": "e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a" + "reference": "5fd33a63fa62e179fcdbf41603a8f8cfac25dc09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a", - "reference": "e2754cdad5bfc75c16bb5f27416cbceaec1b9e8a", + "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/5fd33a63fa62e179fcdbf41603a8f8cfac25dc09", + "reference": "5fd33a63fa62e179fcdbf41603a8f8cfac25dc09", "shasum": "" }, "require": { "drupal/core": "^10", - "drupal/select_a11y": "^3.0.x-dev@dev", "php": ">=8.2", + "reliefweb/simple-autocomplete": "^v1.3", "symfony/uid": "^6.3", "unocha/json-schema": "^2.3.2" }, @@ -16424,7 +16410,7 @@ "issues": "https://github.com/UN-OCHA/ocha_reliefweb/issues", "source": "https://github.com/UN-OCHA/ocha_reliefweb/tree/develop" }, - "time": "2024-07-04T12:04:29+00:00" + "time": "2024-07-08T02:54:44+00:00" }, { "name": "unocha/ocha_search", From 9ed9ada18dbbbd538ff32af1157b86c27da214d1 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 8 Jul 2024 03:10:04 +0000 Subject: [PATCH 6/9] chore: remove select_a11y --- config/core.extension.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/core.extension.yml b/config/core.extension.yml index a87b995c..6f0a9bfb 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -81,7 +81,6 @@ module: responsive_image: 0 samlauth: 0 samples: 0 - select_a11y: 0 serialization: 0 simple_menu_permissions: 0 social_api: 0 From a6aff75898bdf771f23008cb0c759f79cbeb0d22 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 8 Jul 2024 04:27:21 +0000 Subject: [PATCH 7/9] fix: update ocha_reliefweb --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index fab98bae..42ad4c57 100644 --- a/composer.lock +++ b/composer.lock @@ -16374,12 +16374,12 @@ "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_reliefweb.git", - "reference": "5fd33a63fa62e179fcdbf41603a8f8cfac25dc09" + "reference": "655ca1eefb5c6dc32a3f576b51b224c3f7ed2926" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/5fd33a63fa62e179fcdbf41603a8f8cfac25dc09", - "reference": "5fd33a63fa62e179fcdbf41603a8f8cfac25dc09", + "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/655ca1eefb5c6dc32a3f576b51b224c3f7ed2926", + "reference": "655ca1eefb5c6dc32a3f576b51b224c3f7ed2926", "shasum": "" }, "require": { @@ -16410,7 +16410,7 @@ "issues": "https://github.com/UN-OCHA/ocha_reliefweb/issues", "source": "https://github.com/UN-OCHA/ocha_reliefweb/tree/develop" }, - "time": "2024-07-08T02:54:44+00:00" + "time": "2024-07-08T04:17:16+00:00" }, { "name": "unocha/ocha_search", From 5893dfb3b42cbebdafa7b2f66748abcb96dafa2a Mon Sep 17 00:00:00 2001 From: orakili Date: Wed, 17 Jul 2024 02:13:52 +0000 Subject: [PATCH 8/9] chore: update ocha_reliefweb module Refs: UNO-845 --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 0d51856a..8c4770b0 100644 --- a/composer.lock +++ b/composer.lock @@ -16376,12 +16376,12 @@ "source": { "type": "git", "url": "https://github.com/UN-OCHA/ocha_reliefweb.git", - "reference": "655ca1eefb5c6dc32a3f576b51b224c3f7ed2926" + "reference": "89a8a4688cf3de6eaa42159b0c9321b335728ffe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/655ca1eefb5c6dc32a3f576b51b224c3f7ed2926", - "reference": "655ca1eefb5c6dc32a3f576b51b224c3f7ed2926", + "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/89a8a4688cf3de6eaa42159b0c9321b335728ffe", + "reference": "89a8a4688cf3de6eaa42159b0c9321b335728ffe", "shasum": "" }, "require": { @@ -16412,7 +16412,7 @@ "issues": "https://github.com/UN-OCHA/ocha_reliefweb/issues", "source": "https://github.com/UN-OCHA/ocha_reliefweb/tree/develop" }, - "time": "2024-07-08T04:17:16+00:00" + "time": "2024-07-16T15:50:40+00:00" }, { "name": "unocha/ocha_search", From 86cd5e42ca18f5b501310f4b40d95c58602a4468 Mon Sep 17 00:00:00 2001 From: orakili Date: Wed, 17 Jul 2024 02:15:00 +0000 Subject: [PATCH 9/9] chore: add some default content format and language for the RW resource Refs: UNO-845 --- .../unocha_reliefweb/unocha_reliefweb.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module index 8b558d17..7ee87fb9 100644 --- a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module +++ b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module @@ -200,4 +200,23 @@ function unocha_reliefweb_form_reliefweb_resource_report_add_form_alter(array &$ $form['content']['widget'][0]['value']['source']['#default_value'] = [1503]; } } + + // Set Situation Report as the default content format. + if (isset($form['content']['widget'][0]['value']['format'])) { + if (empty($form['content']['widget'][0]['value']['format']['#default_value'])) { + $form['content']['widget'][0]['value']['format']['#default_value'] = 10; + } + } + + // Set English as the default language. + if (isset($form['content']['widget'][0]['value']['language'])) { + if (empty($form['content']['widget'][0]['language']['source']['#default_value'])) { + $form['content']['widget'][0]['value']['language']['#default_value'] = [267]; + } + } + + // Hide the origin field. + if (isset($form['content']['widget'][0]['value']['origin'])) { + $form['content']['widget'][0]['value']['origin']['#access'] = FALSE; + } }