From d73fa67a3184aef1ffe8a4364484acc183662e7b Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Tue, 17 Jan 2023 14:42:49 -0500 Subject: [PATCH] =?UTF-8?q?feat(pwa):=20=E2=9C=A8=20use=20proper=20manifes?= =?UTF-8?q?t=20type=20instead=20of=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/Api/ApiFormatManifest.php | 40 ++++++++++++++++++++++++++++++ includes/Api/ApiWebappManifest.php | 9 ++++--- 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 includes/Api/ApiFormatManifest.php diff --git a/includes/Api/ApiFormatManifest.php b/includes/Api/ApiFormatManifest.php new file mode 100644 index 00000000..2d5b07f5 --- /dev/null +++ b/includes/Api/ApiFormatManifest.php @@ -0,0 +1,40 @@ +. + * + * @file + */ + +namespace MediaWiki\Skins\Citizen\Api; + +use ApiFormatJson; + +/** + * T282500 + * TODO: This should be merged to core + */ +class ApiFormatManifest extends ApiFormatJson { + /** + * Return the proper content-type + * + * @return string + */ + public function getMimeType() { + return 'application/manifest+json'; + } +} diff --git a/includes/Api/ApiWebappManifest.php b/includes/Api/ApiWebappManifest.php index d79cc79f..ba53b3b5 100644 --- a/includes/Api/ApiWebappManifest.php +++ b/includes/Api/ApiWebappManifest.php @@ -23,7 +23,7 @@ namespace MediaWiki\Skins\Citizen\Api; use ApiBase; -use ApiFormatJson; +use MediaWiki\Skins\Citizen\Api\ApiFormatManifest; use MediaWiki\MediaWikiServices; use SpecialPage; use Title; @@ -31,6 +31,9 @@ use Title; /** * Based on the MobileFrontend extension * Return the webapp manifest for this wiki + * + * T282500 + * TODO: This should be merged to core */ class ApiWebappManifest extends ApiBase { /** @@ -144,9 +147,9 @@ class ApiWebappManifest extends ApiBase { /** * Get the JSON printer * - * @return ApiFormatJson + * @return ApiFormatManifest */ public function getCustomPrinter() { - return new ApiFormatJson( $this->getMain(), 'json' ); + return new ApiFormatManifest( $this->getMain(), 'json' ); } }