Mobrovac has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/360692 )
Change subject: Let the page loader accept full project domains as params as well ...................................................................... Let the page loader accept full project domains as params as well There are subtleties in difference in languages (and its variants) used on WP projects, so allow clients to specify the full domain for which to fetch and segment the page as well. Also, update the Accept header to use the latest HTML spec version (v1.4.0). Bug: T107914 Change-Id: Idc5e2bd989fbf9a990f420943c9cc811fbd247e6 --- M pageloader/PageLoader.js M spec.yaml 2 files changed, 10 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver refs/changes/92/360692/1 diff --git a/pageloader/PageLoader.js b/pageloader/PageLoader.js index a5fb761..d0f471b 100644 --- a/pageloader/PageLoader.js +++ b/pageloader/PageLoader.js @@ -38,9 +38,13 @@ var path, domain, restReq; path = 'page/html/' + encodeURIComponent( page ); - // TODO: When we support projects other than wikipedia, probably - // the client need to pass domain instead of language. - domain = sourceLanguage + '.wikipedia.org'; + if ( /.+\.org$/.test( sourceLanguage ) ) { + // we got an actual domain + domain = sourceLanguage; + } else { + // assume the client means a WP project + domain = sourceLanguage + '.wikipedia.org'; + } if ( revision ) { path += '/' + revision; @@ -49,8 +53,8 @@ restReq = { method: 'get', headers: { - // See https://www.mediawiki.org/wiki/Specs/HTML/1.2.1 - Accept: 'text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.2.1"' + // See https://www.mediawiki.org/wiki/Specs/HTML/1.4.0 + accept: 'text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.4.0"' } }; diff --git a/spec.yaml b/spec.yaml index 85a69db..ab5766c 100644 --- a/spec.yaml +++ b/spec.yaml @@ -63,7 +63,7 @@ parameters: - name: language in: path - description: The language code of the wiki + description: The language code or the domain of the wiki type: string required: true - name: title -- To view, visit https://gerrit.wikimedia.org/r/360692 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idc5e2bd989fbf9a990f420943c9cc811fbd247e6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/cxserver Gerrit-Branch: master Gerrit-Owner: Mobrovac <mobro...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits